chore: update some code and docs to use v9 API (#5876)
Co-authored-by: Neo Xu <neo.xu1990@gmail.com>
This commit is contained in:
@@ -31,7 +31,7 @@ Here is some pseudocode to illustrate the concept:
|
||||
while(1) {
|
||||
uint32_t time_till_next;
|
||||
mutex_lock(&lvgl_mutex);
|
||||
time_till_next = lv_task_handler();
|
||||
time_till_next = lv_timer_handler();
|
||||
mutex_unlock(&lvgl_mutex);
|
||||
thread_sleep(time_till_next); /* sleep for a while */
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ main ``while(1)`` should look like this:
|
||||
while(1) {
|
||||
/*Normal operation (no sleep) in < 1 sec inactivity*/
|
||||
if(lv_display_get_inactive_time(NULL) < 1000) {
|
||||
lv_task_handler();
|
||||
lv_timer_handler();
|
||||
}
|
||||
/*Sleep after 1 sec inactivity*/
|
||||
else {
|
||||
@@ -27,7 +27,7 @@ function to signal a wake-up (press, touch or click etc.) has happened:
|
||||
|
||||
lv_tick_inc(LV_DEF_REFR_PERIOD); /*Force task execution on wake-up*/
|
||||
timer_start(); /*Restart the timer where lv_tick_inc() is called*/
|
||||
lv_task_handler(); /*Call `lv_task_handler()` manually to process the wake-up event*/
|
||||
lv_timer_handler(); /*Call `lv_timer_handler()` manually to process the wake-up event*/
|
||||
|
||||
In addition to :cpp:func:`lv_display_get_inactive_time` you can check
|
||||
:cpp:func:`lv_anim_count_running` to see if all animations have finished.
|
||||
|
||||
Reference in New Issue
Block a user