Skip to content

Commit

Permalink
Merge pull request #235 from lvgl/esp32s2_aware
Browse files Browse the repository at this point in the history
Esp32s2 aware
  • Loading branch information
C47D committed Dec 10, 2020
2 parents e97dafc + 3fc2e2f commit 77ad8c3
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
8 changes: 7 additions & 1 deletion components/lvgl_esp32_drivers/lvgl_helpers.c
Expand Up @@ -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",
Expand Down
14 changes: 9 additions & 5 deletions components/lvgl_esp32_drivers/lvgl_spi_conf.h
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand Down
9 changes: 6 additions & 3 deletions components/lvgl_esp32_drivers/lvgl_tft/Kconfig
Expand Up @@ -401,15 +401,18 @@ 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_HSPI
default LV_TFT_DISPLAY_SPI_VSPI if LV_PREDEFINED_DISPLAY_TTGO && \
!IDF_TARGET_ESP32S2
default LV_TFT_DISPLAY_SPI_FSPI if IDF_TARGET_ESP32S2
help
Select the SPI Bus the TFT Display is attached to.

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
Expand Down
7 changes: 5 additions & 2 deletions components/lvgl_esp32_drivers/lvgl_touch/Kconfig
Expand Up @@ -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_FSPI 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_TOUCH_CONTROLLER_SPI_FSPI
bool "FSPI" if IDF_TARGET_ESP32S2
endchoice

menu "Touchpanel (XPT2046) Pin Assignments"
Expand Down

0 comments on commit 77ad8c3

Please sign in to comment.