Task Timer API

API Reference

Header File

Functions

int task_timer_register(timer_callback_f cb, void *arg)

Register a task timer. Task timers can only be created/controlled from parent task.

Note

Task timer will stop running if task is waiting on a semaphore or mutex or any blocking function call. Please use system timer APIs in that case.

Return

On success, returns timer ID registered. On error a negative value is returned

Parameters
  • cb: [in] timer callback function of type timer_callback_f

  • arg: [in] User data pointer passed to callback function

int task_timer_start(int tid, unsigned int ms, int cyclic)

Start Task timer

Return

0 on Success, On error negative value is returned

Parameters
  • tid: [in] Timer ID returned by task_timer_register

  • ms: [in] Timeout in ms

  • cyclic: [in] TRUE if cyclic or periodic timer, FALSE for one-shot timer

int task_timer_stop(int tid)

Stop task timer

Return

0 on Success, On error negative value is returned

Parameters
  • tid: [in] Timer ID returned by task_timer_register

Type Definitions

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

Timer callback function type

Parameters
  • id: Timer ID

  • arg: User data argument supplied during registration