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_f

  • arg: [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 by timer_register()

  • ms: [in] Timeout value in miliseconds

  • cyclic: [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

int timer_stop(int id)

Stop a timer

Return

0 on success, On error a negative value is returned

Parameters

int timer_reset(int id)

Restart a timer

Return

0 on success, On error a negative value is returned

Parameters

int timer_free(int id)

Free a registered timer

Return

0 on success, On error a negative value is returned

Parameters

Type Definitions

typedef void (*timercb_f)(int id, void *arg)

Timer function callback

Parameters
  • id: Timer ID

  • arg: User data argument supplied during registration