Lines Matching refs:timer
28 static bool lv_timer_exec(lv_timer_t * timer);
29 static uint32_t lv_timer_time_remaining(lv_timer_t * timer);
192 void lv_timer_set_cb(lv_timer_t * timer, lv_timer_cb_t timer_cb) in lv_timer_set_cb() argument
194 timer->timer_cb = timer_cb; in lv_timer_set_cb()
201 void lv_timer_del(lv_timer_t * timer) in lv_timer_del() argument
203 _lv_ll_remove(&LV_GC_ROOT(_lv_timer_ll), timer); in lv_timer_del()
206 lv_mem_free(timer); in lv_timer_del()
213 void lv_timer_pause(lv_timer_t * timer) in lv_timer_pause() argument
215 timer->paused = true; in lv_timer_pause()
218 void lv_timer_resume(lv_timer_t * timer) in lv_timer_resume() argument
220 timer->paused = false; in lv_timer_resume()
228 void lv_timer_set_period(lv_timer_t * timer, uint32_t period) in lv_timer_set_period() argument
230 timer->period = period; in lv_timer_set_period()
237 void lv_timer_ready(lv_timer_t * timer) in lv_timer_ready() argument
239 timer->last_run = lv_tick_get() - timer->period - 1; in lv_timer_ready()
247 void lv_timer_set_repeat_count(lv_timer_t * timer, int32_t repeat_count) in lv_timer_set_repeat_count() argument
249 timer->repeat_count = repeat_count; in lv_timer_set_repeat_count()
257 void lv_timer_reset(lv_timer_t * timer) in lv_timer_reset() argument
259 timer->last_run = lv_tick_get(); in lv_timer_reset()
285 lv_timer_t * lv_timer_get_next(lv_timer_t * timer) in lv_timer_get_next() argument
287 if(timer == NULL) return _lv_ll_get_head(&LV_GC_ROOT(_lv_timer_ll)); in lv_timer_get_next()
288 else return _lv_ll_get_next(&LV_GC_ROOT(_lv_timer_ll), timer); in lv_timer_get_next()
300 static bool lv_timer_exec(lv_timer_t * timer) in lv_timer_exec() argument
302 if(timer->paused) return false; in lv_timer_exec()
305 if(lv_timer_time_remaining(timer) == 0) { in lv_timer_exec()
309 int32_t original_repeat_count = timer->repeat_count; in lv_timer_exec()
310 if(timer->repeat_count > 0) timer->repeat_count--; in lv_timer_exec()
311 timer->last_run = lv_tick_get(); in lv_timer_exec()
312 TIMER_TRACE("calling timer callback: %p", *((void **)&timer->timer_cb)); in lv_timer_exec()
313 if(timer->timer_cb && original_repeat_count != 0) timer->timer_cb(timer); in lv_timer_exec()
314 TIMER_TRACE("timer callback %p finished", *((void **)&timer->timer_cb)); in lv_timer_exec()
320 if(timer->repeat_count == 0) { /*The repeat count is over, delete the timer*/ in lv_timer_exec()
321 …("deleting timer with %p callback because the repeat count is over", *((void **)&timer->timer_cb)); in lv_timer_exec()
322 lv_timer_del(timer); in lv_timer_exec()
334 static uint32_t lv_timer_time_remaining(lv_timer_t * timer) in lv_timer_time_remaining() argument
337 uint32_t elp = lv_tick_elaps(timer->last_run); in lv_timer_time_remaining()
338 if(elp >= timer->period) in lv_timer_time_remaining()
340 return timer->period - elp; in lv_timer_time_remaining()