Files | |
file | cb_xtimer.h |
xTimer utility functions | |
Functions | |
cb_xtimer_man_t * | cb_xtimer_man_create (void) |
Create a timer manager. More... | |
void | cb_xtimer_man_delete (cb_xtimer_man_t *xtimer_man) |
Delete a timer manager. More... | |
int | cb_xtimer_man_schedule (cb_xtimer_man_t *xtimer_man) |
The timer manager consumes expired timers and schedule for next timer to be expired. More... | |
int | cb_xtimer_man_nearest_timeout (cb_xtimer_man_t *xtimer_man) |
Get a timeout of nearest timer. More... | |
cb_xtimer_t * | cb_xtimer_create (cb_xtimer_man_t *xtimer_man, xtimer_expirecb_t expirecb, void *exparg) |
Create a timer. More... | |
void | cb_xtimer_delete (cb_xtimer_t *xtimer) |
Delete a timer. More... | |
void | cb_xtimer_set_periodic (cb_xtimer_t *xtimer) |
Set a periodic timer flag. More... | |
void | cb_xtimer_clear_periodic (cb_xtimer_t *xtimer) |
Clear periodic timer flag. More... | |
bool | cb_xtimer_is_periodic (cb_xtimer_t *xtimer) |
Check if a timer is periodic. More... | |
int | cb_xtimer_remain_timeout (cb_xtimer_t *xtimer) |
Get remaining timeout of a running timer. More... | |
int | cb_xtimer_start (cb_xtimer_t *xtimer, uint32_t timeout_us) |
Start a timer. More... | |
void | cb_xtimer_stop (cb_xtimer_t *xtimer) |
Stop a running timer, the periodic flag is cleared as well. More... | |
bool | cb_xtimer_is_running (cb_xtimer_t *xtimer) |
Check if a timer is running. More... | |
Typedefs | |
typedef struct cb_xtimer_man | cb_xtimer_man_t |
Data handle of a timer manager, inside of it is private. More... | |
typedef struct cb_xtimer | cb_xtimer_t |
Data handle of a timer, inside of it is private. More... | |
typedef struct cb_xtimer_ndata | cb_xtimer_ndata_t |
Data handle of a timer data, inside of it is private. More... | |
typedef void(* | xtimer_expirecb_t) (cb_xtimer_t *timer, void *exparg) |
A callback is called when a timer expired. More... | |
typedef struct cb_xtimer_man cb_xtimer_man_t |
Data handle of a timer manager, inside of it is private.
typedef struct cb_xtimer cb_xtimer_t |
Data handle of a timer, inside of it is private.
typedef struct cb_xtimer_ndata cb_xtimer_ndata_t |
Data handle of a timer data, inside of it is private.
typedef void(* xtimer_expirecb_t) (cb_xtimer_t *timer, void *exparg) |
A callback is called when a timer expired.
cb_xtimer_man_t* cb_xtimer_man_create | ( | void | ) |
Create a timer manager.
The xtimer is non-thread safe function. Each thread is expected to own a timer manager and all timers are processed in this thread.
void cb_xtimer_man_delete | ( | cb_xtimer_man_t * | xtimer_man | ) |
Delete a timer manager.
xtimer_man | timer manager data |
int cb_xtimer_man_schedule | ( | cb_xtimer_man_t * | xtimer_man | ) |
The timer manager consumes expired timers and schedule for next timer to be expired.
The function is expected to run in a thread loop. It returns nearest timeout that expects for next timer to be expired. The thread loop should use this timeout as its wait time for event.
xtimer_man | timer manager data |
int cb_xtimer_man_nearest_timeout | ( | cb_xtimer_man_t * | xtimer_man | ) |
Get a timeout of nearest timer.
xtimer_man | timer manager data |
cb_xtimer_t* cb_xtimer_create | ( | cb_xtimer_man_t * | xtimer_man, |
xtimer_expirecb_t | expirecb, | ||
void * | exparg | ||
) |
Create a timer.
xtimer_man | timer manager data |
expirecb | expire callback |
exparg | expired callback argument |
void cb_xtimer_delete | ( | cb_xtimer_t * | xtimer | ) |
Delete a timer.
xtimer | a timer data |
void cb_xtimer_set_periodic | ( | cb_xtimer_t * | xtimer | ) |
Set a periodic timer flag.
If this flag is set, the timer will be restarted when it expired.
xtimer | a timer data |
void cb_xtimer_clear_periodic | ( | cb_xtimer_t * | xtimer | ) |
Clear periodic timer flag.
xtimer | a timer data |
bool cb_xtimer_is_periodic | ( | cb_xtimer_t * | xtimer | ) |
Check if a timer is periodic.
xtimer | a timer data |
int cb_xtimer_remain_timeout | ( | cb_xtimer_t * | xtimer | ) |
Get remaining timeout of a running timer.
xtimer | a timer data |
int cb_xtimer_start | ( | cb_xtimer_t * | xtimer, |
uint32_t | timeout_us | ||
) |
Start a timer.
xtimer | a timer data |
timeout_us | timeout value in microsec |
void cb_xtimer_stop | ( | cb_xtimer_t * | xtimer | ) |
Stop a running timer, the periodic flag is cleared as well.
xtimer | a timer data |
bool cb_xtimer_is_running | ( | cb_xtimer_t * | xtimer | ) |
Check if a timer is running.
xtimer | a timer data |