![]() |
m2mb API docs
25.30.003
m2mb API sets documentation
|
OS timer prototypes. More...
Go to the source code of this file.
Macros | |
| #define | M2MB_OS_TMR_INVALID 0 |
| #define | M2MB_OS_TMR_INVALID_ATTR 0 |
| #define | M2MB_OS_TMR_PERIODIC_TMR 1 |
| #define | M2MB_OS_TMR_ONESHOT_TMR 0 |
| #define | m2mb_os_tmr_setAttrItem_(h, args...) m2mb_os_tmr_setAttrItem( h, CMDS_ARGS( args ) ) |
Functions | |
| M2MB_OS_RESULT_E | m2mb_os_tmr_init (M2MB_OS_TMR_HANDLE *pTmrHandle, M2MB_OS_TMR_ATTR_HANDLE *pTmrAttr) |
| Application timer Creation. More... | |
| M2MB_OS_RESULT_E | m2mb_os_tmr_deinit (M2MB_OS_TMR_HANDLE tmrHandle) |
| Timer deinit => deletion. More... | |
| M2MB_OS_RESULT_E | m2mb_os_tmr_start (M2MB_OS_TMR_HANDLE tmrHandle) |
| Start application timer. More... | |
| M2MB_OS_RESULT_E | m2mb_os_tmr_stop (M2MB_OS_TMR_HANDLE tmrHandle) |
| Stop an application timer. More... | |
| M2MB_OS_RESULT_E | m2mb_os_tmr_setAttrItem (M2MB_OS_TMR_ATTR_HANDLE *pTmrAttrHandle, UINT8 nCmds,...) |
| Set specific attribute for timer creation. More... | |
| M2MB_OS_RESULT_E | m2mb_os_tmr_getItem (M2MB_OS_TMR_HANDLE tmrHandle, M2MB_OS_TMR_SEL_CMD_E selCmd, MEM_W *pOut, void *pIn) |
| Get specific properties of the timer. More... | |
| M2MB_OS_RESULT_E | m2mb_os_tmr_setItem (M2MB_OS_TMR_HANDLE tmrHandle, M2MB_OS_TMR_SEL_CMD_E selCmd, void *pIn) |
| Set specific properties of the timer. More... | |
OS timer prototypes.
m2m/m2m_generic/common/m2mb_inc/m2mb_os_tmr.h
basic functios for OS timer are provided
@notes Dependencies: m2mb_types.h m2mb_os_types.h
| M2MB_OS_RESULT_E m2mb_os_tmr_deinit | ( | M2MB_OS_TMR_HANDLE | tmrHandle | ) |
Timer deinit => deletion.
This service deletes the specified os timer. The resources will be released. It is the application's responsibility to prevent use of a deleted timer.
| [in] | tmrHandle | handle of the timer |
Example
| M2MB_OS_RESULT_E m2mb_os_tmr_getItem | ( | M2MB_OS_TMR_HANDLE | tmrHandle, |
| M2MB_OS_TMR_SEL_CMD_E | selCmd, | ||
| MEM_W * | pOut, | ||
| void * | pIn | ||
| ) |
Get specific properties of the timer.
This service retrieve value for specified parameter of the specified timer Selecting cmd, a parameter to be retrieved can be set To be used when timer is already created: Right usage is under application responsibility
| [in] | tmrHandle | handle of timer |
| [in] | selCmd | Select parameter to be set (see M2MB_OS_TMR_SEL_CMD_E) param [out] pOut pointer Output parameter got: its meaning depend on selCmd used See examples as general pointer it is set to MEM_W |
| [in] | pIn | pointer to void, general Parameter to be specified, if any, to get right output See examples If parameter is not needed, use NULL |
Example
| M2MB_OS_RESULT_E m2mb_os_tmr_init | ( | M2MB_OS_TMR_HANDLE * | pTmrHandle, |
| M2MB_OS_TMR_ATTR_HANDLE * | pTmrAttr | ||
| ) |
Application timer Creation.
This service creates an application timer with the specified Timer attributes
| [out] | pTmrHandle | pointer to timer handle |
| [in] | pTmrAttrHandle | pointer to timer attribute handle |
Example Complete use of Timer with its callback; callback stop the timer and restarts it with different period. Arg for callback is a context as pointer to timer handle, so in the callback the related timer can be managed
| M2MB_OS_RESULT_E m2mb_os_tmr_setAttrItem | ( | M2MB_OS_TMR_ATTR_HANDLE * | pTmrAttrHandle, |
| UINT8 | nCmds, | ||
| ... | |||
| ) |
Set specific attribute for timer creation.
This service set the attribute (or create it) to be used for timer creation
| [in] | pTmrAttrHandle | pointer to timer attribute handle |
| [in] | nCmds | number of commands to be issued at once |
| [in] | ... | variable inputs, N cmds (see M2MB_OS_TMR_SEL_CMD_E) followed by N arguments for their respective issued commands. CMDS(...) and CMDS_ARGS(...) macro can be used to better insert cmd and parameters and to better control right insertion |
Example See m2mb_os_tmr_init for complete example of usage
| M2MB_OS_RESULT_E m2mb_os_tmr_setItem | ( | M2MB_OS_TMR_HANDLE | tmrHandle, |
| M2MB_OS_TMR_SEL_CMD_E | selCmd, | ||
| void * | pIn | ||
| ) |
Set specific properties of the timer.
This service set value for specified parameter of the specified timer if available Selecting cmd, a parameter to be set can be selected To be used when timer is already created: its right usage is under application responsibility
| [in] | tmrHandle | handle of timer |
| [in] | selCmd | Select parameter to be set (see M2MB_OS_TMR_SEL_CMD_E) |
| [in] | pIn | pointer to value to be set. If a simple value, can be easily casted to (void*) e.g. int value -3 has to be passed, use (void*)-3 NULL if no value is needed |
It is the application's responsibility to set the values in right context, for example the change of callback or periodicity should better be done inside expiration callback, or by stopping involved timer first
Example Usage of the function inside expiration callback
| M2MB_OS_RESULT_E m2mb_os_tmr_start | ( | M2MB_OS_TMR_HANDLE | tmrHandle | ) |
Start application timer.
This service starts the specified application timer. The expiration routines of timers that expire at the same time are executed in the order they were activated.
| [in] | tmrHandle | handle of timer |
Allowed From Initialization, tasks, timers and ISRs Preemption Possible No
Example For a complete example of use, see m2mb_os_tmr_init section
| M2MB_OS_RESULT_E m2mb_os_tmr_stop | ( | M2MB_OS_TMR_HANDLE | tmrHandle | ) |
Stop an application timer.
This service stops the specified application timer. If the timer is already stopped, this service has no effect
| [in] | tmrHandle | handle of timer |
Example For a complete example of use, see m2mb_os_tmr_init section