From 7c6bdc5635554c1c396af3ad9056b6e0f5e190d2 Mon Sep 17 00:00:00 2001 From: Carlos Diaz Date: Tue, 15 Feb 2022 00:51:37 -0600 Subject: [PATCH] Allow user to configure custom SPI mode (#181) Fixes #178 --- lvgl_spi_conf.h | 4 ++++ lvgl_tft/Kconfig | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/lvgl_spi_conf.h b/lvgl_spi_conf.h index 9b6d0ae..7a333fe 100644 --- a/lvgl_spi_conf.h +++ b/lvgl_spi_conf.h @@ -162,11 +162,15 @@ extern "C" { #endif /* CONFIG_LV_TFT_USE_CUSTOM_SPI_CLK_DIVIDER */ +#if defined (CONFIG_LV_TFT_DISPLAY_USE_CUSTOM_SPI_MODE) +#define SPI_TFT_SPI_MODE (CONFIG_LV_TFT_DISPLAY_CUSTOM_SPI_MODE) +#else #if defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7789) #define SPI_TFT_SPI_MODE (2U) #else #define SPI_TFT_SPI_MODE (0U) #endif +#endif /* Touch driver */ #if (CONFIG_LV_TOUCH_CONTROLLER == TOUCH_CONTROLLER_STMPE610) diff --git a/lvgl_tft/Kconfig b/lvgl_tft/Kconfig index 706cd07..80922ac 100644 --- a/lvgl_tft/Kconfig +++ b/lvgl_tft/Kconfig @@ -494,6 +494,18 @@ menu "LVGL TFT Display controller" bool "QIO (4-bit Quad SPI)" endchoice + config LV_TFT_DISPLAY_USE_CUSTOM_SPI_MODE + bool "Use custom SPI Mode" if LV_TFT_DISPLAY_PROTOCOL_SPI + help + Allow user to choose a custom SPI mode + + config LV_TFT_DISPLAY_CUSTOM_SPI_MODE + int "Custom SPI Mode" + range 0 3 + depends on LV_TFT_DISPLAY_USE_CUSTOM_SPI_MODE + help + Custom SPI mode, representing a pair of (CPOL, CPHA) configuration. + choice prompt "TFT SPI Duplex Mode" if LV_TFT_DISPLAY_PROTOCOL_SPI default LV_TFT_DISPLAY_SPI_FULL_DUPLEX if LV_PREDEFINED_DISPLAY_RPI_RA8875 || LV_TFT_DISPLAY_CONTROLLER_FT81X