17#include <zephyr/kernel.h>
18#include <zephyr/logging/log.h>
24#define ZCT_TIMER_LOG_LEVEL LOG_LEVEL_WRN
51 Timer(
const char* name, std::function<
void()> expiryCallback) :
65 start(period_ms, period_ms);
74 void start(int64_t startDuration_ms, int64_t period_ms) {
76 __ASSERT_NO_MSG(startDuration_ms >= 0);
77 __ASSERT_NO_MSG(period_ms >= -1);
80 LOG_WRN(
"Timer \"%s\" is not registered with a timer manager. Expiry events will not be handled.", this->
m_name);
86 if (period_ms == -1) {
#define ZCT_TIMER_LOG_LEVEL
Definition Timer.hpp:24
A timer that can be used to execute callbacks at regular intervals in an event driven application.
Definition Timer.hpp:39
const std::function< void()> & getExpiryCallback() const
Definition Timer.hpp:173
void setExpiryCallback(std::function< void()> callback)
Definition Timer.hpp:166
bool getIsRegistered() const
Definition Timer.hpp:159
bool m_isRegistered
Definition Timer.hpp:180
void updateAfterExpiry()
Definition Timer.hpp:122
Timer(const char *name, std::function< void()> expiryCallback)
Definition Timer.hpp:51
std::function< void()> m_expiryCallback
Definition Timer.hpp:182
void setIsRegistered(bool isRegistered)
Definition Timer.hpp:152
const char * m_name
Definition Timer.hpp:181
int64_t getNextExpiryTimeTicks() const
Definition Timer.hpp:144
bool m_isRunning
Definition Timer.hpp:179
void start(int64_t startDuration_ms, int64_t period_ms)
Definition Timer.hpp:74
int64_t nextExpiryTime_ticks
Definition Timer.hpp:178
void start(int64_t period_ms)
Definition Timer.hpp:63
int64_t period_ticks
Definition Timer.hpp:176
void stop()
Definition Timer.hpp:101
int64_t startTime_ticks
Definition Timer.hpp:177
bool isRunning() const
Definition Timer.hpp:113