2021-03-12 19:01:47 +00:00
|
|
|
#ifndef TIMER_H_
|
|
|
|
#define TIMER_H_
|
|
|
|
|
|
|
|
#include <TimeLib.h>
|
|
|
|
|
2021-03-12 22:21:45 +00:00
|
|
|
class Timer {
|
2021-03-12 19:01:47 +00:00
|
|
|
public:
|
2021-03-12 22:21:45 +00:00
|
|
|
Timer();
|
2021-03-12 19:01:47 +00:00
|
|
|
|
2021-03-27 21:02:43 +00:00
|
|
|
void setTimeout(const uint32_t timeout_ms);
|
|
|
|
time_t getTriggerTimeInSec() const;
|
2021-03-12 19:01:47 +00:00
|
|
|
|
2021-03-12 22:21:45 +00:00
|
|
|
bool isActive() const;
|
2021-03-12 19:01:47 +00:00
|
|
|
|
2021-03-12 22:21:45 +00:00
|
|
|
void reset();
|
2021-03-12 19:01:47 +00:00
|
|
|
|
2021-03-12 22:21:45 +00:00
|
|
|
bool check();
|
|
|
|
void start();
|
2021-03-12 19:01:47 +00:00
|
|
|
|
|
|
|
private:
|
2021-03-27 21:02:43 +00:00
|
|
|
uint32_t _timeout_ms;
|
|
|
|
uint32_t _nextTimeout;
|
2021-03-12 19:01:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|