mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(esp_lcd): spi add support for quad mode
This commit is contained in:
parent
f96a9ad84c
commit
3c9f407c1d
@ -136,6 +136,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 quad_mode: 1; /*!< transmit with quad mode (4 data lines), this mode is useful when transmitting LCD parameters (Only use one line for command) */
|
||||
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 */
|
||||
|
@ -54,6 +54,7 @@ typedef struct {
|
||||
struct {
|
||||
unsigned int dc_data_level: 1; // Indicates the level of DC line when tranfering data
|
||||
unsigned int octal_mode: 1; // Indicates whether the transmitting is enabled with octal mode (8 data lines)
|
||||
unsigned int quad_mode: 1; // Indicates whether the transmitting is enabled with quad mode (4 data lines)
|
||||
} flags;
|
||||
lcd_spi_trans_descriptor_t trans_pool[]; // Transaction pool
|
||||
} esp_lcd_panel_io_spi_t;
|
||||
@ -95,6 +96,7 @@ esp_err_t esp_lcd_new_panel_io_spi(esp_lcd_spi_bus_handle_t bus, const esp_lcd_p
|
||||
|
||||
spi_panel_io->flags.dc_data_level = !io_config->flags.dc_low_on_data;
|
||||
spi_panel_io->flags.octal_mode = io_config->flags.octal_mode;
|
||||
spi_panel_io->flags.quad_mode = io_config->flags.quad_mode;
|
||||
spi_panel_io->on_color_trans_done = io_config->on_color_trans_done;
|
||||
spi_panel_io->user_ctx = io_config->user_ctx;
|
||||
spi_panel_io->lcd_cmd_bits = io_config->lcd_cmd_bits;
|
||||
@ -329,6 +331,9 @@ static esp_err_t panel_io_spi_tx_color(esp_lcd_panel_io_t *io, int lcd_cmd, cons
|
||||
lcd_trans->flags.dc_gpio_level = !spi_panel_io->flags.dc_data_level; // set D/C line to command mode
|
||||
lcd_trans->base.length = spi_panel_io->lcd_cmd_bits;
|
||||
lcd_trans->base.tx_buffer = &lcd_cmd;
|
||||
if(color && color_size) {
|
||||
lcd_trans->base.flags |= SPI_TRANS_CS_KEEP_ACTIVE;
|
||||
}
|
||||
if (spi_panel_io->flags.octal_mode) {
|
||||
// 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);
|
||||
@ -372,6 +377,9 @@ static esp_err_t panel_io_spi_tx_color(esp_lcd_panel_io_t *io, int lcd_cmd, cons
|
||||
if (spi_panel_io->flags.octal_mode) {
|
||||
// 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);
|
||||
} else if (spi_panel_io->flags.quad_mode) {
|
||||
// use 4 lines only for transmitting data
|
||||
lcd_trans->base.flags |= SPI_TRANS_MODE_QIO;
|
||||
}
|
||||
|
||||
// color data is usually large, using queue+blocking mode
|
||||
|
Loading…
Reference in New Issue
Block a user