From c7673cf761f1b50aa9ce2570341c69d1cc5c30d8 Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 9 Dec 2020 00:25:49 -0600 Subject: [PATCH 1/6] Check for different SPI ports depending on the target --- components/lvgl_esp32_drivers/lvgl_helpers.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/lvgl_esp32_drivers/lvgl_helpers.c b/components/lvgl_esp32_drivers/lvgl_helpers.c index 21b667d5..8d443d0b 100644 --- a/components/lvgl_esp32_drivers/lvgl_helpers.c +++ b/components/lvgl_esp32_drivers/lvgl_helpers.c @@ -200,11 +200,17 @@ bool lvgl_spi_driver_init(int host, int dma_channel, int quadwp_pin, int quadhd_pin) { +#if defined (CONFIG_IDF_TARGET_ESP32) assert((SPI_HOST <= host) && (VSPI_HOST >= host)); - const char *spi_names[] = { "SPI_HOST", "HSPI_HOST", "VSPI_HOST" }; +#elif defined (CONFIG_IDF_TARGET_ESP32S2) + assert((SPI_HOST <= host) && (HSPI_HOST >= host)); + const char *spi_names[] = { + "SPI_HOST", "", "" + }; +#endif ESP_LOGI(TAG, "Configuring SPI host %s (%d)", spi_names[host], host); ESP_LOGI(TAG, "MISO pin: %d, MOSI pin: %d, SCLK pin: %d, IO2/WP pin: %d, IO3/HD pin: %d", From 743104ba96d2c9275d57dc4ba370e9c2d6a4f575 Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 9 Dec 2020 00:26:39 -0600 Subject: [PATCH 2/6] Kconfig Replace VSPI with FSPI when using ESP32S2 --- components/lvgl_esp32_drivers/lvgl_tft/Kconfig | 7 +++++-- components/lvgl_esp32_drivers/lvgl_touch/Kconfig | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/components/lvgl_esp32_drivers/lvgl_tft/Kconfig b/components/lvgl_esp32_drivers/lvgl_tft/Kconfig index 3f17ac06..51633b1d 100644 --- a/components/lvgl_esp32_drivers/lvgl_tft/Kconfig +++ b/components/lvgl_esp32_drivers/lvgl_tft/Kconfig @@ -401,7 +401,8 @@ menu "LVGL TFT Display controller" choice prompt "TFT SPI Bus." if LV_TFT_DISPLAY_PROTOCOL_SPI && \ !LV_PREDEFINED_DISPLAY_TTGO - default LV_TFT_DISPLAY_SPI_VSPI if LV_PREDEFINED_DISPLAY_TTGO + default LV_TFT_DISPLAY_SPI_VSPI if LV_PREDEFINED_DISPLAY_TTGO && \ + !IDF_TARGET_ESP32S2 default LV_TFT_DISPLAY_SPI_HSPI help Select the SPI Bus the TFT Display is attached to. @@ -409,7 +410,9 @@ menu "LVGL TFT Display controller" config LV_TFT_DISPLAY_SPI_HSPI bool "HSPI" config LV_TFT_DISPLAY_SPI_VSPI - bool "VSPI" + bool "VSPI" if !IDF_TARGET_ESP32S2 + config LV_TFT_DISPLAY_SPI_FSPI + bool "FSPI" if IDF_TARGET_ESP32S2 endchoice choice diff --git a/components/lvgl_esp32_drivers/lvgl_touch/Kconfig b/components/lvgl_esp32_drivers/lvgl_touch/Kconfig index 19577715..071fda62 100644 --- a/components/lvgl_esp32_drivers/lvgl_touch/Kconfig +++ b/components/lvgl_esp32_drivers/lvgl_touch/Kconfig @@ -77,14 +77,17 @@ menu "LVGL Touch controller" prompt "Touch Controller SPI Bus." depends on LV_TOUCH_DRIVER_PROTOCOL_SPI - default LV_TOUCH_CONTROLLER_SPI_VSPI + default LV_TOUCH_CONTROLLER_SPI_VSPI if !IDF_TARGET_ESP32S2 + default LV_TOUCH_CONTROLLER_SPI_HSPI if IDF_TARGET_ESP32S2 help Select the SPI Bus the TFT Display is attached to. config LV_TOUCH_CONTROLLER_SPI_HSPI bool "HSPI" config LV_TOUCH_CONTROLLER_SPI_VSPI - bool "VSPI" + bool "VSPI" if !IDF_TARGET_ESP32S2 + config LV_TFT_DISPLAY_SPI_FSPI + bool "FSPI" if IDF_TARGET_ESP32S2 endchoice menu "Touchpanel (XPT2046) Pin Assignments" From 2866ad4ecfebffb044379941b61e43224c07cfc6 Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 9 Dec 2020 00:35:22 -0600 Subject: [PATCH 3/6] Update lvgl_spi_conf with FSPI Host --- components/lvgl_esp32_drivers/lvgl_spi_conf.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/components/lvgl_esp32_drivers/lvgl_spi_conf.h b/components/lvgl_esp32_drivers/lvgl_spi_conf.h index ab7d4d32..16e63b4f 100644 --- a/components/lvgl_esp32_drivers/lvgl_spi_conf.h +++ b/components/lvgl_esp32_drivers/lvgl_spi_conf.h @@ -64,11 +64,13 @@ extern "C" { #define ENABLE_TOUCH_INPUT CONFIG_LV_ENABLE_TOUCH -#if CONFIG_LV_TFT_DISPLAY_SPI_HSPI == 1 +#if defined (CONFIG_LV_TFT_DISPLAY_SPI_HSPI) #define TFT_SPI_HOST HSPI_HOST -#else +#elif defined (CONFIG_LV_TFT_DISPLAY_SPI_VSPI) #define TFT_SPI_HOST VSPI_HOST -#endif /*CONFIG_LV_TFT_DISPLAY_SPI_HSPI == 1*/ +#elif defined (CONFIG_LV_TFT_DISPLAY_SPI_FSPI) +#define TFT_SPI_HOST FSPI_HOST +#endif #if defined (CONFIG_LV_TFT_DISPLAY_SPI_HALF_DUPLEX) #define DISP_SPI_HALF_DUPLEX @@ -88,7 +90,9 @@ extern "C" { #define TOUCH_SPI_HOST HSPI_HOST #elif defined (CONFIG_LV_TOUCH_CONTROLLER_SPI_VSPI) #define TOUCH_SPI_HOST VSPI_HOST -#endif /*CONFIG_LV_TOUCH_CONTROLLER_SPI_HSPI == 1*/ +#elif defined (CONFIG_LV_TOUCH_CONTROLLER_SPI_FSPI) +#define TOUCH_SPI_HOST FSPI_HOST +#endif /* Handle the FT81X Special case */ #if defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X) @@ -103,7 +107,7 @@ extern "C" { // Detect the use of a shared SPI Bus and verify the user specified the same SPI bus for both touch and tft #if defined (CONFIG_LV_TOUCH_DRIVER_PROTOCOL_SPI) && TP_SPI_MOSI == DISP_SPI_MOSI && TP_SPI_CLK == DISP_SPI_CLK #if TFT_SPI_HOST != TOUCH_SPI_HOST -#error You must specify the same SPI host (HSPI or VSPI) for both display and touch driver +#error You must specify the same SPI host (HSPI, VSPI or FSPI) for both display and touch driver #endif #define SHARED_SPI_BUS From a90ed983d80dcce594d46875774dac1b9dbe5eb4 Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 9 Dec 2020 22:41:46 -0600 Subject: [PATCH 4/6] Fix typo --- components/lvgl_esp32_drivers/lvgl_touch/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/lvgl_esp32_drivers/lvgl_touch/Kconfig b/components/lvgl_esp32_drivers/lvgl_touch/Kconfig index 071fda62..a3917a7d 100644 --- a/components/lvgl_esp32_drivers/lvgl_touch/Kconfig +++ b/components/lvgl_esp32_drivers/lvgl_touch/Kconfig @@ -86,7 +86,7 @@ menu "LVGL Touch controller" bool "HSPI" config LV_TOUCH_CONTROLLER_SPI_VSPI bool "VSPI" if !IDF_TARGET_ESP32S2 - config LV_TFT_DISPLAY_SPI_FSPI + config LV_TOUCH_DISPLAY_SPI_FSPI bool "FSPI" if IDF_TARGET_ESP32S2 endchoice From e326044e36eb731ccea27af224a285322bbd34e2 Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 9 Dec 2020 22:42:40 -0600 Subject: [PATCH 5/6] Default FSPI when ESP32S2 is target --- components/lvgl_esp32_drivers/lvgl_tft/Kconfig | 2 +- components/lvgl_esp32_drivers/lvgl_touch/Kconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/lvgl_esp32_drivers/lvgl_tft/Kconfig b/components/lvgl_esp32_drivers/lvgl_tft/Kconfig index 51633b1d..3cc90d5d 100644 --- a/components/lvgl_esp32_drivers/lvgl_tft/Kconfig +++ b/components/lvgl_esp32_drivers/lvgl_tft/Kconfig @@ -403,7 +403,7 @@ menu "LVGL TFT Display controller" !LV_PREDEFINED_DISPLAY_TTGO default LV_TFT_DISPLAY_SPI_VSPI if LV_PREDEFINED_DISPLAY_TTGO && \ !IDF_TARGET_ESP32S2 - default LV_TFT_DISPLAY_SPI_HSPI + default LV_TFT_DISPLAY_SPI_FSPI if IDF_TARGET_ESP32S2 help Select the SPI Bus the TFT Display is attached to. diff --git a/components/lvgl_esp32_drivers/lvgl_touch/Kconfig b/components/lvgl_esp32_drivers/lvgl_touch/Kconfig index a3917a7d..ed6a1c2f 100644 --- a/components/lvgl_esp32_drivers/lvgl_touch/Kconfig +++ b/components/lvgl_esp32_drivers/lvgl_touch/Kconfig @@ -78,7 +78,7 @@ menu "LVGL Touch controller" depends on LV_TOUCH_DRIVER_PROTOCOL_SPI default LV_TOUCH_CONTROLLER_SPI_VSPI if !IDF_TARGET_ESP32S2 - default LV_TOUCH_CONTROLLER_SPI_HSPI if IDF_TARGET_ESP32S2 + default LV_TOUCH_CONTROLLER_SPI_FSPI if IDF_TARGET_ESP32S2 help Select the SPI Bus the TFT Display is attached to. From 3fc2e2fb93708b43c920e280a52bcb378d7a2c23 Mon Sep 17 00:00:00 2001 From: C47D Date: Thu, 10 Dec 2020 00:07:08 -0600 Subject: [PATCH 6/6] Fix typo --- components/lvgl_esp32_drivers/lvgl_touch/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/lvgl_esp32_drivers/lvgl_touch/Kconfig b/components/lvgl_esp32_drivers/lvgl_touch/Kconfig index ed6a1c2f..bbcdad7e 100644 --- a/components/lvgl_esp32_drivers/lvgl_touch/Kconfig +++ b/components/lvgl_esp32_drivers/lvgl_touch/Kconfig @@ -86,7 +86,7 @@ menu "LVGL Touch controller" bool "HSPI" config LV_TOUCH_CONTROLLER_SPI_VSPI bool "VSPI" if !IDF_TARGET_ESP32S2 - config LV_TOUCH_DISPLAY_SPI_FSPI + config LV_TOUCH_CONTROLLER_SPI_FSPI bool "FSPI" if IDF_TARGET_ESP32S2 endchoice