52 static struct etimer *timerlist;
53 static clock_time_t next_expiration;
55 PROCESS(etimer_process,
"Event timer");
64 if (timerlist == NULL) {
70 tdist = t->timer.start + t->timer.interval - now;
71 for(t = t->next; t != NULL; t = t->next) {
72 if(t->timer.start + t->timer.interval - now < tdist) {
73 tdist = t->timer.start + t->timer.interval - now;
76 next_expiration = now + tdist;
91 if(ev == PROCESS_EVENT_EXITED) {
92 struct process *p = data;
94 while(timerlist != NULL && timerlist->p == p) {
95 timerlist = timerlist->next;
98 if(timerlist != NULL) {
100 while(t->next != NULL) {
101 if(t->next->p == p) {
102 t->next = t->next->next;
108 }
else if(ev != PROCESS_EVENT_POLL) {
116 for(t = timerlist; t != NULL; t = t->next) {
157 if(timer->p != PROCESS_NONE) {
158 for(t = timerlist; t != NULL; t = t->next) {
170 timer->next = timerlist;
187 et->timer.interval = interval;
208 et->timer.start += timediff;
215 return et->p == PROCESS_NONE;
221 return et->timer.start + et->timer.interval;
227 return et->timer.start;
233 return timerlist != NULL;
248 if(et == timerlist) {
249 timerlist = timerlist->next;
254 for(t = timerlist; t != NULL && t->next != et; t = t->next);
269 et->p = PROCESS_NONE;
void timer_set(struct timer *t, clock_time_t interval)
Set a timer.
#define PROCESS(name, strname)
Declare a process.
void etimer_stop(struct etimer *et)
Stop a pending event timer.
void etimer_restart(struct etimer *et)
Restart an event timer from the current point in time.
#define PROCESS_BEGIN()
Define the beginning of a process.
void etimer_request_poll(void)
Make the event timer aware that the clock has changed.
clock_time_t etimer_start_time(struct etimer *et)
Get the start time for the event timer.
#define PROCESS_END()
Define the end of a process.
static const nrf_drv_timer_t timer
Timer instance used for rtimer.
void timer_reset(struct timer *t)
Reset the timer with the same interval.
clock_time_t etimer_next_expiration_time(void)
Get next event timer expiration time.
#define PROCESS_ERR_OK
Return value indicating that an operation was successful.
void etimer_reset_with_new_interval(struct etimer *et, clock_time_t interval)
Reset an event timer with a new interval.
#define PROCESS_CURRENT()
Get a pointer to the currently running process.
void process_poll(struct process *p)
Request a process to be polled.
int etimer_pending(void)
Check if there are any non-expired event timers.
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.
Header file for the Contiki process interface.
clock_time_t clock_time(void)
Get the current clock time.
int etimer_expired(struct etimer *et)
Check if an event timer has expired.
#define PROCESS_YIELD()
Yield the currently running process.
void etimer_adjust(struct etimer *et, int timediff)
Adjust the expiration time for an event timer.
int process_post(struct process *p, process_event_t ev, process_data_t data)
Post an asynchronous event.
PROCESS_THREAD(cc2538_rf_process, ev, data)
Implementation of the cc2538 RF driver process.
void etimer_reset(struct etimer *et)
Reset an event timer with the same interval as was previously set.
void etimer_set(struct etimer *et, clock_time_t interval)
Set an event timer.
clock_time_t etimer_expiration_time(struct etimer *et)
Get the expiration time for the event timer.