Skip to content

Commit b44231c

Browse files
committed
feat(lcd_ili9341): Selectable default initial commands for LCD from three presets.
1 parent c927778 commit b44231c

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed

components/lcd/esp_lcd_ili9341/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,29 @@ Alternatively, you can create `idf_component.yml`. More is in [Espressif's docum
6464
```
6565
6666
There is an example in ESP-IDF with this LCD controller. Please follow this [link](https://github.com/espressif/esp-idf/tree/master/examples/peripherals/lcd/spi_lcd_touch).
67+
68+
## Predefined init vendor commands
69+
70+
This driver contains some predefined vendor inititalization commands. It can help improve screen in some cases. Usage is in example below.
71+
72+
Include selected commands:
73+
```c
74+
#include "esp_lcd_ili9341_init_cmds_1.h"
75+
```
76+
77+
Use vendor config structure:
78+
```c
79+
...
80+
81+
ili9341_vendor_config_t vendor_config = {
82+
.init_cmds = ili9341_lcd_init_vendor,
83+
.init_cmds_size = sizeof(ili9341_lcd_init_vendor) / sizeof(ili9341_lcd_init_cmd_t),
84+
};
85+
86+
const esp_lcd_panel_dev_config_t panel_config = {
87+
...
88+
.vendor_config = &vendor_config,
89+
};
90+
91+
...
92+
```
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
/**
7+
* @file
8+
* @brief ESP LCD: ILI9341 Init Commands 1
9+
*/
10+
11+
#pragma once
12+
#include "esp_lcd_ili9341.h"
13+
14+
static const ili9341_lcd_init_cmd_t ili9341_lcd_init_vendor[] = {
15+
// {cmd, { data }, data_size, delay_ms}
16+
/* Power control B */
17+
{0xCF, (uint8_t []){0x00, 0xC1, 0x30}, 3, 0},
18+
/* Power on sequence control */
19+
{0xED, (uint8_t []){0x64, 0x03, 0x12, 0x81}, 4, 0},
20+
/* Driver timing control A */
21+
{0xE8, (uint8_t []){0x85, 0x00, 0x78}, 3, 0},
22+
/* Power control A */
23+
{0xCB, (uint8_t []){0x39, 0x2C, 0x00, 0x34, 0x02}, 5, 0},
24+
/* Pump ratio control */
25+
{0xF7, (uint8_t []){0x20}, 1, 0},
26+
/* Driver timing control */
27+
{0xEA, (uint8_t []){0x00, 0x00}, 2, 0},
28+
/* Power control 1 */
29+
{0xC0, (uint8_t []){0x10}, 1, 0},
30+
/* Power control 2 */
31+
{0xC1, (uint8_t []){0x00}, 1, 0},
32+
/* VCOM control 1 */
33+
{0xC5, (uint8_t []){0x30, 0x30}, 2, 0},
34+
/* VCOM control 2 */
35+
{0xC7, (uint8_t []){0xB7}, 1, 0},
36+
/* Frame rate control */
37+
{0xB1, (uint8_t []){0x00, 0x1A}, 2, 0},
38+
/* Enable 3G */
39+
{0xF2, (uint8_t []){0x00}, 1, 0},
40+
/* Gamma set */
41+
{0x26, (uint8_t []){0x01}, 1, 0},
42+
/* Positive gamma correction */
43+
{0xE0, (uint8_t []){0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, 0x4E, 0xF1, 0x37, 0x07, 0x10, 0x03, 0x0E, 0x09, 0x00}, 15, 0}, // Adjusted for ILI9341_2_DRIVER
44+
/* Negative gamma correction */
45+
{0xE1, (uint8_t []){0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, 0x31, 0xC1, 0x48, 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F}, 15, 0}, // Adjusted for ILI9341_2_DRIVER
46+
/* Entry mode set */
47+
{0xB7, (uint8_t []){0x07}, 1, 0},
48+
/* Display function control */
49+
{0xB6, (uint8_t []){0x08, 0x82, 0x27}, 3, 0},
50+
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
/**
7+
* @file
8+
* @brief ESP LCD: ILI9341 Init Commands 1
9+
*/
10+
11+
#pragma once
12+
#include "esp_lcd_ili9341.h"
13+
14+
static const ili9341_lcd_init_cmd_t ili9341_lcd_init_vendor[] = {
15+
{0xC8, (uint8_t []){0xFF, 0x93, 0x42}, 3, 0},
16+
{0xC0, (uint8_t []){0x0E, 0x0E}, 2, 0},
17+
{0xC5, (uint8_t []){0xD0}, 1, 0},
18+
{0xC1, (uint8_t []){0x02}, 1, 0},
19+
{0xB4, (uint8_t []){0x02}, 1, 0},
20+
{0xE0, (uint8_t []){0x00, 0x03, 0x08, 0x06, 0x13, 0x09, 0x39, 0x39, 0x48, 0x02, 0x0a, 0x08, 0x17, 0x17, 0x0F}, 15, 0},
21+
{0xE1, (uint8_t []){0x00, 0x28, 0x29, 0x01, 0x0d, 0x03, 0x3f, 0x33, 0x52, 0x04, 0x0f, 0x0e, 0x37, 0x38, 0x0F}, 15, 0},
22+
23+
{0xB1, (uint8_t []){00, 0x1B}, 2, 0},
24+
{0x36, (uint8_t []){0x08}, 1, 0},
25+
{0x3A, (uint8_t []){0x55}, 1, 0},
26+
{0xB7, (uint8_t []){0x06}, 1, 0},
27+
28+
{0x11, (uint8_t []){0}, 0x80, 0},
29+
{0x29, (uint8_t []){0}, 0x80, 0},
30+
31+
{0, (uint8_t []){0}, 0xff, 0},
32+
};

0 commit comments

Comments
 (0)