24#ifndef TAPROOT_PERIODIC_TIMER_HPP_
25#define TAPROOT_PERIODIC_TIMER_HPP_
46 explicit PeriodicTimer(uint32_t period) : period(period), timeout(period) {}
52 inline void restart() { timeout.restart(period); }
61 this->period = period;
68 inline void stop() { timeout.stop(); }
81 if (timeout.execute())
83 uint32_t now = T::TimeFunc();
87 timeout.expireTime += period;
88 }
while (timeout.expireTime <= now);
90 timeout.isRunning =
true;
91 timeout.isExecuted =
false;
100 inline bool isStopped()
const {
return timeout.isStopped(); }
Definition periodic_timer.hpp:42
bool isStopped() const
Definition periodic_timer.hpp:100
void restart(uint32_t period)
Definition periodic_timer.hpp:59
PeriodicTimer()
Definition periodic_timer.hpp:44
void restart()
Definition periodic_timer.hpp:52
PeriodicTimer(uint32_t period)
Definition periodic_timer.hpp:46
bool execute()
Definition periodic_timer.hpp:79
void stop()
Definition periodic_timer.hpp:68
Definition ballistics.cpp:29