54 Timer(
char const* name_,
void(*func)(TimerHandle_t handle), TickType_t period_,
bool reload,
bool start_) :
56#if( configSUPPORT_STATIC_ALLOCATION == 1 )
57 xTimerCreateStatic(name_, period_, reload, this, func, &timerBuffer)
59 xTimerCreate(name_, period_, reload, this, func)
66#if FREERTOSCPP_USE_CHRONO
67 Timer(
char const* name_,
void(*func)(TimerHandle_t handle), Time_ms period_,
bool reload,
bool start_) :
69#if( configSUPPORT_STATIC_ALLOCATION == 1 )
70 xTimerCreateStatic(name_, ms2ticks(period_), reload, this, func, &timerBuffer)
72 xTimerCreate(name_, ms2ticks(period_), reload, this, func)
80 virtual ~Timer() {xTimerDelete(timerHandle, portMAX_DELAY); }
82 bool active() {
return xTimerIsTimerActive(timerHandle); }
83 TickType_t
expiryTime() {
return xTimerGetExpiryTime(timerHandle); }
84 const char*
name() {
return pcTimerGetName(timerHandle); }
85 TickType_t
period() {
return xTimerGetPeriod(timerHandle); }
86 bool period(TickType_t period_, TickType_t wait = portMAX_DELAY) { configASSERT(period_ > 0);
return xTimerChangePeriod(timerHandle, period_, wait);}
87#if FREERTOSCPP_USE_CHRONO
88 bool period(Time_ms period_, TickType_t wait = portMAX_DELAY) { configASSERT(ms2ticks(period_) > 0);
return xTimerChangePeriod(timerHandle, ms2ticks(period_), wait);}
89 bool period(Time_ms period_, Time_ms wait) { configASSERT(ms2ticks(period_) > 0);
return xTimerChangePeriod(timerHandle, ms2ticks(period_), ms2ticks(wait));}
91 bool periodISR(TickType_t period_, portBASE_TYPE& waswoken) { configASSERT(period_ > 0);
return xTimerChangePeriodFromISR(timerHandle, period_, &waswoken); }
92#if FREERTOSCPP_USE_CHRONO
93 bool periodISR(Time_ms period_, portBASE_TYPE& waswoken) { configASSERT(ms2ticks(period_) > 0);
return xTimerChangePeriodFromISR(timerHandle, ms2ticks(period_), &waswoken); }
95 bool reset(TickType_t wait = portMAX_DELAY) {
return xTimerReset(timerHandle, wait); }
96#if FREERTOSCPP_USE_CHRONO
97 bool reset(Time_ms wait) {
return xTimerReset(timerHandle, ms2ticks(wait)); }
99 bool resetISR(portBASE_TYPE& waswoken) {
return xTimerResetFromISR(timerHandle, &waswoken); }
101 bool start(TickType_t wait = portMAX_DELAY) {
return xTimerStart(timerHandle, wait); }
102#if FREERTOSCPP_USE_CHRONO
103 bool start(Time_ms wait) {
return xTimerStart(timerHandle, ms2ticks(wait)); }
105 bool startISR(portBASE_TYPE& waswoken) {
return xTimerStartFromISR(timerHandle, &waswoken); }
107 bool stop(TickType_t wait = portMAX_DELAY) {
return xTimerStop(timerHandle, wait); }
108#if FREERTOSCPP_USE_CHRONO
109 bool stop(Time_ms wait) {
return xTimerStop(timerHandle, ms2ticks(wait)); }
111 bool stopISR(portBASE_TYPE& waswoken) {
return xTimerStopFromISR(timerHandle, &waswoken); }
113#if FREERTOS_VERSION >= 10'002'000
114 void reload(
bool reload) { vTimerSetReloadMode( timerHandle, reload); }
121#if( configSUPPORT_STATIC_ALLOCATION == 1 )
122 StaticTimer_t timerBuffer;