Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esp_lcd: add flag for SPI to keep DC in command state during parameter transfers (IDFGH-11813) #12908

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion components/esp_lcd/include/esp_lcd_panel_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,10 @@ typedef 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 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 */
unsigned int dc_cmd_on_param: 1; /*!< If this flag is enabled, DC will stay in command state during parameter transmission */
} flags; /*!< Extra flags to fine-tune the SPI device */
} esp_lcd_panel_io_spi_config_t;

Expand Down
4 changes: 3 additions & 1 deletion components/esp_lcd/src/esp_lcd_panel_io_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ typedef 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)
unsigned int dc_param_level: 1; // Indicates the level of DC line when transferring parameters
} flags;
lcd_spi_trans_descriptor_t trans_pool[]; // Transaction pool
} esp_lcd_panel_io_spi_t;
Expand Down Expand Up @@ -94,6 +95,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.dc_param_level = io_config->flags.dc_cmd_on_param ? !spi_panel_io->flags.dc_data_level : spi_panel_io->flags.dc_data_level;
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;
Expand Down Expand Up @@ -234,7 +236,7 @@ static esp_err_t panel_io_spi_tx_param(esp_lcd_panel_io_t *io, int lcd_cmd, cons

if (param && param_size) {
spi_lcd_prepare_param_buffer(spi_panel_io, param, param_size);
lcd_trans->flags.dc_gpio_level = spi_panel_io->flags.dc_data_level; // set D/C line to data mode
lcd_trans->flags.dc_gpio_level = spi_panel_io->flags.dc_param_level; // set D/C line based on config
lcd_trans->base.length = param_size * 8; // transaction length is in bits
lcd_trans->base.tx_buffer = param;
lcd_trans->base.flags &= ~SPI_TRANS_CS_KEEP_ACTIVE;
Expand Down