fix(arduino): update example LVGL_Arduino.ino for v9 (#5499)
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
/*LVGL draw into this buffer, 1/10 screen size usually works well. The size is in bytes*/
|
/*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))
|
#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
|
#if LV_USE_LOG != 0
|
||||||
void my_print( lv_log_level_t level, const char * buf )
|
void my_print( lv_log_level_t level, const char * buf )
|
||||||
@@ -81,16 +82,15 @@ void setup()
|
|||||||
lv_log_register_print_cb( my_print );
|
lv_log_register_print_cb( my_print );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t draw_buf[DRAW_BUF_SIZE];
|
|
||||||
lv_display_t * disp;
|
lv_display_t * disp;
|
||||||
#if LV_USE_TFT_ESPI
|
#if LV_USE_TFT_ESPI
|
||||||
/*TFT_eSPI can be enabled lv_conf.h to initialize the display in a simple way*/
|
/*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
|
||||||
/*Else create a display yourself*/
|
/*Else create a display yourself*/
|
||||||
disp = lv_display_create(TFT_HOR_RES, TFT_VER_RES);
|
disp = lv_display_create(TFT_HOR_RES, TFT_VER_RES);
|
||||||
lv_display_set_flush_cb(disp, my_disp_flush);
|
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
|
#endif
|
||||||
|
|
||||||
/*Initialize the (dummy) input device driver*/
|
/*Initialize the (dummy) input device driver*/
|
||||||
@@ -126,6 +126,7 @@ void setup()
|
|||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
lv_timer_handler(); /* let the UI do its work */
|
lv_task_handler(); /* let the GUI do its work */
|
||||||
delay( 5 );
|
lv_tick_inc(5); /* tell LVGL how much time has passed */
|
||||||
|
delay(5); /* let this time pass */
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user