Merge branch 'feature/esp_lcd_spi_support_3wire_half-duplex' into 'master'

esp_lcd: support serial interface-I mode for spi LCD

See merge request espressif/esp-idf!21077
This commit is contained in:
morris
2022-11-15 19:54:56 +08:00
2 changed files with 5 additions and 1 deletions

View File

@@ -136,6 +136,7 @@ typedef struct {
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 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 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 lsb_first: 1; /*!< transmit LSB bit first */
unsigned int cs_high_active: 1; /*!< CS line is high active */ unsigned int cs_high_active: 1; /*!< CS line is high active */
} flags; /*!< Extra flags to fine-tune the SPI device */ } flags; /*!< Extra flags to fine-tune the SPI device */

View File

@@ -73,6 +73,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 = { spi_device_interface_config_t devcfg = {
.flags = SPI_DEVICE_HALFDUPLEX | .flags = SPI_DEVICE_HALFDUPLEX |
(io_config->flags.lsb_first ? SPI_DEVICE_TXBIT_LSBFIRST : 0) | (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), (io_config->flags.cs_high_active ? SPI_DEVICE_POSITIVE_CS : 0),
.clock_speed_hz = io_config->pclk_hz, .clock_speed_hz = io_config->pclk_hz,
.mode = io_config->spi_mode, .mode = io_config->spi_mode,
@@ -208,7 +209,9 @@ static esp_err_t panel_io_spi_tx_param(esp_lcd_panel_io_t *io, int lcd_cmd, cons
memset(lcd_trans, 0, sizeof(lcd_spi_trans_descriptor_t)); memset(lcd_trans, 0, sizeof(lcd_spi_trans_descriptor_t));
lcd_trans->base.user = spi_panel_io; lcd_trans->base.user = spi_panel_io;
if (param && param_size) {
lcd_trans->base.flags |= SPI_TRANS_CS_KEEP_ACTIVE; lcd_trans->base.flags |= SPI_TRANS_CS_KEEP_ACTIVE;
}
if (spi_panel_io->flags.octal_mode) { if (spi_panel_io->flags.octal_mode) {
// use 8 lines for transmitting command, address and data // use 8 lines for transmitting command, address and data
lcd_trans->base.flags |= (SPI_TRANS_MULTILINE_CMD | SPI_TRANS_MULTILINE_ADDR | SPI_TRANS_MODE_OCT); lcd_trans->base.flags |= (SPI_TRANS_MULTILINE_CMD | SPI_TRANS_MULTILINE_ADDR | SPI_TRANS_MODE_OCT);