From f66a2a63dee1be39986a27bf70f9b11f41d51b45 Mon Sep 17 00:00:00 2001 From: C47D Date: Mon, 25 Jan 2021 20:57:15 -0600 Subject: [PATCH 01/12] SSD1306: Remove portrait orientation from menuconfig --- lvgl_tft/Kconfig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lvgl_tft/Kconfig b/lvgl_tft/Kconfig index f20b9fd..e30af79 100644 --- a/lvgl_tft/Kconfig +++ b/lvgl_tft/Kconfig @@ -186,11 +186,12 @@ menu "LVGL TFT Display controller" # Used in display init function to send display orientation commands choice DISPLAY_ORIENTATION prompt "Display orientation" - default DISPLAY_ORIENTATION_PORTRAIT + default DISPLAY_ORIENTATION_PORTRAIT if !LV_TFT_DISPLAY_CONTROLLER_SSD1306 + default DISPLAY_ORIENTATION_LANDSCAPE if LV_TFT_DISPLAY_CONTROLLER_SSD1306 config DISPLAY_ORIENTATION_PORTRAIT - bool "Portrait" + bool "Portrait" if !LV_TFT_DISPLAY_CONTROLLER_SSD1306 config DISPLAY_ORIENTATION_PORTRAIT_INVERTED - bool "Portrait inverted" + bool "Portrait inverted" if !LV_TFT_DISPLAY_CONTROLLER_SSD1306 config DISPLAY_ORIENTATION_LANDSCAPE bool "Landscape" config DISPLAY_ORIENTATION_LANDSCAPE_INVERTED From d6bb341f00860fd1e0300db77275fa4d7a304bde Mon Sep 17 00:00:00 2001 From: C47D Date: Mon, 25 Jan 2021 21:04:11 -0600 Subject: [PATCH 02/12] SSD1306: Update orientation configuration --- lvgl_tft/ssd1306.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lvgl_tft/ssd1306.c b/lvgl_tft/ssd1306.c index 79e5b38..6529eee 100644 --- a/lvgl_tft/ssd1306.c +++ b/lvgl_tft/ssd1306.c @@ -101,10 +101,10 @@ void ssd1306_init(void) uint8_t orientation_1 = 0; uint8_t orientation_2 = 0; -#if defined (CONFIG_DISPLAY_ORIENTATION_PORTRAIT) +#if defined (CONFIG_DISPLAY_ORIENTATION_LANDSCAPE) orientation_1 = OLED_CMD_SET_SEGMENT_REMAP; orientation_2 = OLED_CMD_SET_COM_SCAN_MODE_REMAP; -#elif defined (CONFIG_DISPLAY_ORIENTATION_PORTRAIT_INVERTED) +#elif defined (CONFIG_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED) orientation_1 = 0xA0; orientation_2 = OLED_CMD_SET_COM_SCAN_MODE_NORMAL; #else From 6b0fd1f1acbb1520b2f6675c1eeb28501d52de43 Mon Sep 17 00:00:00 2001 From: C47D Date: Sun, 31 Jan 2021 17:28:03 -0600 Subject: [PATCH 03/12] SSD1306: Handle theme not being mono --- lvgl_helpers.h | 4 ++++ lvgl_tft/ssd1306.c | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/lvgl_helpers.h b/lvgl_helpers.h index 9c622f7..bbe8211 100644 --- a/lvgl_helpers.h +++ b/lvgl_helpers.h @@ -40,7 +40,11 @@ extern "C" { #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341 #define DISP_BUF_SIZE (LV_HOR_RES_MAX * 64) #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SSD1306 +#if defined (CONFIG_LV_THEME_MONO) #define DISP_BUF_SIZE (LV_HOR_RES_MAX * (LV_VER_RES_MAX / 8)) +#else +#define DISP_BUF_SIZE (LV_HOR_RES_MAX * LV_VER_RES_MAX) +#endif #elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X) #define DISP_BUF_LINES 40 #define DISP_BUF_SIZE (LV_HOR_RES_MAX * DISP_BUF_LINES) diff --git a/lvgl_tft/ssd1306.c b/lvgl_tft/ssd1306.c index 6529eee..276039a 100644 --- a/lvgl_tft/ssd1306.c +++ b/lvgl_tft/ssd1306.c @@ -176,8 +176,18 @@ void ssd1306_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t void ssd1306_rounder(lv_disp_drv_t * disp_drv, lv_area_t *area) { +#if defined (CONFIG_LV_THEME_MONO) area->x1 = area->x1 & ~(0x07); area->x2 = area->x2 | 0x07; +#else + uint8_t hor_max = disp_drv->hor_res; + uint8_t ver_max = disp_drv->ver_res; + + area->x1 = 0; + area->y1 = 0; + area->x2 = hor_max - 1; + area->y2 = ver_max - 1; +#endif } void ssd1306_sleep_in(void) From bfb129a554063dbd542c0546cb076988d2c55707 Mon Sep 17 00:00:00 2001 From: C47D Date: Tue, 9 Feb 2021 23:27:58 -0600 Subject: [PATCH 04/12] ssd1306: Remove partial update support --- lvgl_tft/ssd1306.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lvgl_tft/ssd1306.c b/lvgl_tft/ssd1306.c index 276039a..d80486b 100644 --- a/lvgl_tft/ssd1306.c +++ b/lvgl_tft/ssd1306.c @@ -176,10 +176,6 @@ void ssd1306_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t void ssd1306_rounder(lv_disp_drv_t * disp_drv, lv_area_t *area) { -#if defined (CONFIG_LV_THEME_MONO) - area->x1 = area->x1 & ~(0x07); - area->x2 = area->x2 | 0x07; -#else uint8_t hor_max = disp_drv->hor_res; uint8_t ver_max = disp_drv->ver_res; @@ -187,7 +183,6 @@ void ssd1306_rounder(lv_disp_drv_t * disp_drv, lv_area_t *area) area->y1 = 0; area->x2 = hor_max - 1; area->y2 = ver_max - 1; -#endif } void ssd1306_sleep_in(void) From 7cb916e496bd809f1897e9fba43a2cb60466a116 Mon Sep 17 00:00:00 2001 From: Carlos Diaz Date: Sat, 20 Feb 2021 14:15:53 -0600 Subject: [PATCH 05/12] Try to fix COMPONENT_ADD_INCLUDEDIRS --- component.mk | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/component.mk b/component.mk index 4befe8e..5a4522d 100644 --- a/component.mk +++ b/component.mk @@ -1,4 +1,9 @@ # LVGL esp32 drivers -COMPONENT_SRCDIRS := . +COMPONENT_SRCDIRS := . + COMPONENT_ADD_INCLUDEDIRS := . +COMPONENT_ADD_INCLUDEDIRS += lvgl_tft +COMPONENT_ADD_INCLUDEDIRS += lvgl_touch + +CFLAGS += -DLV_LVGL_H_INCLUDE_SIMPLE From 7e3c313ddd6c6b37307af16b0eda20d8ac532fb1 Mon Sep 17 00:00:00 2001 From: C47D Date: Sun, 21 Feb 2021 19:01:23 -0600 Subject: [PATCH 06/12] Remove AXP192 symbols being created when it shouldn't --- lvgl_tft/Kconfig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lvgl_tft/Kconfig b/lvgl_tft/Kconfig index dc5ad3d..ddd7f51 100644 --- a/lvgl_tft/Kconfig +++ b/lvgl_tft/Kconfig @@ -601,7 +601,8 @@ menu "LVGL TFT Display controller" power management in your own code. config LV_AXP192_PIN_SDA - int "GPIO for AXP192 I2C SDA" if LV_M5STICKC_HANDLE_AXP192 + int "GPIO for AXP192 I2C SDA" + depends on LV_M5STICKC_HANDLE_AXP192 range 0 39 default 21 if LV_PREDEFINED_DISPLAY_M5STICKC default 21 @@ -609,7 +610,8 @@ menu "LVGL TFT Display controller" Configure the AXP192 I2C SDA pin here. config LV_AXP192_PIN_SCL - int "GPIO for AXP192 I2C SCL" if LV_M5STICKC_HANDLE_AXP192 + int "GPIO for AXP192 I2C SCL" + depends on LV_M5STICKC_HANDLE_AXP192 range 0 39 default 22 if LV_PREDEFINED_DISPLAY_M5STICKC default 22 From 37715bc2b71e73faa5a07809bc0a5c1052d9c5c1 Mon Sep 17 00:00:00 2001 From: C47D Date: Mon, 22 Feb 2021 22:24:39 -0600 Subject: [PATCH 07/12] lvgl_tft: Check for symbols instead of adding all when using make build --- lvgl_tft/component.mk | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/lvgl_tft/component.mk b/lvgl_tft/component.mk index 9c75766..62c7c0e 100644 --- a/lvgl_tft/component.mk +++ b/lvgl_tft/component.mk @@ -1,4 +1,26 @@ # TFT drivers -COMPONENT_SRCDIRS := . +COMPONENT_SRCDIRS := . COMPONENT_ADD_INCLUDEDIRS := . + +COMPONENT_OBJS := disp_driver.o + +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341),ili9341.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481),ili9491.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9486),ili9486.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9488),ili9488.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7789),st7789.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7735S),st7735s.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7796S),st7796s.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_HX8357),hx8357.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_SH1107),sh1107.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_SSD1306),ssd1306.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X),EVE_commands.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X),FT81x.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_IL3820),il3820.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_JD79653A),jd79653a.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D),uc8151d.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_RA8875),ra8875.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_GC9A01),gc9a01.o) + +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_PROTOCOL_SPI),disp_spi.o) From 34d520c7eed99bba23371bf6ad5a159050bae984 Mon Sep 17 00:00:00 2001 From: Tomas Rezucha Date: Tue, 23 Feb 2021 16:00:21 +0100 Subject: [PATCH 08/12] Make this repository a single ESP-IDF component --- CMakeLists.txt | 79 ++++++++++++++++++++++++++++++++++++++- KConfig | 2 + component.mk | 45 ++++++++++++++++++++-- lvgl_tft/CMakeLists.txt | 55 --------------------------- lvgl_tft/component.mk | 26 ------------- lvgl_touch/CMakeLists.txt | 34 ----------------- lvgl_touch/component.mk | 4 -- 7 files changed, 122 insertions(+), 123 deletions(-) create mode 100644 KConfig delete mode 100644 lvgl_tft/CMakeLists.txt delete mode 100644 lvgl_tft/component.mk delete mode 100644 lvgl_touch/CMakeLists.txt delete mode 100644 lvgl_touch/component.mk diff --git a/CMakeLists.txt b/CMakeLists.txt index ff54b6a..6efcbc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,86 @@ if(ESP_PLATFORM) file(GLOB SOURCES *.c) +set(LVGL_INCLUDE_DIRS . lvgl_tft) +list(APPEND SOURCES "lvgl_tft/disp_driver.c") + +#@todo add SimleInclude macro here + +# Include only the source file of the selected +# display controller. +if(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341) + list(APPEND SOURCES "lvgl_tft/ili9341.c") +elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481) + list(APPEND SOURCES "lvgl_tft/ili9481.c") +elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9486) + list(APPEND SOURCES "lvgl_tft/ili9486.c") +elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9488) + list(APPEND SOURCES "lvgl_tft/ili9488.c") +elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7789) + list(APPEND SOURCES "lvgl_tft/st7789.c") +elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7735S) + list(APPEND SOURCES "lvgl_tft/st7735s.c") +elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7796S) + list(APPEND SOURCES "lvgl_tft/st7796s.c") +elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_HX8357) + list(APPEND SOURCES "lvgl_tft/hx8357.c") +elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_SH1107) + list(APPEND SOURCES "lvgl_tft/sh1107.c") +elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_SSD1306) + list(APPEND SOURCES "lvgl_tft/ssd1306.c") +elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X) + list(APPEND SOURCES "lvgl_tft/EVE_commands.c") + list(APPEND SOURCES "lvgl_tft/FT81x.c") +elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_IL3820) + list(APPEND SOURCES "lvgl_tft/il3820.c") +elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_JD79653A) + list(APPEND SOURCES "lvgl_tft/jd79653a.c") +elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D) + list(APPEND SOURCES "lvgl_tft/uc8151d.c") +elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_RA8875) + list(APPEND SOURCES "lvgl_tft/ra8875.c") +elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_GC9A01) + list(APPEND SOURCES "lvgl_tft/GC9A01.c") +else() + message(WARNING "LVGL ESP32 drivers: Display controller not defined.") +endif() + +if(CONFIG_LV_TFT_DISPLAY_PROTOCOL_SPI) + list(APPEND SOURCES "lvgl_tft/disp_spi.c") +endif() + +# Add touch driver to compilation only if it is selected in menuconfig +if(CONFIG_LV_TOUCH_CONTROLLER) + list(APPEND SOURCES "lvgl_touch/touch_driver.c") + list(APPEND LVGL_INCLUDE_DIRS lvgl_touch) + + # Include only the source file of the selected + # touch controller. + if(CONFIG_LV_TOUCH_CONTROLLER_XPT2046) + list(APPEND SOURCES "lvgl_touch/xpt2046.c") + elseif(CONFIG_LV_TOUCH_CONTROLLER_FT6X06) + list(APPEND SOURCES "lvgl_touch/ft6x36.c") + elseif(CONFIG_LV_TOUCH_CONTROLLER_STMPE610) + list(APPEND SOURCES "lvgl_touch/stmpe610.c") + elseif(CONFIG_LV_TOUCH_CONTROLLER_ADCRAW) + list(APPEND SOURCES "lvgl_touch/adcraw.c") + elseif(CONFIG_LV_TOUCH_CONTROLLER_FT81X) + list(APPEND SOURCES "lvgl_touch/FT81x.c") + elseif(CONFIG_LV_TOUCH_CONTROLLER_RA8875) + list(APPEND SOURCES "lvgl_touch/ra8875_touch.c") + endif() + + if(CONFIG_LV_TOUCH_DRIVER_PROTOCOL_SPI) + list(APPEND SOURCES "lvgl_touch/tp_spi.c") + elseif(CONFIG_LV_TOUCH_DRIVER_PROTOCOL_I2C) + list(APPEND SOURCES "lvgl_touch/tp_i2c.c") + endif() +endif() idf_component_register(SRCS ${SOURCES} - INCLUDE_DIRS . + INCLUDE_DIRS ${LVGL_INCLUDE_DIRS} REQUIRES lvgl) +else() + message(FATAL_ERROR "LVGL ESP32 drivers: ESP_PLATFORM is not defined. Try reinstalling ESP-IDF.") endif() diff --git a/KConfig b/KConfig new file mode 100644 index 0000000..80509c6 --- /dev/null +++ b/KConfig @@ -0,0 +1,2 @@ +rsource "lvgl_tft/Kconfig" +rsource "lvgl_touch/KConfig" diff --git a/component.mk b/component.mk index 5a4522d..1ce9d8f 100644 --- a/component.mk +++ b/component.mk @@ -1,9 +1,48 @@ -# LVGL esp32 drivers +# LVGL ESP32 drivers +# Compile everything in this folder unconditionally COMPONENT_SRCDIRS := . - COMPONENT_ADD_INCLUDEDIRS := . + +# LVGL is supposed to be used as a ESP-IDF component +# -> lvlg is already in the include path +# -> we use simple include +CFLAGS += -DLV_LVGL_H_INCLUDE_SIMPLE + +# TFT display drivers COMPONENT_ADD_INCLUDEDIRS += lvgl_tft +COMPONENT_OBJS := lvgl_tft/disp_driver.o + +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341),lvgl_tft/ili9341.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481),lvgl_tft/ili9491.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9486),lvgl_tft/ili9486.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9488),lvgl_tft/ili9488.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7789),lvgl_tft/st7789.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7735S),lvgl_tft/st7735s.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7796S),lvgl_tft/st7796s.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_HX8357),lvgl_tft/hx8357.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_SH1107),lvgl_tft/sh1107.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_SSD1306),lvgl_tft/ssd1306.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X),lvgl_tft/EVE_commands.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X),lvgl_tft/FT81x.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_IL3820),lvgl_tft/il3820.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_JD79653A),lvgl_tft/jd79653a.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D),lvgl_tft/uc8151d.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_RA8875),lvgl_tft/ra8875.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_GC9A01),lvgl_tft/gc9a01.o) + +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_PROTOCOL_SPI),lvgl_tft/disp_spi.o) + +# Touch controller drivers COMPONENT_ADD_INCLUDEDIRS += lvgl_touch -CFLAGS += -DLV_LVGL_H_INCLUDE_SIMPLE +$(call compile_only_if,$(CONFIG_LV_TOUCH_CONTROLLER),lvgl_touch/touch_driver.o) +$(call compile_only_if,$(and $(CONFIG_LV_TOUCH_CONTROLLER),$(CONFIG_LV_TOUCH_CONTROLLER_XPT2046T)), lvgl_touch/xpt2046.o) +$(call compile_only_if,$(and $(CONFIG_LV_TOUCH_CONTROLLER),$(CONFIG_LV_TOUCH_CONTROLLER_FT6X06)), lvgl_touch/ft6x36.o) +$(call compile_only_if,$(and $(CONFIG_LV_TOUCH_CONTROLLER),$(CONFIG_LV_TOUCH_CONTROLLER_STMPE610)), lvgl_touch/stmpe610.o) +$(call compile_only_if,$(and $(CONFIG_LV_TOUCH_CONTROLLER),$(CONFIG_LV_TOUCH_CONTROLLER_ADCRAW)), lvgl_touch/adcraw.o) +$(call compile_only_if,$(and $(CONFIG_LV_TOUCH_CONTROLLER),$(CONFIG_LV_TOUCH_CONTROLLER_FT81X)), lvgl_touch/FT81x.o) +$(call compile_only_if,$(and $(CONFIG_LV_TOUCH_CONTROLLER),$(CONFIG_LV_TOUCH_CONTROLLER_RA8875)), lvgl_touch/ra8875_touch.o) + +$(call compile_only_if,$(and $(CONFIG_LV_TOUCH_CONTROLLER),$(CONFIG_LV_TOUCH_DRIVER_PROTOCOL_SPI)), lvgl_touch/tp_spi.o) +$(call compile_only_if,$(and $(CONFIG_LV_TOUCH_CONTROLLER),$(CONFIG_LV_TOUCH_DRIVER_PROTOCOL_I2C)), lvgl_touch/tp_i2c.o) diff --git a/lvgl_tft/CMakeLists.txt b/lvgl_tft/CMakeLists.txt deleted file mode 100644 index 04def8d..0000000 --- a/lvgl_tft/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ -if(ESP_PLATFORM) - -set(SOURCES "disp_driver.c") - -# Include only the source file of the selected -# display controller. -if(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341) - list(APPEND SOURCES "ili9341.c") -elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481) - list(APPEND SOURCES "ili9481.c") -elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9486) - list(APPEND SOURCES "ili9486.c") -elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9488) - list(APPEND SOURCES "ili9488.c") -elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7789) - list(APPEND SOURCES "st7789.c") -elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7735S) - list(APPEND SOURCES "st7735s.c") -elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7796S) - list(APPEND SOURCES "st7796s.c") -elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_HX8357) - list(APPEND SOURCES "hx8357.c") -elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_SH1107) - list(APPEND SOURCES "sh1107.c") -elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_SSD1306) - list(APPEND SOURCES "ssd1306.c") -elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X) - list(APPEND SOURCES "EVE_commands.c") - list(APPEND SOURCES "FT81x.c") -elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_IL3820) - list(APPEND SOURCES "il3820.c") -elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_JD79653A) - list(APPEND SOURCES "jd79653a.c") -elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D) - list(APPEND SOURCES "uc8151d.c") -elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_RA8875) - list(APPEND SOURCES "ra8875.c") -elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_GC9A01) - list(APPEND SOURCES "GC9A01.c") -else() - message("DISPLAY CONTROLLER NOT DEFINED") -endif() - -if(CONFIG_LV_TFT_DISPLAY_PROTOCOL_SPI) - list(APPEND SOURCES "disp_spi.c") -endif() - -# Print the included source files -message("SOURCES contents: " "${SOURCES}") - -idf_component_register(SRCS ${SOURCES} - INCLUDE_DIRS . - REQUIRES lvgl) - -endif() diff --git a/lvgl_tft/component.mk b/lvgl_tft/component.mk deleted file mode 100644 index 62c7c0e..0000000 --- a/lvgl_tft/component.mk +++ /dev/null @@ -1,26 +0,0 @@ -# TFT drivers - -COMPONENT_SRCDIRS := . -COMPONENT_ADD_INCLUDEDIRS := . - -COMPONENT_OBJS := disp_driver.o - -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341),ili9341.o) -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481),ili9491.o) -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9486),ili9486.o) -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9488),ili9488.o) -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7789),st7789.o) -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7735S),st7735s.o) -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7796S),st7796s.o) -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_HX8357),hx8357.o) -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_SH1107),sh1107.o) -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_SSD1306),ssd1306.o) -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X),EVE_commands.o) -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X),FT81x.o) -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_IL3820),il3820.o) -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_JD79653A),jd79653a.o) -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D),uc8151d.o) -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_RA8875),ra8875.o) -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_GC9A01),gc9a01.o) - -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_PROTOCOL_SPI),disp_spi.o) diff --git a/lvgl_touch/CMakeLists.txt b/lvgl_touch/CMakeLists.txt deleted file mode 100644 index b8b1c68..0000000 --- a/lvgl_touch/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -if(ESP_PLATFORM) - -set(SOURCES "touch_driver.c") - -# Include only the source file of the selected -# display controller. -if(CONFIG_LV_TOUCH_CONTROLLER_XPT2046) - list(APPEND SOURCES "xpt2046.c") -elseif(CONFIG_LV_TOUCH_CONTROLLER_FT6X06) - list(APPEND SOURCES "ft6x36.c") -elseif(CONFIG_LV_TOUCH_CONTROLLER_STMPE610) - list(APPEND SOURCES "stmpe610") -elseif(CONFIG_LV_TOUCH_CONTROLLER_ADCRAW) - list(APPEND SOURCES "adcraw.c") -elseif(CONFIG_LV_TOUCH_CONTROLLER_FT81X) - list(APPEND SOURCES "FT81x.c") -elseif(CONFIG_LV_TOUCH_CONTROLLER_RA8875) - list(APPEND SOURCES "ra8875_touch.c") -endif() - -if(CONFIG_LV_TOUCH_DRIVER_PROTOCOL_SPI) - list(APPEND SOURCES "tp_spi.c") -elseif(CONFIG_LV_TOUCH_DRIVER_PROTOCOL_I2C) - list(APPEND SOURCES "tp_i2c.c") -endif() - -# Print the included source files -message("SOURCES contents: " "${SOURCES}") - -idf_component_register(SRCS ${SOURCES} - INCLUDE_DIRS . - REQUIRES lvgl) - -endif() diff --git a/lvgl_touch/component.mk b/lvgl_touch/component.mk deleted file mode 100644 index 5b7c3ee..0000000 --- a/lvgl_touch/component.mk +++ /dev/null @@ -1,4 +0,0 @@ -# Touch drivers - -COMPONENT_SRCDIRS := . -COMPONENT_ADD_INCLUDEDIRS := . From 28d9fe7641758a3e4201c444e64d5cb2f0b3375b Mon Sep 17 00:00:00 2001 From: Tomas Rezucha Date: Tue, 23 Feb 2021 20:27:56 +0100 Subject: [PATCH 09/12] Fix Kconfig name --- KConfig | 2 -- Kconfig | 2 ++ component.mk | 11 +++++------ 3 files changed, 7 insertions(+), 8 deletions(-) delete mode 100644 KConfig create mode 100644 Kconfig diff --git a/KConfig b/KConfig deleted file mode 100644 index 80509c6..0000000 --- a/KConfig +++ /dev/null @@ -1,2 +0,0 @@ -rsource "lvgl_tft/Kconfig" -rsource "lvgl_touch/KConfig" diff --git a/Kconfig b/Kconfig new file mode 100644 index 0000000..ae11925 --- /dev/null +++ b/Kconfig @@ -0,0 +1,2 @@ +rsource "lvgl_tft/Kconfig" +rsource "lvgl_touch/Kconfig" diff --git a/component.mk b/component.mk index 1ce9d8f..dbd1105 100644 --- a/component.mk +++ b/component.mk @@ -1,7 +1,7 @@ # LVGL ESP32 drivers -# Compile everything in this folder unconditionally -COMPONENT_SRCDIRS := . +# Define sources and include dirs +COMPONENT_SRCDIRS := . lvgl_tft lvgl_touch COMPONENT_ADD_INCLUDEDIRS := . # LVGL is supposed to be used as a ESP-IDF component @@ -11,10 +11,9 @@ CFLAGS += -DLV_LVGL_H_INCLUDE_SIMPLE # TFT display drivers COMPONENT_ADD_INCLUDEDIRS += lvgl_tft -COMPONENT_OBJS := lvgl_tft/disp_driver.o $(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341),lvgl_tft/ili9341.o) -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481),lvgl_tft/ili9491.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481),lvgl_tft/ili9481.o) $(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9486),lvgl_tft/ili9486.o) $(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9488),lvgl_tft/ili9488.o) $(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7789),lvgl_tft/st7789.o) @@ -29,7 +28,7 @@ $(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_IL3820),lvgl_tft/il382 $(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_JD79653A),lvgl_tft/jd79653a.o) $(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D),lvgl_tft/uc8151d.o) $(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_RA8875),lvgl_tft/ra8875.o) -$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_GC9A01),lvgl_tft/gc9a01.o) +$(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_CONTROLLER_GC9A01),lvgl_tft/GC9A01.o) $(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_PROTOCOL_SPI),lvgl_tft/disp_spi.o) @@ -37,7 +36,7 @@ $(call compile_only_if,$(CONFIG_LV_TFT_DISPLAY_PROTOCOL_SPI),lvgl_tft/disp_spi.o COMPONENT_ADD_INCLUDEDIRS += lvgl_touch $(call compile_only_if,$(CONFIG_LV_TOUCH_CONTROLLER),lvgl_touch/touch_driver.o) -$(call compile_only_if,$(and $(CONFIG_LV_TOUCH_CONTROLLER),$(CONFIG_LV_TOUCH_CONTROLLER_XPT2046T)), lvgl_touch/xpt2046.o) +$(call compile_only_if,$(and $(CONFIG_LV_TOUCH_CONTROLLER),$(CONFIG_LV_TOUCH_CONTROLLER_XPT2046)), lvgl_touch/xpt2046.o) $(call compile_only_if,$(and $(CONFIG_LV_TOUCH_CONTROLLER),$(CONFIG_LV_TOUCH_CONTROLLER_FT6X06)), lvgl_touch/ft6x36.o) $(call compile_only_if,$(and $(CONFIG_LV_TOUCH_CONTROLLER),$(CONFIG_LV_TOUCH_CONTROLLER_STMPE610)), lvgl_touch/stmpe610.o) $(call compile_only_if,$(and $(CONFIG_LV_TOUCH_CONTROLLER),$(CONFIG_LV_TOUCH_CONTROLLER_ADCRAW)), lvgl_touch/adcraw.o) From 503ecb2b1eb3d7e335a14ce1c23afbfec99c666d Mon Sep 17 00:00:00 2001 From: Tomas Rezucha Date: Tue, 23 Feb 2021 20:28:27 +0100 Subject: [PATCH 10/12] Move Simple include definition to ESP32-drivers --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6efcbc4..d86bd33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,6 +80,8 @@ endif() idf_component_register(SRCS ${SOURCES} INCLUDE_DIRS ${LVGL_INCLUDE_DIRS} REQUIRES lvgl) + +target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_LVGL_H_INCLUDE_SIMPLE") else() message(FATAL_ERROR "LVGL ESP32 drivers: ESP_PLATFORM is not defined. Try reinstalling ESP-IDF.") From 5aea338a29080d8f6e843336804344fa36d5ff74 Mon Sep 17 00:00:00 2001 From: C47D Date: Sun, 28 Feb 2021 17:18:25 -0600 Subject: [PATCH 11/12] IL3820: Update interface declarations --- lvgl_tft/il3820.c | 4 ++-- lvgl_tft/il3820.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lvgl_tft/il3820.c b/lvgl_tft/il3820.c index 71b3970..45ae276 100644 --- a/lvgl_tft/il3820.c +++ b/lvgl_tft/il3820.c @@ -153,7 +153,7 @@ void il3820_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_m * the display buffer. * BIT_CLEAR(byte_index, bit_index) sets the bit_index pixel at the byte_index * of the display buffer. */ -void il3820_set_px_cb(struct _disp_drv_t * disp_drv, uint8_t* buf, +void il3820_set_px_cb(lv_disp_drv_t * disp_drv, uint8_t* buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, lv_color_t color, lv_opa_t opa) { @@ -185,7 +185,7 @@ void il3820_set_px_cb(struct _disp_drv_t * disp_drv, uint8_t* buf, } /* Required by LVGL */ -void il3820_rounder(struct _disp_drv_t * disp_drv, lv_area_t *area) { +void il3820_rounder(lv_disp_drv_t * disp_drv, lv_area_t *area) { area->x1 = area->x1 & ~(0x7); area->x2 = area->x2 | (0x7); } diff --git a/lvgl_tft/il3820.h b/lvgl_tft/il3820.h index 3969d8f..e0b73cd 100644 --- a/lvgl_tft/il3820.h +++ b/lvgl_tft/il3820.h @@ -100,8 +100,8 @@ extern "C" void il3820_init(void); void il3820_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map); void il3820_fullflush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map); -void il3820_rounder(struct _disp_drv_t * disp_drv, lv_area_t *area); -void il3820_set_px_cb(struct _disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, lv_color_t color, lv_opa_t opa); +void il3820_rounder(lv_disp_drv_t * disp_drv, lv_area_t *area); +void il3820_set_px_cb(lv_disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, lv_color_t color, lv_opa_t opa); void il3820_sleep_in(void); #ifdef __cplusplus From 9fed1cc47b5a45fec6bae08b55d2147d3b50260c Mon Sep 17 00:00:00 2001 From: C47D Date: Sun, 28 Feb 2021 17:53:32 -0600 Subject: [PATCH 12/12] SSD1306: Use LV_DISPLAY_ORIENTATION symbols --- lvgl_tft/ssd1306.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lvgl_tft/ssd1306.c b/lvgl_tft/ssd1306.c index be35be6..58fb88e 100644 --- a/lvgl_tft/ssd1306.c +++ b/lvgl_tft/ssd1306.c @@ -101,10 +101,10 @@ void ssd1306_init(void) uint8_t orientation_1 = 0; uint8_t orientation_2 = 0; -#if defined (CONFIG_DISPLAY_ORIENTATION_LANDSCAPE) +#if defined (CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE) orientation_1 = OLED_CMD_SET_SEGMENT_REMAP; orientation_2 = OLED_CMD_SET_COM_SCAN_MODE_REMAP; -#elif defined (CONFIG_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED) +#elif defined (CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED) orientation_1 = 0xA0; orientation_2 = OLED_CMD_SET_COM_SCAN_MODE_NORMAL; #else