2020-12-15 23:00:30 +01:00
|
|
|
#ifndef FSFW_TIMEMANAGER_COUNTDOWN_H_
|
|
|
|
#define FSFW_TIMEMANAGER_COUNTDOWN_H_
|
|
|
|
|
|
|
|
#include "Clock.h"
|
|
|
|
|
2016-06-15 23:48:41 +02:00
|
|
|
/**
|
|
|
|
* @brief This file defines the Countdown class.
|
|
|
|
* @author baetz
|
|
|
|
*/
|
|
|
|
class Countdown {
|
|
|
|
public:
|
|
|
|
uint32_t timeout;
|
|
|
|
Countdown(uint32_t initialTimeout = 0);
|
|
|
|
~Countdown();
|
|
|
|
ReturnValue_t setTimeout(uint32_t miliseconds);
|
|
|
|
|
|
|
|
bool hasTimedOut() const;
|
|
|
|
|
|
|
|
bool isBusy() const;
|
|
|
|
|
2020-12-15 23:00:30 +01:00
|
|
|
//!< Use last set timeout value and restart timer.
|
|
|
|
ReturnValue_t resetTimer();
|
2018-07-12 16:29:32 +02:00
|
|
|
|
2020-12-15 23:00:30 +01:00
|
|
|
//!< Make hasTimedOut() return true
|
|
|
|
void timeOut();
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint32_t startTime = 0;
|
2016-06-15 23:48:41 +02:00
|
|
|
};
|
|
|
|
|
2020-12-15 23:00:30 +01:00
|
|
|
#endif /* FSFW_TIMEMANAGER_COUNTDOWN_H_ */
|