1
1
/*
2
-
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
2
+
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
3
3
*
4
4
* SPDX-License-Identifier: Apache-2.0
5
5
*/
@@ -52,7 +52,9 @@ typedef struct {
52
52
int lcd_cmd_bits; // Bit width of LCD command
53
53
int lcd_param_bits; // Bit width of LCD parameter
54
54
struct {
55
-
unsigned int dc_data_level: 1; // Indicates the level of DC line when tranfering data
55
+
unsigned int dc_cmd_level: 1; // Indicates the level of DC line when transferring command
56
+
unsigned int dc_data_level: 1; // Indicates the level of DC line when transferring color data
57
+
unsigned int dc_param_level: 1; // Indicates the level of DC line when transferring parameters
56
58
unsigned int octal_mode: 1; // Indicates whether the transmitting is enabled with octal mode (8 data lines)
57
59
unsigned int quad_mode: 1; // Indicates whether the transmitting is enabled with quad mode (4 data lines)
58
60
} flags;
@@ -94,7 +96,9 @@ esp_err_t esp_lcd_new_panel_io_spi(esp_lcd_spi_bus_handle_t bus, const esp_lcd_p
94
96
ESP_GOTO_ON_ERROR(gpio_config(&io_conf), err, TAG, "configure GPIO for D/C line failed");
95
97
}
96
98
99
+
spi_panel_io->flags.dc_cmd_level = io_config->flags.dc_high_on_cmd;
97
100
spi_panel_io->flags.dc_data_level = !io_config->flags.dc_low_on_data;
101
+
spi_panel_io->flags.dc_param_level = !io_config->flags.dc_low_on_param;
98
102
spi_panel_io->flags.octal_mode = io_config->flags.octal_mode;
99
103
spi_panel_io->flags.quad_mode = io_config->flags.quad_mode;
100
104
spi_panel_io->on_color_trans_done = io_config->on_color_trans_done;
@@ -225,7 +229,7 @@ static esp_err_t panel_io_spi_tx_param(esp_lcd_panel_io_t *io, int lcd_cmd, cons
225
229
226
230
if (send_cmd) {
227
231
spi_lcd_prepare_cmd_buffer(spi_panel_io, &lcd_cmd);
228
-
lcd_trans->flags.dc_gpio_level = !spi_panel_io->flags.dc_data_level; // set D/C line to command mode
232
+
lcd_trans->flags.dc_gpio_level = spi_panel_io->flags.dc_cmd_level; // set D/C level in command phase
229
233
lcd_trans->base.length = spi_panel_io->lcd_cmd_bits;
230
234
lcd_trans->base.tx_buffer = &lcd_cmd;
231
235
// command is short, using polling mode
@@ -235,7 +239,7 @@ static esp_err_t panel_io_spi_tx_param(esp_lcd_panel_io_t *io, int lcd_cmd, cons
235
239
236
240
if (param && param_size) {
237
241
spi_lcd_prepare_param_buffer(spi_panel_io, param, param_size);
238
-
lcd_trans->flags.dc_gpio_level = spi_panel_io->flags.dc_data_level; // set D/C line to data mode
242
+
lcd_trans->flags.dc_gpio_level = spi_panel_io->flags.dc_param_level; // set D/C level in param phase
239
243
lcd_trans->base.length = param_size * 8; // transaction length is in bits
240
244
lcd_trans->base.tx_buffer = param;
241
245
lcd_trans->base.flags &= ~SPI_TRANS_CS_KEEP_ACTIVE;
@@ -279,7 +283,7 @@ static esp_err_t panel_io_spi_rx_param(esp_lcd_panel_io_t *io, int lcd_cmd, void
279
283
280
284
if (send_cmd) {
281
285
spi_lcd_prepare_cmd_buffer(spi_panel_io, &lcd_cmd);
282
-
lcd_trans->flags.dc_gpio_level = !spi_panel_io->flags.dc_data_level; // set D/C line to command mode
286
+
lcd_trans->flags.dc_gpio_level = spi_panel_io->flags.dc_cmd_level; // set D/C level in command phase
283
287
lcd_trans->base.length = spi_panel_io->lcd_cmd_bits;
284
288
lcd_trans->base.tx_buffer = &lcd_cmd;
285
289
// command is short, using polling mode
@@ -288,7 +292,7 @@ static esp_err_t panel_io_spi_rx_param(esp_lcd_panel_io_t *io, int lcd_cmd, void
288
292
}
289
293
290
294
if (param && param_size) {
291
-
lcd_trans->flags.dc_gpio_level = spi_panel_io->flags.dc_data_level; // set D/C line to data mode
295
+
lcd_trans->flags.dc_gpio_level = spi_panel_io->flags.dc_param_level; // set D/C level in param phase
292
296
lcd_trans->base.length = 0;
293
297
lcd_trans->base.tx_buffer = NULL;
294
298
lcd_trans->base.rxlength = param_size * 8; // Read length in bits
@@ -328,7 +332,7 @@ static esp_err_t panel_io_spi_tx_color(esp_lcd_panel_io_t *io, int lcd_cmd, cons
328
332
329
333
spi_lcd_prepare_cmd_buffer(spi_panel_io, &lcd_cmd);
330
334
lcd_trans->base.user = spi_panel_io;
331
-
lcd_trans->flags.dc_gpio_level = !spi_panel_io->flags.dc_data_level; // set D/C line to command mode
335
+
lcd_trans->flags.dc_gpio_level = spi_panel_io->flags.dc_cmd_level; // set D/C level in command phase
332
336
lcd_trans->base.length = spi_panel_io->lcd_cmd_bits;
333
337
lcd_trans->base.tx_buffer = &lcd_cmd;
334
338
if(color && color_size) {
@@ -371,7 +375,7 @@ static esp_err_t panel_io_spi_tx_color(esp_lcd_panel_io_t *io, int lcd_cmd, cons
371
375
}
372
376
373
377
lcd_trans->base.user = spi_panel_io;
374
-
lcd_trans->flags.dc_gpio_level = spi_panel_io->flags.dc_data_level; // set D/C line to data mode
378
+
lcd_trans->flags.dc_gpio_level = spi_panel_io->flags.dc_data_level; // set D/C level in data phase
375
379
lcd_trans->base.length = chunk_size * 8; // transaction length is in bits
376
380
lcd_trans->base.tx_buffer = color;
377
381
if (spi_panel_io->flags.octal_mode) {
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4