In view of their low level of English, here, I will translate the previous article on contiki timer into Chinese, so that I can learn more conveniently. There are a lot of things in this article that are not very smooth.
Timers
The Contiki system provides a clock library for applications and the system itself. The clock Library provides functions such as checking time exceeds, awakening the system from low-power mode to scheduled time, and real-time task scheduling. The clock is also used for applications to allow the system to work with others, or for a period of time before the recovery is executed into the low power consumption mode.
The Contiki Timer Modules
Contiki
Timer
Etimer
Ctimerthey are especially useful in any code that do not have an explicit Contiki process such as protocol implementations
Rtimer
The Clock Module
Contikiclock_time () CLOCK_SECONDclock_time_tclock_seconds ()
Clock_delay () clock_wait ()
Clock_init ()
The Timer Library
Contiki
Contiki
Timer_expired ()
Timer
Timer
Static struct timer rxtimer;
Void init (void ){
Timer_set (& rxtimer, CLOCK_SECOND/2 );
}
Interrupt (UART1RX_VECTOR)
Uartpairx_interrupt (void)
{
If (timer_expired (& rxtimer )){
/* Timeout */
/*...*/
}
Timer_restart (& rxtimer );
/*...*/
}
The Stimer Library
Contiki stki
Contiki stki
Stimer
Stimer
The Etimer Library
Contiki etimer
Contiki etimeretimer_reset ()