System Timer API¶
API Reference¶
Header File¶
Functions¶
-
int
timer_register(timercb_f callback, void *arg)¶ Register a task independent timer
- Return
On success, returns timer ID registered. On error a negative value is returned
- Parameters
callback: [in] timer callback function of type timercb_farg: [in] User data pointer passed to callback function
-
int
timer_config(int id, unsigned long ms, int cyclic)¶ Configure timer
- Return
0 on success, On error a negative value is returned
- Parameters
id: [in] Timer ID returned bytimer_register()ms: [in] Timeout value in milisecondscyclic: [in] TRUE if timer is cyclic, FALSE if single shot timer
-
int
timer_start(int id)¶ Start a timer
- Return
0 on success, On error a negative value is returned
- Parameters
id: [in] Timer ID returned bytimer_register()
-
int
timer_stop(int id)¶ Stop a timer
- Return
0 on success, On error a negative value is returned
- Parameters
id: [in] Timer ID returned bytimer_register()
-
int
timer_reset(int id)¶ Restart a timer
- Return
0 on success, On error a negative value is returned
- Parameters
id: [in] Timer ID returned bytimer_register()
-
int
timer_free(int id)¶ Free a registered timer
- Return
0 on success, On error a negative value is returned
- Parameters
id: [in] Timer ID returned bytimer_register()
Type Definitions¶
-
typedef void (*
timercb_f)(int id, void *arg)¶ Timer function callback
- Parameters
id: Timer IDarg: User data argument supplied during registration
