RBCX
Library for the RB3204-RBCX board with the ESP32 by RoboticsBrno.
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
rb::Timers Class Reference

#include <RBCXTimers.h>

Public Member Functions

uint16_t schedule (uint32_t period_ms, std::function< bool()> callback)
 Schedule callback to fire after period (in millisecond). More...
 
bool reset (uint16_t id, uint32_t period_ms)
 Reset the timer with the given ID. More...
 
bool cancel (uint16_t id)
 Cancel the timer with the given ID. More...
 
bool stop (uint16_t id)
 Stop the timer with the given ID. More...
 
bool isOnTimerTask () const
 

Static Public Member Functions

static void deleteFreeRtOsTimerTask ()
 If you don't plan to use FreeRTOS SW timers, call this to free up 2KB of heap. More...
 
static Timersget ()
 

Static Public Attributes

static constexpr uint16_t INVALID_ID = 0
 

Member Function Documentation

◆ cancel()

bool rb::Timers::cancel ( uint16_t  id)

Cancel the timer with the given ID.

Parameters
idis the ID of the timer to cancel.
Returns
true if the timer was cancelled, false if the timer was not found.

◆ deleteFreeRtOsTimerTask()

void rb::Timers::deleteFreeRtOsTimerTask ( )
static

If you don't plan to use FreeRTOS SW timers, call this to free up 2KB of heap.

◆ get()

Timers & rb::Timers::get ( )
static

◆ isOnTimerTask()

bool rb::Timers::isOnTimerTask ( ) const

◆ reset()

bool rb::Timers::reset ( uint16_t  id,
uint32_t  period_ms 
)

Reset the timer with the given ID.

Parameters
idis the ID of the timer to reset.
period_msis the new period of the timer.

◆ schedule()

uint16_t rb::Timers::schedule ( uint32_t  period_ms,
std::function< bool()>  callback 
)

Schedule callback to fire after period (in millisecond).

Return true from the callback to schedule periodically, false to not (singleshot timer).

Parameters
period_msis period in which will be the schedule callback fired
callbackis a function which will be schedule with the set period.
Returns
timer ID that you can use to cancel the timer.

◆ stop()

bool rb::Timers::stop ( uint16_t  id)

Stop the timer with the given ID.

Parameters
idis the ID of the timer to stop.
Returns
true if the timer was stopped, false if the timer was not found.

Member Data Documentation

◆ INVALID_ID

constexpr uint16_t rb::Timers::INVALID_ID = 0
staticconstexpr

The documentation for this class was generated from the following files: