fix(arduino): update example LVGL_Arduino.ino for v9 (#5499)

This commit is contained in:
danie1kr
2024-01-27 15:11:11 +01:00
committed by GitHub
parent 6cf637f2d9
commit 42214e0780

View File

@@ -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 */
}