diff options
author | Peter Johanson <peter@peterjohanson.com> | 2021-03-25 12:29:19 -0400 |
---|---|---|
committer | Pete Johanson <peter@peterjohanson.com> | 2021-07-17 17:04:25 -0400 |
commit | 65ff995033eb882c2f09474ff8c50374f7599c6c (patch) | |
tree | a94dc486096d99b3344fe0b4b92764ff67d91f6d /app/src | |
parent | b2d64fe598d562af13ece92deb555af2e2498eaa (diff) |
fix(display): Avoid fault w/ LVGL API usage.
* Increment the tick from within the ISR itself.
* Don't call task handler until in the display callback.
PR: https://github.com/zmkfirmware/zmk/pull/736
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/display/main.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/app/src/display/main.c b/app/src/display/main.c index b8b4bf5..17d68bf 100644 --- a/app/src/display/main.c +++ b/app/src/display/main.c @@ -26,14 +26,16 @@ 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(); -} +void display_tick_cb(struct k_work *work) { lv_task_handler(); } + +#define TICK_MS 10 K_WORK_DEFINE(display_tick_work, display_tick_cb); -void display_timer_cb() { k_work_submit(&display_tick_work); } +void display_timer_cb() { + lv_tick_inc(TICK_MS); + k_work_submit(&display_tick_work); +} K_TIMER_DEFINE(display_timer, display_timer_cb, NULL); @@ -44,7 +46,7 @@ static void start_display_updates() { display_blanking_off(display); - k_timer_start(&display_timer, K_MSEC(10), K_MSEC(10)); + k_timer_start(&display_timer, K_MSEC(TICK_MS), K_MSEC(TICK_MS)); } static void stop_display_updates() { @@ -75,8 +77,6 @@ int zmk_display_init() { lv_scr_load(screen); - lv_task_handler(); - start_display_updates(); LOG_DBG(""); |