My Project
 All Classes Functions Variables Pages
Public Member Functions | List of all members
FreeRTOSTimer Class Reference

Wrapper around the FreeRTOS timer functions. More...

#include <FreeRTOSTimer.h>

Public Member Functions

 FreeRTOSTimer (char *name, TickType_t period, UBaseType_t reload, void *data, void(*callback)(FreeRTOSTimer *pTimer))
 Construct a timer. More...
 
virtual ~FreeRTOSTimer ()
 Destroy a class instance. More...
 
void changePeriod (TickType_t newPeriod, TickType_t blockTime=portMAX_DELAY)
 Change the period of the timer. More...
 
void * getData ()
 Get the user supplied data associated with the timer. More...
 
const char * getName ()
 Get the name of the timer. More...
 
TickType_t getPeriod ()
 Return the period of the timer. More...
 
void reset (TickType_t blockTime=portMAX_DELAY)
 Reset the timer to the period and start it ticking.
 
void start (TickType_t blockTime=portMAX_DELAY)
 Start the timer ticking.
 
void stop (TickType_t blockTime=portMAX_DELAY)
 Stop the timer from ticking.
 

Detailed Description

Wrapper around the FreeRTOS timer functions.

Constructor & Destructor Documentation

FreeRTOSTimer::FreeRTOSTimer ( char *  name,
TickType_t  period,
UBaseType_t  reload,
void *  data,
void(*)(FreeRTOSTimer *pTimer)  callback 
)

Construct a timer.

We construct a timer that will fire after the given period has elapsed. The period is measured in ticks. When the timer fires, the callback function is invoked within the scope/context of the timer demon thread. As such it must not block. Once the timer has fired, if the reload flag is true, then the timer will be automatically restarted.

Note that the timer does not start immediately. It starts ticking after the start() method has been called.

The signature of the callback function is:

void callback(FreeRTOSTimer *pTimer) {
// Callback code here ...
}
Parameters
[in]nameThe name of the timer.
[in]periodThe period of the timer in ticks.
[in]reloadTrue if the timer is to restart once fired.
[in]dataData to be passed to the callback.
[in]callbackCallback function to be fired when the timer expires.
FreeRTOSTimer::~FreeRTOSTimer ( )
virtual

Destroy a class instance.

The timer is deleted.

Member Function Documentation

void FreeRTOSTimer::changePeriod ( TickType_t  newPeriod,
TickType_t  blockTime = portMAX_DELAY 
)

Change the period of the timer.

Parameters
[in]newPeriodThe new period of the timer in ticks.
void * FreeRTOSTimer::getData ( )

Get the user supplied data associated with the timer.

Returns
The user supplied data associated with the timer.
const char * FreeRTOSTimer::getName ( )

Get the name of the timer.

Returns
The name of the timer.
TickType_t FreeRTOSTimer::getPeriod ( )

Return the period of the timer.

Returns
The period of the timer.

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