forked from kofal.net/zmk
fix(display): All display updates in work thread.
* Make sure all LVGL access is from main work thread.
This commit is contained in:
@@ -24,6 +24,17 @@ static lv_obj_t *screen;
|
||||
|
||||
__attribute__((weak)) lv_obj_t *zmk_display_status_screen() { return NULL; }
|
||||
|
||||
void display_tick_cb(struct k_work *work) {
|
||||
lv_tick_inc(10);
|
||||
lv_task_handler();
|
||||
}
|
||||
|
||||
K_WORK_DEFINE(display_tick_work, display_tick_cb);
|
||||
|
||||
void display_timer_cb() { k_work_submit(&display_tick_work); }
|
||||
|
||||
K_TIMER_DEFINE(display_timer, display_timer_cb, NULL);
|
||||
|
||||
int zmk_display_init() {
|
||||
LOG_DBG("");
|
||||
|
||||
@@ -45,12 +56,8 @@ int zmk_display_init() {
|
||||
lv_task_handler();
|
||||
display_blanking_off(display);
|
||||
|
||||
k_timer_start(&display_timer, K_MSEC(10), K_MSEC(10));
|
||||
|
||||
LOG_DBG("");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void zmk_display_task_handler() {
|
||||
lv_tick_inc(10);
|
||||
lv_task_handler();
|
||||
k_sleep(K_MSEC(10));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user