The RtosTimer class allow creating and and controlling of timer functions in the system. More...
#include <RtosTimer.h>
Public Member Functions | |
RtosTimer (void(*func)(void const *argument), os_timer_type type=osTimerPeriodic, void *argument=nullptr) | |
Create timer. More... | |
RtosTimer (mbed::Callback< void()> func, os_timer_type type=osTimerPeriodic) | |
Create timer. More... | |
template<typename T , typename M > | |
RtosTimer (T *obj, M method, os_timer_type type=osTimerPeriodic) | |
Create timer. More... | |
osStatus | stop (void) |
Stop the timer. More... | |
osStatus | start (uint32_t millisec) |
Start or restart the timer. More... | |
~RtosTimer () | |
RtosTimer destructor. More... | |
The RtosTimer class allow creating and and controlling of timer functions in the system.
A timer function is called when a time period expires whereby both on-shot and periodic timers are possible. A timer can be started, restarted, or stopped.
Timers are handled in the thread osTimerThread. Callback functions run under control of this thread and may use CMSIS-RTOS API calls.
For an example, the following code shows a simple use of the RtosTimer:
This is the above example rewritten to use the EventQueue:
Definition at line 90 of file RtosTimer.h.
RtosTimer | ( | void(*)(void const *argument) | func, |
os_timer_type | type = osTimerPeriodic , |
||
void * | argument = nullptr |
||
) |
Create timer.
func | function to be executed by this timer. |
type | osTimerOnce for one-shot or osTimerPeriodic for periodic behavior. (default: osTimerPeriodic) |
argument | argument to the timer call back function. (default: nullptr) |
Replaced with RtosTimer(Callback<void()>, os_timer_type)
The RtosTimer has been superseded by the EventQueue. See RtosTimer.h for more details
Definition at line 106 of file RtosTimer.h.
RtosTimer | ( | mbed::Callback< void()> | func, |
os_timer_type | type = osTimerPeriodic |
||
) |
Create timer.
func | function to be executed by this timer. |
type | osTimerOnce for one-shot or osTimerPeriodic for periodic behavior. (default: osTimerPeriodic) |
Definition at line 121 of file RtosTimer.h.
RtosTimer | ( | T * | obj, |
M | method, | ||
os_timer_type | type = osTimerPeriodic |
||
) |
Create timer.
obj | pointer to the object to call the member function on. |
method | member function to be executed by this timer. |
type | osTimerOnce for one-shot or osTimerPeriodic for periodic behavior. (default: osTimerPeriodic) |
The RtosTimer constructor does not support cv-qualifiers. Replaced by RtosTimer(callback(obj, method), os_timer_type).
The RtosTimer has been superseded by the EventQueue. See RtosTimer.h for more details
Definition at line 144 of file RtosTimer.h.
osStatus start | ( | uint32_t | millisec | ) |
Start or restart the timer.
millisec | non-zero value of the timer. |
osStatus stop | ( | void | ) |
Stop the timer.