diff --git a/components/esp_lcd/include/esp_lcd_panel_commands.h b/components/esp_lcd/include/esp_lcd_panel_commands.h index 091ef1cffef7..5917c3e87741 100644 --- a/components/esp_lcd/include/esp_lcd_panel_commands.h +++ b/components/esp_lcd/include/esp_lcd_panel_commands.h @@ -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 */ @@ -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 @@ -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 diff --git a/components/esp_lcd/include/esp_lcd_panel_io.h b/components/esp_lcd/include/esp_lcd_panel_io.h index 9bc140870e4f..9877ab8ea532 100644 --- a/components/esp_lcd/include/esp_lcd_panel_io.h +++ b/components/esp_lcd/include/esp_lcd_panel_io.h @@ -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 */ @@ -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 diff --git a/components/esp_lcd/src/esp_lcd_panel_io_i80.c b/components/esp_lcd/src/esp_lcd_panel_io_i80.c index 038983cf93c2..f9d61a72ceae 100644 --- a/components/esp_lcd/src/esp_lcd_panel_io_i80.c +++ b/components/esp_lcd/src/esp_lcd_panel_io_i80.c @@ -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 */ @@ -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