|
9 | 9 | // *INDENT-OFF* |
10 | 10 |
|
11 | 11 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
12 | | -//////////////////////////// Please update the following macros to configure the LCD panel ///////////////////////////// |
| 12 | +//////////////////////////// Please update the following macros to configure general panel ///////////////////////////// |
13 | 13 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
14 | | -/* Set to 1 when using an LCD panel */ |
15 | | -#define ESP_PANEL_BOARD_DEFAULT_USE_LCD (1) // 0/1 |
| 14 | +/* Panel resolution in pixels */ |
| 15 | +#define ESP_PANEL_BOARD_WIDTH (240) |
| 16 | +#define ESP_PANEL_BOARD_HEIGHT (240) |
16 | 17 |
|
| 18 | +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 19 | +//////////////////////////// Please update the following macros to configure the LCD panel ///////////////////////////// |
| 20 | +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 21 | +/* Set to 1 when using a LCD panel */ |
| 22 | +#define ESP_PANEL_BOARD_DEFAULT_USE_LCD (1) // 0/1 |
17 | 23 | #if ESP_PANEL_BOARD_DEFAULT_USE_LCD |
18 | 24 | /** |
19 | | - * LCD Controller Name. |
| 25 | + * LCD controller name. |
20 | 26 | */ |
21 | | -#define ESP_PANEL_BOARD_LCD_CONTROLLER GC9A01 |
22 | | - |
23 | | -/* LCD resolution in pixels */ |
24 | | -#define ESP_PANEL_BOARD_WIDTH (240) |
25 | | -#define ESP_PANEL_BOARD_HEIGHT (240) |
| 27 | +#define ESP_PANEL_BOARD_LCD_CONTROLLER GC9A01 |
26 | 28 |
|
27 | | -/* LCD Bus Settings */ |
28 | | -/** |
29 | | - * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. |
30 | | - * It is useful if other devices use the same host. Please ensure that the host is initialized only once. |
31 | | - */ |
32 | | -#define ESP_PANEL_BOARD_LCD_BUS_SKIP_INIT_HOST (0) // 0/1 |
33 | 29 | /** |
34 | | - * LCD Bus Type. |
| 30 | + * LCD bus type. |
35 | 31 | */ |
36 | | -#define ESP_PANEL_BOARD_LCD_BUS_TYPE (ESP_PANEL_BUS_TYPE_SPI) |
| 32 | +#define ESP_PANEL_BOARD_LCD_BUS_TYPE (ESP_PANEL_BUS_TYPE_SPI) |
| 33 | + |
37 | 34 | /** |
38 | | - * LCD Bus Parameters. |
| 35 | + * LCD bus parameters. |
39 | 36 | * |
40 | | - * Please refer to https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/lcd.html and |
| 37 | + * There are different parameters for different bus types. Please only configure the parameters for the selected bus type. |
| 38 | + * For the parameters of other bus types, they will be ignored. To understand the parameters, please check |
| 39 | + * https://docs.espressif.com/projects/esp-idf/en/v5.3.1/esp32s3/api-reference/peripherals/lcd/index.html and |
41 | 40 | * https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/index.html for more details. |
42 | 41 | * |
43 | 42 | */ |
44 | 43 | #if ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI |
45 | 44 |
|
46 | | - #define ESP_PANEL_BOARD_LCD_BUS_HOST_ID (1) // Typically set to 1 |
47 | | - #define ESP_PANEL_BOARD_LCD_SPI_IO_CS (7) |
| 45 | + /** |
| 46 | + * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. |
| 47 | + * |
| 48 | + * For drivers which created by this library, even if they use the same host, the host will be initialized only once. |
| 49 | + * So it is not necessary to set the macro to `1`. For other devices, please set the macro to `1` ensure that the |
| 50 | + * host is initialized only once. |
| 51 | + * |
| 52 | + */ |
| 53 | + #define ESP_PANEL_BOARD_LCD_BUS_SKIP_INIT_HOST (0) // 0/1. Typically set to 0 |
| 54 | + /* For general */ |
| 55 | + #define ESP_PANEL_BOARD_LCD_BUS_HOST_ID (1) // Typically set to 1 |
48 | 56 | #if !ESP_PANEL_BOARD_LCD_BUS_SKIP_INIT_HOST |
49 | | - #define ESP_PANEL_BOARD_LCD_SPI_IO_SCK (1) |
50 | | - #define ESP_PANEL_BOARD_LCD_SPI_IO_MOSI (0) |
51 | | - #define ESP_PANEL_BOARD_LCD_SPI_IO_MISO (-1) // -1 if not used |
52 | | -#endif |
53 | | - #define ESP_PANEL_BOARD_LCD_SPI_IO_DC (2) |
54 | | - #define ESP_PANEL_BOARD_LCD_SPI_MODE (0) // 0/1/2/3, typically set to 0 |
55 | | - #define ESP_PANEL_BOARD_LCD_SPI_CLK_HZ (40 * 1000 * 1000) |
56 | | - // Should be an integer divisor of 80M, typically set to 40M |
57 | | - #define ESP_PANEL_BOARD_LCD_SPI_TRANS_QUEUE_SZ (10) // Typically set to 10 |
58 | | - #define ESP_PANEL_BOARD_LCD_SPI_CMD_BITS (8) // Typically set to 8 |
59 | | - #define ESP_PANEL_BOARD_LCD_SPI_PARAM_BITS (8) // Typically set to 8 |
| 57 | + /* For host */ |
| 58 | + #define ESP_PANEL_BOARD_LCD_SPI_IO_SCK (1) |
| 59 | + #define ESP_PANEL_BOARD_LCD_SPI_IO_MOSI (0) |
| 60 | + #define ESP_PANEL_BOARD_LCD_SPI_IO_MISO (-1) // -1 if not used |
| 61 | +#endif // ESP_PANEL_BOARD_LCD_BUS_SKIP_INIT_HOST |
| 62 | + /* For panel */ |
| 63 | + #define ESP_PANEL_BOARD_LCD_SPI_IO_CS (7) // -1 if not used |
| 64 | + #define ESP_PANEL_BOARD_LCD_SPI_IO_DC (2) |
| 65 | + #define ESP_PANEL_BOARD_LCD_SPI_MODE (0) // 0/1/2/3. Typically set to 0 |
| 66 | + #define ESP_PANEL_BOARD_LCD_SPI_CLK_HZ (40 * 1000 * 1000) |
| 67 | + // Should be an integer divisor of 80M, typically set to 40M |
| 68 | + #define ESP_PANEL_BOARD_LCD_SPI_CMD_BITS (8) // Typically set to 8 |
| 69 | + #define ESP_PANEL_BOARD_LCD_SPI_PARAM_BITS (8) // Typically set to 8 |
60 | 70 |
|
61 | 71 | #endif /* ESP_PANEL_BOARD_LCD_BUS_TYPE */ |
62 | 72 |
|
63 | 73 | /** |
64 | | - * LCD Vendor Initialization Commands. |
| 74 | + * LCD vendor initialization commands. |
65 | 75 | * |
66 | 76 | * Vendor specific initialization can be different between manufacturers, should consult the LCD supplier for |
67 | 77 | * initialization sequence code. Please uncomment and change the following macro definitions. Otherwise, the LCD driver |
|
70 | 80 | * There are two formats for the sequence code: |
71 | 81 | * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} |
72 | 82 | * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and |
73 | | - * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) |
| 83 | + * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) |
74 | 84 | */ |
75 | 85 | /* |
76 | | -#define ESP_PANEL_BOARD_LCD_VENDOR_INIT_CMD \ |
77 | | - { \ |
78 | | - {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ |
79 | | - {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ |
80 | | - {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ |
81 | | - {0x29, (uint8_t []){0x00}, 0, 120}, \ |
82 | | - or \ |
| 86 | +#define ESP_PANEL_BOARD_LCD_VENDOR_INIT_CMD() \ |
| 87 | + { \ |
| 88 | + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ |
| 89 | + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ |
| 90 | + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ |
| 91 | + {0x29, (uint8_t []){0x00}, 0, 120}, \ |
| 92 | + or |
83 | 93 | ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ |
84 | 94 | ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ |
85 | 95 | ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ |
86 | 96 | ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ |
87 | 97 | } |
88 | 98 | */ |
89 | 99 |
|
90 | | -/* LCD Color Settings */ |
91 | | -/* LCD color depth in bits */ |
92 | | -#define ESP_PANEL_BOARD_LCD_COLOR_BITS (16) // 8/16/18/24 |
93 | | -/* |
94 | | - * LCD RGB Element Order. Choose one of the following: |
95 | | - * - 0: RGB |
96 | | - * - 1: BGR |
97 | | - */ |
98 | | -#define ESP_PANEL_BOARD_LCD_COLOR_BGR_ORDER (1) // 0/1 |
99 | | -#define ESP_PANEL_BOARD_LCD_INEVRT_COLOR (1) // 0/1 |
| 100 | +/* LCD device color */ |
| 101 | +/* Color depth in bits */ |
| 102 | +#define ESP_PANEL_BOARD_LCD_COLOR_BITS (ESP_PANEL_LCD_COLOR_BITS_RGB565) |
| 103 | + // ESP_PANEL_LCD_COLOR_BITS_RGB565/RGB666/RGB888 |
| 104 | +/* Color RGB element order */ |
| 105 | +#define ESP_PANEL_BOARD_LCD_COLOR_BGR_ORDER (1) // 0: RGB, 1: BGR |
100 | 106 |
|
101 | | -/* LCD Transformation Flags */ |
102 | | -#define ESP_PANEL_BOARD_LCD_SWAP_XY (0) // 0/1 |
103 | | -#define ESP_PANEL_BOARD_LCD_MIRROR_X (1) // 0/1 |
104 | | -#define ESP_PANEL_BOARD_LCD_MIRROR_Y (0) // 0/1 |
| 107 | +/* LCD pre-process flags */ |
| 108 | +#define ESP_PANEL_BOARD_LCD_INEVRT_COLOR (1) // 0/1 |
| 109 | +#define ESP_PANEL_BOARD_LCD_SWAP_XY (0) // 0/1 |
| 110 | +#define ESP_PANEL_BOARD_LCD_MIRROR_X (1) // 0/1 |
| 111 | +#define ESP_PANEL_BOARD_LCD_MIRROR_Y (0) // 0/1 |
105 | 112 |
|
106 | | -/* LCD Other Settings */ |
107 | | -/* IO num of RESET pin, set to -1 if not use */ |
108 | | -#define ESP_PANEL_BOARD_LCD_RST_IO (-1) |
109 | | -#define ESP_PANEL_BOARD_LCD_RST_LEVEL (0) // 0: low level, 1: high level |
| 113 | +/* LCD other settings */ |
| 114 | +/* Reset pin */ |
| 115 | +#define ESP_PANEL_BOARD_LCD_RST_IO (-1) // Reset IO pin num. Set to -1 if not use |
| 116 | +#define ESP_PANEL_BOARD_LCD_RST_LEVEL (0) // Reset active level. 0: low level, 1: high level |
110 | 117 |
|
111 | | -#endif /* ESP_PANEL_BOARD_DEFAULT_USE_LCD */ |
| 118 | +#endif // ESP_PANEL_BOARD_DEFAULT_USE_LCD |
112 | 119 |
|
113 | 120 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
114 | 121 | //////////////////////////// Please update the following macros to configure the touch panel /////////////////////////// |
115 | 122 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
116 | | -/* Set to 1 when using an touch panel */ |
117 | | -#define ESP_PANEL_BOARD_DEFAULT_USE_TOUCH (0) // 0/1 |
| 123 | +/* Set to 1 when using a touch panel */ |
| 124 | +#define ESP_PANEL_BOARD_DEFAULT_USE_TOUCH (0) // 0/1 |
118 | 125 |
|
119 | 126 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
120 | 127 | ///////////////////////////// Please update the following macros to configure the backlight //////////////////////////// |
121 | 128 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
122 | | -#define ESP_PANEL_BOARD_DEFAULT_USE_BACKLIGHT (1) // 0/1 |
| 129 | +/* Set to 1 when using the backlight */ |
| 130 | +#define ESP_PANEL_BOARD_DEFAULT_USE_BACKLIGHT (1) // 0/1 |
123 | 131 | #if ESP_PANEL_BOARD_DEFAULT_USE_BACKLIGHT |
124 | | -/* IO num of backlight pin */ |
125 | | -#define ESP_PANEL_BOARD_BACKLIGHT_IO (5) |
126 | | -#define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // 0: low level, 1: high level |
| 132 | +/** |
| 133 | + * Backlight control mode. Choose one of the following: |
| 134 | + * - ESP_PANEL_BACKLIGHT_TYPE_SWITCH_GPIO: Use GPIO switch to control the backlight, only support on/off |
| 135 | + * - ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC: Use LEDC PWM to control the backlight, support brightness adjustment |
| 136 | + * - ESP_PANEL_BACKLIGHT_TYPE_CUSTOM: Use custom function to control the backlight |
| 137 | + * |
| 138 | + */ |
| 139 | +#define ESP_PANEL_BOARD_BACKLIGHT_TYPE (ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) |
| 140 | + |
| 141 | +#if (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_GPIO) || \ |
| 142 | + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) |
| 143 | + |
| 144 | + /* Output pin */ |
| 145 | + #define ESP_PANEL_BOARD_BACKLIGHT_IO (5) // Output IO pin num |
| 146 | + #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Light up level. 0: low level, 1: high level |
127 | 147 |
|
128 | | -/* Set to 1 if you want to turn off the backlight after initializing the panel; otherwise, set it to turn on */ |
129 | | -#define ESP_PANEL_BOARD_BACKLIGHT_IDLE_OFF (0) // 0: on, 1: off |
| 148 | +#endif // ESP_PANEL_BOARD_BACKLIGHT_TYPE |
130 | 149 |
|
131 | | -/* Set to 1 if use PWM for brightness control */ |
132 | | -#define ESP_PANEL_LCD_BL_USE_PWM (1) // 0/1 |
133 | | -#endif /* ESP_PANEL_BOARD_DEFAULT_USE_BACKLIGHT */ |
| 150 | +/* Set to 1 if want to turn off the backlight after initializing. Otherwise, the backlight will be on */ |
| 151 | +#define ESP_PANEL_BOARD_BACKLIGHT_IDLE_OFF (0) // 0/1 |
| 152 | + |
| 153 | +#endif // ESP_PANEL_BOARD_DEFAULT_USE_BACKLIGHT |
134 | 154 |
|
135 | 155 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
136 | 156 | ///////////////////////////// Please update the following macros to configure the IO expander ////////////////////////// |
137 | 157 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
138 | | -/* Set to 0 if not using IO Expander */ |
139 | | -#define ESP_PANEL_BOARD_DEFAULT_USE_EXPANDER (0) // 0/1 |
| 158 | +/* Set to 0 if not using an IO Expander */ |
| 159 | +#define ESP_PANEL_BOARD_DEFAULT_USE_EXPANDER (0) // 0/1 |
140 | 160 |
|
141 | 161 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
142 | | -///////////////////////////// Please utilize the following macros to execute any additional code if required. ////////// |
| 162 | +/////////////////////// Please utilize the following macros to execute any additional code if required ///////////////// |
| 163 | +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 164 | + |
143 | 165 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
144 | | -// #define ESP_PANEL_BOARD_PRE_BEGIN_FUNCTION( p ) |
145 | | -// #define ESP_PANEL_BOARD_EXPANDER_PRE_BEGIN_FUNCTION( p ) |
146 | | -// #define ESP_PANEL_BOARD_EXPANDER_POST_BEGIN_FUNCTION( p ) |
147 | | -// #define ESP_PANEL_BOARD_LCD_PRE_BEGIN_FUNCTION( p ) |
148 | | -// #define ESP_PANEL_BOARD_LCD_POST_BEGIN_FUNCTION( p ) |
149 | | -// #define ESP_PANEL_BOARD_TOUCH_PRE_BEGIN_FUNCTION( p ) |
150 | | -// #define ESP_PANEL_BOARD_TOUCH_POST_BEGIN_FUNCTION( p ) |
151 | | -// #define ESP_PANEL_BOARD_BACKLIGHT_PRE_BEGIN_FUNCTION( p ) |
152 | | -// #define ESP_PANEL_BOARD_BACKLIGHT_POST_BEGIN_FUNCTION( p ) |
153 | | -// #define ESP_PANEL_BOARD_POST_BEGIN_FUNCTION( p ) |
| 166 | +/////////////////////////////////////////////// File Version /////////////////////////////////////////////////////////// |
| 167 | +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 168 | +/** |
| 169 | + * Do not change the following versions, they are used to check if the configurations in this file are compatible with |
| 170 | + * the current version of `esp_panel_board_custom.h` in the library. The detailed rules are as follows: |
| 171 | + * |
| 172 | + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library |
| 173 | + * and must be replaced with the file from the library. |
| 174 | + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to |
| 175 | + * default values. It is recommended to replace it with the file from the library. |
| 176 | + * 3. Even if the patch version is not consistent, it will not affect normal functionality. |
| 177 | + * |
| 178 | + */ |
| 179 | +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 |
| 180 | +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0 |
| 181 | +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 |
154 | 182 |
|
155 | 183 | // *INDENT-OFF* |
0 commit comments