Skip to content

Commit

Permalink
i80_lcd: support skip command phase
Browse files Browse the repository at this point in the history
Closes #10794
  • Loading branch information
suda-morris committed Apr 6, 2023
1 parent 173676e commit f373bea
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
8 changes: 4 additions & 4 deletions components/esp_lcd/include/esp_lcd_panel_commands.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -31,7 +31,7 @@
#define LCD_CMD_RAMRD 0x2E // Read frame memory
#define LCD_CMD_PTLAR 0x30 // Define the partial area
#define LCD_CMD_VSCRDEF 0x33 // Vertical scrolling definition
#define LCD_CMD_TEOFF 0x34 // Turns of tearing effect
#define LCD_CMD_TEOFF 0x34 // Turns off tearing effect
#define LCD_CMD_TEON 0x35 // Turns on tearing effect

#define LCD_CMD_MADCTL 0x36 // Memory data access control
Expand All @@ -48,7 +48,7 @@
#define LCD_CMD_COLMOD 0x3A // Defines the format of RGB picture data
#define LCD_CMD_RAMWRC 0x3C // Memory write continue
#define LCD_CMD_RAMRDC 0x3E // Memory read continue
#define LCD_CMD_STE 0x44 // Set tear scanline, tearing effect output signal when display module reaches line N
#define LCD_CMD_GDCAN 0x45 // Get scanline
#define LCD_CMD_STE 0x44 // Set tear scan line, tearing effect output signal when display module reaches line N
#define LCD_CMD_GDCAN 0x45 // Get scan line
#define LCD_CMD_WRDISBV 0x51 // Write display brightness
#define LCD_CMD_RDDISBV 0x52 // Read display brightness value
4 changes: 2 additions & 2 deletions components/esp_lcd/include/esp_lcd_panel_io.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -71,7 +71,7 @@ esp_err_t esp_lcd_panel_io_rx_param(esp_lcd_panel_io_handle_t io, int lcd_cmd, v
* this function will wait until they are finished and the queue is empty before sending the command(s).
*
* @param[in] io LCD panel IO handle, which is created by other factory API like `esp_lcd_new_panel_io_spi()`
* @param[in] lcd_cmd The specific LCD command (set to -1 if no command needed - only in SPI and I2C)
* @param[in] lcd_cmd The specific LCD command, set to -1 if no command needed
* @param[in] param Buffer that holds the command specific parameters, set to NULL if no parameter is needed for the command
* @param[in] param_size Size of `param` in memory, in bytes, set to zero if no parameter is needed for the command
* @return
Expand Down
13 changes: 10 additions & 3 deletions components/esp_lcd/src/esp_lcd_panel_io_i80.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -577,9 +577,16 @@ static void lcd_periph_trigger_quick_trans_done_event(esp_lcd_i80_bus_handle_t b
static void lcd_start_transaction(esp_lcd_i80_bus_t *bus, lcd_i80_trans_descriptor_t *trans_desc)
{
// by default, the dummy phase is disabled because it's not common for most LCDs
uint32_t dummy_cycles = 0;
uint32_t cmd_cycles = trans_desc->cmd_value >= 0 ? trans_desc->cmd_cycles : 0;
// Number of data phase cycles are controlled by DMA buffer length, we only need to enable/disable the phase here
lcd_ll_set_phase_cycles(bus->hal.dev, trans_desc->cmd_cycles, 0, trans_desc->data ? 1 : 0);
lcd_ll_set_command(bus->hal.dev, bus->bus_width, trans_desc->cmd_value);
uint32_t data_cycles = trans_desc->data ? 1 : 0;
if (trans_desc->cmd_value >= 0) {
lcd_ll_set_command(bus->hal.dev, bus->bus_width, trans_desc->cmd_value);
}
lcd_ll_set_phase_cycles(bus->hal.dev, cmd_cycles, dummy_cycles, data_cycles);
lcd_ll_set_blank_cycles(bus->hal.dev, 1, 1);

if (trans_desc->data) { // some specific LCD commands can have no parameters
gdma_start(bus->dma_chan, (intptr_t)(bus->dma_nodes));
// delay 1us is sufficient for DMA to pass data to LCD FIFO
Expand Down

0 comments on commit f373bea

Please sign in to comment.