From 42214e0780e754e100387f8ad98b4e96d62b5085 Mon Sep 17 00:00:00 2001 From: danie1kr <37019555+danie1kr@users.noreply.github.com> Date: Sat, 27 Jan 2024 15:11:11 +0100 Subject: [PATCH] fix(arduino): update example LVGL_Arduino.ino for v9 (#5499) --- examples/arduino/LVGL_Arduino/LVGL_Arduino.ino | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/arduino/LVGL_Arduino/LVGL_Arduino.ino b/examples/arduino/LVGL_Arduino/LVGL_Arduino.ino index 4358ebd62..54ad04502 100644 --- a/examples/arduino/LVGL_Arduino/LVGL_Arduino.ino +++ b/examples/arduino/LVGL_Arduino/LVGL_Arduino.ino @@ -21,6 +21,7 @@ /*LVGL draw into this buffer, 1/10 screen size usually works well. The size is in bytes*/ #define DRAW_BUF_SIZE (TFT_HOR_RES * TFT_VER_RES / 10 * (LV_COLOR_DEPTH / 8)) +uint32_t draw_buf[DRAW_BUF_SIZE / 4]; #if LV_USE_LOG != 0 void my_print( lv_log_level_t level, const char * buf ) @@ -81,16 +82,15 @@ void setup() lv_log_register_print_cb( my_print ); #endif - uint8_t draw_buf[DRAW_BUF_SIZE]; lv_display_t * disp; #if LV_USE_TFT_ESPI /*TFT_eSPI can be enabled lv_conf.h to initialize the display in a simple way*/ - disp = lv_tft_espi_create(TFT_HOR_RES, TFT_VER_RES, draw_buf, DRAW_BUF_SIZE); + disp = lv_tft_espi_create(TFT_HOR_RES, TFT_VER_RES, draw_buf, sizeof(draw_buf)); #else /*Else create a display yourself*/ disp = lv_display_create(TFT_HOR_RES, TFT_VER_RES); lv_display_set_flush_cb(disp, my_disp_flush); - lv_display_set_buffers(disp, draw_buf, NULL, DRAW_BUF_SIZE, LV_DISPLAY_RENDER_MODE_PARTIAL); + lv_display_set_buffers(disp, draw_buf, NULL, sizeof(draw_buf), LV_DISPLAY_RENDER_MODE_PARTIAL); #endif /*Initialize the (dummy) input device driver*/ @@ -126,6 +126,7 @@ void setup() void loop() { - lv_timer_handler(); /* let the UI do its work */ - delay( 5 ); + lv_task_handler(); /* let the GUI do its work */ + lv_tick_inc(5); /* tell LVGL how much time has passed */ + delay(5); /* let this time pass */ }