COTmrCreate
Description
This function creates the defined action and links this action into the event timer list at the correct timing.
Prototype
CPU_INT16S COTmrCreate(CO_TMR *tmr,
CPU_INT32U startTime,
CPU_INT32U cycleTime,
CO_TMR_FUNC func,
void *para);
Parameter | Description |
---|---|
tmr | Pointer to timer structure |
startTime | delta time in ticks for the first timer event |
cycleTime | if != 0, the delta time in ticks for the cyclic timer events |
func | pointer to the action callback function |
para | pointer to the callback function parameter |
Returned Value
>=0 the action identifier
<0 an error is detected
Example
The following example installs a cyclic called function AppCyclicFunc()
to the CANopen node AppNode. The timed function will be called the first time after 10ms and then every 25ms with the parameter 0xcafe.
Note: The example assumes, that the application callback function AppCyclicFunc()
is implemented with the correct prototype. The configuration setting CO_TMR_TICKS_PER.SEC
is assumed to be 1000, e.g. 1 tick is equal to 1ms. See CANopen Config Manual for details.