Contiki 2.6
|
The Contiki kernel does not provide support for timed events. More...
Data Structures | |
struct | timer |
A timer. More... | |
Files | |
file | timer.c |
Timer library implementation. | |
file | timer.h |
Timer library header file. | |
Functions | |
void | timer_set (struct timer *t, clock_time_t interval) |
Set a timer. | |
void | timer_reset (struct timer *t) |
Reset the timer with the same interval. | |
void | timer_restart (struct timer *t) |
Restart the timer from the current point in time. | |
int | timer_expired (struct timer *t) |
Check if a timer has expired. | |
clock_time_t | timer_remaining (struct timer *t) |
The time until the timer expires. |
The Contiki kernel does not provide support for timed events.
Rather, an application that wants to use timers needs to explicitly use the timer library.
The timer library provides functions for setting, resetting and restarting timers, and for checking if a timer has expired. An application must "manually" check if its timers have expired; this is not done automatically.
A timer is declared as a struct
timer
and all access to the timer is made by a pointer to the declared timer.
int timer_expired | ( | struct timer * | t | ) |
Check if a timer has expired.
This function tests if a timer has expired and returns true or false depending on its status.
t | A pointer to the timer |
Definition at line 122 of file timer.c.
References clock_time().
Referenced by main(), and uip_ds6_periodic().
clock_time_t timer_remaining | ( | struct timer * | t | ) |
The time until the timer expires.
This function returns the time until the timer expires.
t | A pointer to the timer |
Definition at line 142 of file timer.c.
References clock_time().
void timer_reset | ( | struct timer * | t | ) |
Reset the timer with the same interval.
This function resets the timer with the same interval that was given to the timer_set() function. The start point of the interval is the exact time that the timer last expired. Therefore, this function will cause the timer to be stable over time, unlike the timer_restart() function.
t | A pointer to the timer. |
Definition at line 85 of file timer.c.
Referenced by etimer_reset(), and main().
void timer_restart | ( | struct timer * | t | ) |
Restart the timer from the current point in time.
This function restarts a timer with the same interval that was given to the timer_set() function. The timer will start at the current time.
t | A pointer to the timer. |
Definition at line 105 of file timer.c.
References clock_time().
Referenced by etimer_restart().
void timer_set | ( | struct timer * | t, |
clock_time_t | interval | ||
) |
Set a timer.
This function is used to set a timer for a time sometime in the future. The function timer_expired() will evaluate to true after the timer has expired.
t | A pointer to the timer |
interval | The interval before the timer expires. |
Definition at line 65 of file timer.c.
References clock_time().
Referenced by etimer_set(), main(), tr1001_init(), and uip_ds6_addr_add().