23 lines
344 B
C
23 lines
344 B
C
|
#include <sys/timer.h>
|
||
|
#include <sys/atomic.h>
|
||
|
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
void timer_start(SYSTIMER* timer,uint32_t timeout){
|
||
|
ATOMIC
|
||
|
|
||
|
if (timer){
|
||
|
if (timeout == 0L) {
|
||
|
timeout = timer->elapse;
|
||
|
};
|
||
|
|
||
|
timer->timeout = _systick_ticks + timeout;
|
||
|
|
||
|
if (list_is_empty(&timer->list)){
|
||
|
list_append(&timer->list, &sys_timers);
|
||
|
}
|
||
|
};
|
||
|
};
|
||
|
|
||
|
|