diff --git a/examples/arduino/LVGL_Arduino.ino b/examples/arduino/LVGL_Arduino.ino index 911ce7633..d1f544c6b 100644 --- a/examples/arduino/LVGL_Arduino.ino +++ b/examples/arduino/LVGL_Arduino.ino @@ -6,13 +6,14 @@ #include */ TFT_eSPI tft = TFT_eSPI(); /* TFT instance */ -static lv_disp_buf_t disp_buf; -static lv_color_t buf[LV_HOR_RES_MAX * 10]; /* Change to your screen resolution */ static uint32_t screenWidth = 320; static uint32_t screenHeight = 240; +static lv_disp_buf_t disp_buf; +static lv_color_t buf[screenWidth * 10]; + #if LV_USE_LOG != 0 /* Serial debugging */ void my_print(lv_log_level_t level, const char *file, uint32_t line, const char *fn_name, const char *dsc) @@ -81,14 +82,14 @@ void setup() uint16_t calData[5] = {275, 3620, 264, 3532, 1}; tft.setTouch(calData); - lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10); + lv_disp_buf_init(&disp_buf, buf, NULL, screenWidth * 10); /* Initialize the display */ lv_disp_drv_t disp_drv; lv_disp_drv_init(&disp_drv); /* Change the following line to your display resolution */ - disp_drv.hor_res = 320; - disp_drv.ver_res = 240; + disp_drv.hor_res = screenWidth; + disp_drv.ver_res = screenHeight; disp_drv.flush_cb = my_disp_flush; disp_drv.buffer = &disp_buf; lv_disp_drv_register(&disp_drv);