From 313700e2854ac643a66c834af14e15cc69ebfcf8 Mon Sep 17 00:00:00 2001 From: Liu Zhongwei Date: Mon, 14 Nov 2022 16:33:36 +0800 Subject: [PATCH] esp_lcd: support sio mode for spi LCD --- components/esp_lcd/include/esp_lcd_panel_io.h | 1 + components/esp_lcd/src/esp_lcd_panel_io_spi.c | 1 + 2 files changed, 2 insertions(+) diff --git a/components/esp_lcd/include/esp_lcd_panel_io.h b/components/esp_lcd/include/esp_lcd_panel_io.h index 035864b36a..b7e4ab2e2f 100644 --- a/components/esp_lcd/include/esp_lcd_panel_io.h +++ b/components/esp_lcd/include/esp_lcd_panel_io.h @@ -116,6 +116,7 @@ typedef struct { struct { unsigned int dc_low_on_data: 1; /*!< If this flag is enabled, DC line = 0 means transfer data, DC line = 1 means transfer command; vice versa */ unsigned int octal_mode: 1; /*!< transmit with octal mode (8 data lines), this mode is used to simulate Intel 8080 timing */ + unsigned int sio_mode: 1; /*!< Read and write through a single data line (MOSI) */ unsigned int lsb_first: 1; /*!< transmit LSB bit first */ unsigned int cs_high_active: 1; /*!< CS line is high active */ } flags; /*!< Extra flags to fine-tune the SPI device */ diff --git a/components/esp_lcd/src/esp_lcd_panel_io_spi.c b/components/esp_lcd/src/esp_lcd_panel_io_spi.c index 10b9f055af..76692b99e3 100644 --- a/components/esp_lcd/src/esp_lcd_panel_io_spi.c +++ b/components/esp_lcd/src/esp_lcd_panel_io_spi.c @@ -72,6 +72,7 @@ esp_err_t esp_lcd_new_panel_io_spi(esp_lcd_spi_bus_handle_t bus, const esp_lcd_p spi_device_interface_config_t devcfg = { .flags = SPI_DEVICE_HALFDUPLEX | (io_config->flags.lsb_first ? SPI_DEVICE_TXBIT_LSBFIRST : 0) | + (io_config->flags.sio_mode ? SPI_DEVICE_3WIRE : 0) | (io_config->flags.cs_high_active ? SPI_DEVICE_POSITIVE_CS : 0), .clock_speed_hz = io_config->pclk_hz, .mode = io_config->spi_mode,