|
FreeRTOS-Cpp
|
Class that encapsulates the functionality of a FreeRTOS timer. More...
#include <Timer.hpp>


Public Member Functions | |
| Timer (const Timer &)=delete | |
| Timer & | operator= (const Timer &)=delete |
Public Member Functions inherited from FreeRTOS::TimerBase | |
| TimerBase (const TimerBase &)=delete | |
| TimerBase & | operator= (const TimerBase &)=delete |
| virtual void | timerEntry () final |
| Function that acts as the entry point of the timer instance. | |
| bool | isValid () const |
| Function that checks the value of the timer handle. This function should be called to ensure the timer was created successfully. | |
| bool | isActive () const |
Function that calls BaseType_t xTimerIsTimerActive(
TimerHandle_t xTimer ) | |
| bool | start (const TickType_t blockTime=0) const |
Function that calls BaseType_t xTimerStart( TimerHandle_t
xTimer, TickType_t xBlockTime ) | |
| bool | startFromISR (bool &higherPriorityTaskWoken) const |
Function that calls BaseType_t xTimerStartFromISR( TimerHandle_t
xTimer, BaseType_t *pxHigherPriorityTaskWoken ) | |
| bool | startFromISR () const |
Function that calls BaseType_t xTimerStartFromISR( TimerHandle_t
xTimer, BaseType_t *pxHigherPriorityTaskWoken ) | |
| bool | stop (const TickType_t blockTime=0) const |
Function that calls BaseType_t xTimerStop( TimerHandle_t xTimer,
TickType_t xBlockTime ) | |
| bool | stopFromISR (bool &higherPriorityTaskWoken) const |
Function that calls BaseType_t xTimerStopFromISR( TimerHandle_t
xTimer, BaseType_t *pxHigherPriorityTaskWoken ) | |
| bool | stopFromISR () const |
Function that calls BaseType_t xTimerStopFromISR( TimerHandle_t
xTimer, BaseType_t *pxHigherPriorityTaskWoken ) | |
| bool | changePeriod (const TickType_t newPeriod, const TickType_t blockTime=0) const |
Function that calls BaseType_t xTimerChangePeriod( TimerHandle_t
xTimer, TickType_t xNewPeriod, TickType_t xBlockTime ) | |
| bool | changePeriodFromISR (bool &higherPriorityTaskWoken, const TickType_t newPeriod) const |
Function that calls BaseType_t xTimerChangePeriodFromISR(
TimerHandle_t xTimer, TickType_t xNewPeriod, BaseType_t
*pxHigherPriorityTaskWoken ) | |
| bool | changePeriodFromISR (const TickType_t newPeriod) const |
Function that calls BaseType_t xTimerChangePeriodFromISR(
TimerHandle_t xTimer, TickType_t xNewPeriod, BaseType_t
*pxHigherPriorityTaskWoken ) | |
| bool | deleteTimer (const TickType_t blockTime=0) |
Function that calls BaseType_t xTimerDelete( TimerHandle_t
xTimer, TickType_t xBlockTime ) | |
| bool | reset (const TickType_t blockTime=0) const |
Function that calls BaseType_t xTimerReset( TimerHandle_t
xTimer, TickType_t xBlockTime ) | |
| bool | resetFromISR (bool &higherPriorityTaskWoken) const |
Function that calls BaseType_t xTimerResetFromISR( TimerHandle_t
xTimer, BaseType_t *pxHigherPriorityTaskWoken ) | |
| bool | resetFromISR () const |
Function that calls BaseType_t xTimerResetFromISR( TimerHandle_t
xTimer, BaseType_t *pxHigherPriorityTaskWoken ) | |
| void | setReloadMode (const bool autoReload) const |
Function that calls void vTimerSetReloadMode( TimerHandle_t
xTimer, const UBaseType_t xAutoReload ) | |
| const char * | getName () const |
Function that calls const char * pcTimerGetName( TimerHandle_t
xTimer ) | |
| TickType_t | getPeriod () const |
Function that calls TickType_t xTimerGetPeriod( TimerHandle_t
xTimer ) | |
| TickType_t | getExpiryTime () const |
Function that calls TickType_t xTimerGetExpiryTime(
TimerHandle_t xTimer ) | |
| bool | getReloadMode () const |
Function that calls UBaseType_t uxTimerGetReloadMode(
TimerHandle_t xTimer ) | |
| void | setDeleteBlockTime (const TickType_t deleteBlockTime=0) |
| Set the delete block time. This value is used when the destructor calls deleteTimer(). | |
| TickType_t | getDeleteBlockTime () const |
| Set the delete block time. This value is used when the destructor calls deleteTimer(). | |
Protected Member Functions | |
| Timer (const TickType_t period, const bool autoReload=false, const char *name="", const TickType_t deleteBlockTime=0) | |
Construct a new Timer object by calling TimerHandle_t xTimerCreate( const char * const pcTimerName, const TickType_t
xTimerPeriod, const UBaseType_t xAutoReload, void * const pvTimerID,
TimerCallbackFunction_t pxCallbackFunction ) | |
| Timer (Timer &&) noexcept=default | |
| Timer & | operator= (Timer &&) noexcept=default |
Protected Member Functions inherited from FreeRTOS::TimerBase | |
| virtual void | timerFunction ()=0 |
| Abstraction function that acts as the entry point of the timer callback for the user. | |
Additional Inherited Members | |
Static Public Member Functions inherited from FreeRTOS::TimerBase | |
| static void * | operator new (size_t)=delete |
| static void * | operator new[] (size_t)=delete |
| static void * | operator new (size_t, void *ptr) |
| static void * | operator new[] (size_t, void *ptr) |
Class that encapsulates the functionality of a FreeRTOS timer.
Timer Timer.hpp <FreeRTOS/Timer.hpp>
Each software timer requires a small amount of RAM that is used to hold the timer's state. If a timer is created using this class then this RAM is automatically allocated from the FreeRTOS heap. If a software timer is created using FreeRTOS::StaticTimer() then the RAM is included in the object so it can be statically allocated at compile time. See the Static Vs Dynamic allocation page for more information.
|
inlineexplicitprotected |
Construct a new Timer object by calling TimerHandle_t xTimerCreate( const char * const pcTimerName, const TickType_t
xTimerPeriod, const UBaseType_t xAutoReload, void * const pvTimerID,
TimerCallbackFunction_t pxCallbackFunction )
xTimerCreate the constructor passes the this pointer as the pvTimerID argument. This pointer is used so that the interface function callTimerFunction() can invoke timerFunction() for this instance of the class.| period | The period of the timer. The period is specified in ticks, and the macro pdMS_TO_TICKS() can be used to convert a time specified in milliseconds to a time specified in ticks. For example, if the timer must expire after 100 ticks, then simply set period to 100. Alternatively, if the timer must expire after 500ms, then set period to pdMS_TO_TICKS( 500 ). pdMS_TO_TICKS() can only be used if configTICK_RATE_HZ is less than or equal to 1000. The timer period must be greater than 0. |
| autoReload | If autoReload is set to true, then the timer will expire repeatedly with a frequency set by the period parameter. If autoReload is set to false, then the timer will be a one-shot and enter the dormant state after it expires. |
| name | A human readable text name that is assigned to the timer. This is done purely to assist debugging. The RTOS kernel itself only ever references a timer by its handle, and never by its name. |
| deleteBlockTime | Specifies the time, in ticks, that the calling task should be held in the Blocked state to wait for the delete command to be successfully sent to the timer command queue, should the queue already be full when the destructor is called. deleteBlockTime is ignored if the destructor is called before the RTOS scheduler is started or if the timer has already been deleted by deleteTimer() before the destructor is called. This value can be updated by calling setDeleteBlockTime(). |
Example Usage