From a1f23a0c802128e98dc85a0258871db6ec20898b Mon Sep 17 00:00:00 2001 From: C47D Date: Sun, 7 Feb 2021 17:55:20 -0600 Subject: [PATCH 1/3] lvgl_helpers: Add comment about DISP_BUF_SIZE --- lvgl_helpers.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lvgl_helpers.h b/lvgl_helpers.h index 9c622f7..15eb645 100644 --- a/lvgl_helpers.h +++ b/lvgl_helpers.h @@ -21,6 +21,19 @@ extern "C" { /********************* * DEFINES *********************/ + +/* DISP_BUF_SIZE value doesn't have an special meaning, but it's the size + * of the buffer(s) passed to LVGL as display buffers. The default values used + * were the values working for the contributor of the display controller. + * + * As LVGL supports partial display updates the DISP_BUF_SIZE doesn't + * necessarily need to be equal to the display size. + * + * When using RGB displays the display buffer size will also depends on the + * color format being used, for RGB565 each pixel needs 2 bytes. + * When using the mono theme, the display pixels can be represented in one bit, + * so the buffer size can be divided by 8, e.g. see SSD1306 display size. */ + #if defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7789) #define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40) #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7735S From ed013cb14fb4ac5533b73bc691d1ae11b03332a0 Mon Sep 17 00:00:00 2001 From: C47D Date: Sun, 7 Feb 2021 17:55:45 -0600 Subject: [PATCH 2/3] lvgl_helpers: Reduce DISP_BUF_SIZE for ILI9341 --- lvgl_helpers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lvgl_helpers.h b/lvgl_helpers.h index 15eb645..6e7cf23 100644 --- a/lvgl_helpers.h +++ b/lvgl_helpers.h @@ -51,7 +51,7 @@ extern "C" { #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9488 #define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40) #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341 -#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 64) +#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40) #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SSD1306 #define DISP_BUF_SIZE (LV_HOR_RES_MAX * (LV_VER_RES_MAX / 8)) #elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X) From 82336c21202f3b99926122359e3fdabf22957a4d Mon Sep 17 00:00:00 2001 From: C47D Date: Sun, 7 Feb 2021 18:02:21 -0600 Subject: [PATCH 3/3] Allow the user to define a custom display buffer size --- lvgl_helpers.h | 5 ++++- lvgl_tft/Kconfig | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lvgl_helpers.h b/lvgl_helpers.h index 6e7cf23..7e61c30 100644 --- a/lvgl_helpers.h +++ b/lvgl_helpers.h @@ -33,7 +33,9 @@ extern "C" { * color format being used, for RGB565 each pixel needs 2 bytes. * When using the mono theme, the display pixels can be represented in one bit, * so the buffer size can be divided by 8, e.g. see SSD1306 display size. */ - +#if defined (CONFIG_CUSTOM_DISPLAY_BUFFER_SIZE) +#define DISP_BUF_SIZE CONFIG_CUSTOM_DISPLAY_BUFFER_BYTES +#else #if defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7789) #define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40) #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7735S @@ -70,6 +72,7 @@ extern "C" { #else #error "No display controller selected" #endif +#endif /********************** * TYPEDEFS diff --git a/lvgl_tft/Kconfig b/lvgl_tft/Kconfig index 2b407bb..f37adb9 100644 --- a/lvgl_tft/Kconfig +++ b/lvgl_tft/Kconfig @@ -328,6 +328,18 @@ menu "LVGL TFT Display controller" select LV_TFT_DISPLAY_PROTOCOL_SPI endchoice + config CUSTOM_DISPLAY_BUFFER_SIZE + bool "Use custom display buffer size (bytes)" + help + Enable to use a custom display buffer size. + + config CUSTOM_DISPLAY_BUFFER_BYTES + int "Custom buffer size (bytes)" + depends on CUSTOM_DISPLAY_BUFFER_SIZE + default 1024 + help + See Display buffer on LVGL docs for more information. + # Select one of the available FT81x configurations. choice prompt "Select a FT81x configuration." if LV_TFT_DISPLAY_USER_CONTROLLER_FT81X