2 #include <lib/assert.h> 9 void app_timer_work_cb(
struct mwork_t *work)
14 w->work.at += w->interval;
18 if (m_evt_schedule_func)
19 m_evt_schedule_func(w->p_timeout_handler, w->p_context);
21 w->p_timeout_handler(w->p_context);
26 m_evt_schedule_func = evt_schedule_func;
34 assert(timeout_handler);
37 struct app_timer_t *
timer = *p_timer_id;
39 timer->p_timeout_handler = timeout_handler;
48 timer_id->interval = timeout_ticks;
49 timer_id->work.at =
mwork_now() + timeout_ticks;
50 timer_id->p_context = p_context;
uint32_t app_timer_stop(app_timer_id_t timer_id)
Function for stopping the specified timer.
uint32_t app_timer_init(app_timer_evt_schedule_func_t evt_schedule_func)
Function for initializing the timer module.
uint32_t app_timer_create(app_timer_id_t const *p_timer_id, app_timer_mode_t mode, app_timer_timeout_handler_t timeout_handler)
Function for creating a timer instance.
app_timer_mode_t
Timer modes.
#define container_of(ptr, type, mem)
struct app_timer_t * app_timer_id_t
Timer ID type. Never declare a variable of this type, but use the macro APP_TIMER_DEF instead...
static mwork_time_t mwork_now()
void(* app_timer_timeout_handler_t)(void *p_context)
Application time-out handler type.
uint32_t(* app_timer_evt_schedule_func_t)(app_timer_timeout_handler_t timeout_handler, void *p_context)
Type of function for passing events from the timer module to the scheduler.
uint32_t app_timer_start(app_timer_id_t timer_id, uint32_t timeout_ticks, void *p_context)
Function for starting a timer.
void mwork_schedule(struct mwork_t *work)
void swint_enable(swint_state_t state)
swint_state_t swint_disable(void)
void mwork_cancel(struct mwork_t *work)