mirror of
https://github.com/lvgl/lvgl.git
synced 2024-11-24 18:23:48 +08:00
chore(timer): add assertions for null pointer (#4823)
This commit is contained in:
parent
2cba406014
commit
cd6b4db6e8
@ -183,6 +183,7 @@ lv_timer_t * lv_timer_create(lv_timer_cb_t timer_xcb, uint32_t period, void * us
|
||||
|
||||
void lv_timer_set_cb(lv_timer_t * timer, lv_timer_cb_t timer_cb)
|
||||
{
|
||||
LV_ASSERT_NULL(timer);
|
||||
timer->timer_cb = timer_cb;
|
||||
}
|
||||
|
||||
@ -196,42 +197,50 @@ void lv_timer_delete(lv_timer_t * timer)
|
||||
|
||||
void lv_timer_pause(lv_timer_t * timer)
|
||||
{
|
||||
LV_ASSERT_NULL(timer);
|
||||
timer->paused = true;
|
||||
}
|
||||
|
||||
void lv_timer_resume(lv_timer_t * timer)
|
||||
{
|
||||
LV_ASSERT_NULL(timer);
|
||||
timer->paused = false;
|
||||
lv_timer_handler_resume();
|
||||
}
|
||||
|
||||
void lv_timer_set_period(lv_timer_t * timer, uint32_t period)
|
||||
{
|
||||
LV_ASSERT_NULL(timer);
|
||||
timer->period = period;
|
||||
}
|
||||
|
||||
void lv_timer_ready(lv_timer_t * timer)
|
||||
{
|
||||
LV_ASSERT_NULL(timer);
|
||||
timer->last_run = lv_tick_get() - timer->period - 1;
|
||||
}
|
||||
|
||||
void lv_timer_set_repeat_count(lv_timer_t * timer, int32_t repeat_count)
|
||||
{
|
||||
LV_ASSERT_NULL(timer);
|
||||
timer->repeat_count = repeat_count;
|
||||
}
|
||||
|
||||
void lv_timer_set_auto_delete(lv_timer_t * timer, bool auto_delete)
|
||||
{
|
||||
LV_ASSERT_NULL(timer);
|
||||
timer->auto_delete = auto_delete;
|
||||
}
|
||||
|
||||
void lv_timer_set_user_data(lv_timer_t * timer, void * user_data)
|
||||
{
|
||||
LV_ASSERT_NULL(timer);
|
||||
timer->user_data = user_data;
|
||||
}
|
||||
|
||||
void lv_timer_reset(lv_timer_t * timer)
|
||||
{
|
||||
LV_ASSERT_NULL(timer);
|
||||
timer->last_run = lv_tick_get();
|
||||
lv_timer_handler_resume();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user