Skip to content

Commit 77ad8c3

Browse files
authored
Merge pull request #235 from lvgl/esp32s2_aware
Esp32s2 aware
2 parents e97dafc + 3fc2e2f commit 77ad8c3

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

components/lvgl_esp32_drivers/lvgl_helpers.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,17 @@ bool lvgl_spi_driver_init(int host,
200200
int dma_channel,
201201
int quadwp_pin, int quadhd_pin)
202202
{
203+
#if defined (CONFIG_IDF_TARGET_ESP32)
203204
assert((SPI_HOST <= host) && (VSPI_HOST >= host));
204-
205205
const char *spi_names[] = {
206206
"SPI_HOST", "HSPI_HOST", "VSPI_HOST"
207207
};
208+
#elif defined (CONFIG_IDF_TARGET_ESP32S2)
209+
assert((SPI_HOST <= host) && (HSPI_HOST >= host));
210+
const char *spi_names[] = {
211+
"SPI_HOST", "", ""
212+
};
213+
#endif
208214

209215
ESP_LOGI(TAG, "Configuring SPI host %s (%d)", spi_names[host], host);
210216
ESP_LOGI(TAG, "MISO pin: %d, MOSI pin: %d, SCLK pin: %d, IO2/WP pin: %d, IO3/HD pin: %d",

components/lvgl_esp32_drivers/lvgl_spi_conf.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,13 @@ extern "C" {
6464

6565
#define ENABLE_TOUCH_INPUT CONFIG_LV_ENABLE_TOUCH
6666

67-
#if CONFIG_LV_TFT_DISPLAY_SPI_HSPI == 1
67+
#if defined (CONFIG_LV_TFT_DISPLAY_SPI_HSPI)
6868
#define TFT_SPI_HOST HSPI_HOST
69-
#else
69+
#elif defined (CONFIG_LV_TFT_DISPLAY_SPI_VSPI)
7070
#define TFT_SPI_HOST VSPI_HOST
71-
#endif /*CONFIG_LV_TFT_DISPLAY_SPI_HSPI == 1*/
71+
#elif defined (CONFIG_LV_TFT_DISPLAY_SPI_FSPI)
72+
#define TFT_SPI_HOST FSPI_HOST
73+
#endif
7274

7375
#if defined (CONFIG_LV_TFT_DISPLAY_SPI_HALF_DUPLEX)
7476
#define DISP_SPI_HALF_DUPLEX
@@ -88,7 +90,9 @@ extern "C" {
8890
#define TOUCH_SPI_HOST HSPI_HOST
8991
#elif defined (CONFIG_LV_TOUCH_CONTROLLER_SPI_VSPI)
9092
#define TOUCH_SPI_HOST VSPI_HOST
91-
#endif /*CONFIG_LV_TOUCH_CONTROLLER_SPI_HSPI == 1*/
93+
#elif defined (CONFIG_LV_TOUCH_CONTROLLER_SPI_FSPI)
94+
#define TOUCH_SPI_HOST FSPI_HOST
95+
#endif
9296

9397
/* Handle the FT81X Special case */
9498
#if defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X)
@@ -103,7 +107,7 @@ extern "C" {
103107
// Detect the use of a shared SPI Bus and verify the user specified the same SPI bus for both touch and tft
104108
#if defined (CONFIG_LV_TOUCH_DRIVER_PROTOCOL_SPI) && TP_SPI_MOSI == DISP_SPI_MOSI && TP_SPI_CLK == DISP_SPI_CLK
105109
#if TFT_SPI_HOST != TOUCH_SPI_HOST
106-
#error You must specify the same SPI host (HSPI or VSPI) for both display and touch driver
110+
#error You must specify the same SPI host (HSPI, VSPI or FSPI) for both display and touch driver
107111
#endif
108112

109113
#define SHARED_SPI_BUS

components/lvgl_esp32_drivers/lvgl_tft/Kconfig

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,15 +401,18 @@ menu "LVGL TFT Display controller"
401401
choice
402402
prompt "TFT SPI Bus." if LV_TFT_DISPLAY_PROTOCOL_SPI && \
403403
!LV_PREDEFINED_DISPLAY_TTGO
404-
default LV_TFT_DISPLAY_SPI_VSPI if LV_PREDEFINED_DISPLAY_TTGO
405-
default LV_TFT_DISPLAY_SPI_HSPI
404+
default LV_TFT_DISPLAY_SPI_VSPI if LV_PREDEFINED_DISPLAY_TTGO && \
405+
!IDF_TARGET_ESP32S2
406+
default LV_TFT_DISPLAY_SPI_FSPI if IDF_TARGET_ESP32S2
406407
help
407408
Select the SPI Bus the TFT Display is attached to.
408409

409410
config LV_TFT_DISPLAY_SPI_HSPI
410411
bool "HSPI"
411412
config LV_TFT_DISPLAY_SPI_VSPI
412-
bool "VSPI"
413+
bool "VSPI" if !IDF_TARGET_ESP32S2
414+
config LV_TFT_DISPLAY_SPI_FSPI
415+
bool "FSPI" if IDF_TARGET_ESP32S2
413416
endchoice
414417

415418
choice

components/lvgl_esp32_drivers/lvgl_touch/Kconfig

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,17 @@ menu "LVGL Touch controller"
7777
prompt "Touch Controller SPI Bus."
7878
depends on LV_TOUCH_DRIVER_PROTOCOL_SPI
7979

80-
default LV_TOUCH_CONTROLLER_SPI_VSPI
80+
default LV_TOUCH_CONTROLLER_SPI_VSPI if !IDF_TARGET_ESP32S2
81+
default LV_TOUCH_CONTROLLER_SPI_FSPI if IDF_TARGET_ESP32S2
8182
help
8283
Select the SPI Bus the TFT Display is attached to.
8384

8485
config LV_TOUCH_CONTROLLER_SPI_HSPI
8586
bool "HSPI"
8687
config LV_TOUCH_CONTROLLER_SPI_VSPI
87-
bool "VSPI"
88+
bool "VSPI" if !IDF_TARGET_ESP32S2
89+
config LV_TOUCH_CONTROLLER_SPI_FSPI
90+
bool "FSPI" if IDF_TARGET_ESP32S2
8891
endchoice
8992

9093
menu "Touchpanel (XPT2046) Pin Assignments"

0 commit comments

Comments
 (0)