Skip to content

Commit 2eee5f8

Browse files
committed
fix(board): fix GT911 init error for waveshare boards
Closes #145
1 parent 89c1394 commit 2eee5f8

7 files changed

+164
-33
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# ChangeLog
22

3-
## v0.2.2 - 2024-12-23
3+
## v0.2.2 - 2025-01-09
44

55
### Bugfixes:
66

77
* fix(lcd): use 'delete[]' instead of 'delete' for C array shared pointer @FranciscoMoya (#142)
8+
* fix(lcd): load vendor config from bus
9+
* fix(board): fix GT911 init error for waveshare boards
810
* fix(Kconfig): fix build error on esp-idf and incorrect descriptions @Cathgao (#133)
11+
* fix(examples): update PlatformIO lib & platform URLs
912

1013
## v0.2.1 - 2024-11-14
1114

src/board/waveshare/ESP32_S3_Touch_LCD_4_3.h

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -205,7 +205,7 @@
205205
#define ESP_PANEL_TOUCH_IO_RST (-1)
206206
#define ESP_PANEL_TOUCH_RST_LEVEL (0) // 0: low level, 1: high level
207207
/* IO num of INT pin, set to -1 if not use */
208-
#define ESP_PANEL_TOUCH_IO_INT (-1)
208+
#define ESP_PANEL_TOUCH_IO_INT (4)
209209
#define ESP_PANEL_TOUCH_INT_LEVEL (0) // 0: low level, 1: high level
210210

211211
#endif /* ESP_PANEL_USE_TOUCH */
@@ -242,7 +242,7 @@
242242
* If set to 1, the driver will skip to initialize the corresponding host. Users need to initialize the host in advance.
243243
* It is useful if other devices use the same host. Please ensure that the host is initialized only once.
244244
*/
245-
#define ESP_PANEL_EXPANDER_SKIP_INIT_HOST (1) // 0/1
245+
#define ESP_PANEL_EXPANDER_SKIP_INIT_HOST (0) // 0/1
246246
/* IO expander parameters */
247247
#define ESP_PANEL_EXPANDER_HOST_ID (0) // Typically set to 0
248248
#define ESP_PANEL_EXPANDER_I2C_ADDRESS (0x20)
@@ -262,9 +262,37 @@
262262
// #define ESP_PANEL_BEGIN_START_FUNCTION( panel )
263263
// #define ESP_PANEL_BEGIN_EXPANDER_START_FUNCTION( panel )
264264
// #define ESP_PANEL_BEGIN_EXPANDER_END_FUNCTION( panel )
265-
// #define ESP_PANEL_BEGIN_LCD_START_FUNCTION( panel )
265+
266+
#define ESP_PANEL_BEGIN_LCD_START_FUNCTION( panel ) \
267+
{ \
268+
ESP_LOGD(TAG, "Run ESP32_S3_Touch_LCD_4_3 LCD start function"); \
269+
constexpr int LCD_BL = 2; \
270+
constexpr int LCD_RST = 3; \
271+
auto expander = static_cast<ESP_IOExpander_CH422G*>(panel->getExpander()); \
272+
expander->enableAllIO_Output(); \
273+
expander->digitalWrite(LCD_BL, HIGH); \
274+
expander->digitalWrite(LCD_RST, HIGH); \
275+
vTaskDelay(pdMS_TO_TICKS(100)); \
276+
}
277+
266278
// #define ESP_PANEL_BEGIN_LCD_END_FUNCTION( panel )
267-
// #define ESP_PANEL_BEGIN_TOUCH_START_FUNCTION( panel )
279+
280+
#define ESP_PANEL_BEGIN_TOUCH_START_FUNCTION( panel ) \
281+
{ \
282+
ESP_LOGD(TAG, "Run ESP32_S3_Touch_LCD_4_3 touch start function"); \
283+
gpio_num_t touch_int = static_cast<gpio_num_t>(ESP_PANEL_TOUCH_IO_INT); \
284+
gpio_num_t touch_rst = static_cast<gpio_num_t>(1); \
285+
auto expander = static_cast<ESP_IOExpander_CH422G*>(panel->getExpander()); \
286+
gpio_set_direction(touch_int, GPIO_MODE_OUTPUT); \
287+
gpio_set_level(touch_int, 0); \
288+
vTaskDelay(pdMS_TO_TICKS(10)); \
289+
expander->digitalWrite(touch_rst, 0); \
290+
vTaskDelay(pdMS_TO_TICKS(100)); \
291+
expander->digitalWrite(touch_rst, 1); \
292+
vTaskDelay(pdMS_TO_TICKS(200)); \
293+
gpio_reset_pin(touch_int); \
294+
}
295+
268296
// #define ESP_PANEL_BEGIN_TOUCH_END_FUNCTION( panel )
269297
// #define ESP_PANEL_BEGIN_BACKLIGHT_START_FUNCTION( panel )
270298
// #define ESP_PANEL_BEGIN_BACKLIGHT_END_FUNCTION( panel )

src/board/waveshare/ESP32_S3_Touch_LCD_4_3_B.h

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
#define ESP_PANEL_TOUCH_IO_RST (-1)
206206
#define ESP_PANEL_TOUCH_RST_LEVEL (0) // 0: low level, 1: high level
207207
/* IO num of INT pin, set to -1 if not use */
208-
#define ESP_PANEL_TOUCH_IO_INT (-1)
208+
#define ESP_PANEL_TOUCH_IO_INT (4)
209209
#define ESP_PANEL_TOUCH_INT_LEVEL (0) // 0: low level, 1: high level
210210

211211
#endif /* ESP_PANEL_USE_TOUCH */
@@ -242,7 +242,7 @@
242242
* If set to 1, the driver will skip to initialize the corresponding host. Users need to initialize the host in advance.
243243
* It is useful if other devices use the same host. Please ensure that the host is initialized only once.
244244
*/
245-
#define ESP_PANEL_EXPANDER_SKIP_INIT_HOST (1) // 0/1
245+
#define ESP_PANEL_EXPANDER_SKIP_INIT_HOST (0) // 0/1
246246
/* IO expander parameters */
247247
#define ESP_PANEL_EXPANDER_HOST_ID (0) // Typically set to 0
248248
#define ESP_PANEL_EXPANDER_I2C_ADDRESS (0x20)
@@ -262,12 +262,35 @@
262262
// #define ESP_PANEL_BEGIN_START_FUNCTION( panel )
263263
// #define ESP_PANEL_BEGIN_EXPANDER_START_FUNCTION( panel )
264264
// #define ESP_PANEL_BEGIN_EXPANDER_END_FUNCTION( panel )
265-
// #define ESP_PANEL_BEGIN_LCD_START_FUNCTION( panel )
265+
266+
#define ESP_PANEL_BEGIN_LCD_START_FUNCTION( panel ) \
267+
{ \
268+
ESP_LOGD(TAG, "Run ESP32_S3_Touch_LCD_4_3_B LCD start function"); \
269+
constexpr int LCD_DSIP = 2; \
270+
constexpr int LCD_RST = 3; \
271+
auto expander = static_cast<ESP_IOExpander_CH422G*>(panel->getExpander()); \
272+
expander->enableAllIO_Output(); \
273+
expander->digitalWrite(LCD_DSIP, HIGH); \
274+
expander->digitalWrite(LCD_RST, HIGH); \
275+
vTaskDelay(pdMS_TO_TICKS(100)); \
276+
}
277+
266278
// #define ESP_PANEL_BEGIN_LCD_END_FUNCTION( panel )
267-
// #define ESP_PANEL_BEGIN_TOUCH_START_FUNCTION( panel )
268-
// #define ESP_PANEL_BEGIN_TOUCH_END_FUNCTION( panel )
269-
// #define ESP_PANEL_BEGIN_BACKLIGHT_START_FUNCTION( panel )
270-
// #define ESP_PANEL_BEGIN_BACKLIGHT_END_FUNCTION( panel )
271-
// #define ESP_PANEL_BEGIN_END_FUNCTION( panel )
279+
280+
#define ESP_PANEL_BEGIN_TOUCH_START_FUNCTION( panel ) \
281+
{ \
282+
ESP_LOGD(TAG, "Run ESP32_S3_Touch_LCD_4_3_B touch start function"); \
283+
gpio_num_t touch_int = static_cast<gpio_num_t>(ESP_PANEL_TOUCH_IO_INT); \
284+
gpio_num_t touch_rst = static_cast<gpio_num_t>(1); \
285+
auto expander = static_cast<ESP_IOExpander_CH422G*>(panel->getExpander()); \
286+
gpio_set_direction(touch_int, GPIO_MODE_OUTPUT); \
287+
gpio_set_level(touch_int, 0); \
288+
vTaskDelay(pdMS_TO_TICKS(10)); \
289+
expander->digitalWrite(touch_rst, 0); \
290+
vTaskDelay(pdMS_TO_TICKS(100)); \
291+
expander->digitalWrite(touch_rst, 1); \
292+
vTaskDelay(pdMS_TO_TICKS(200)); \
293+
gpio_reset_pin(touch_int); \
294+
}
272295

273296
// *INDENT-OFF*

src/board/waveshare/ESP32_S3_Touch_LCD_5.h

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
#define ESP_PANEL_TOUCH_IO_RST (-1)
206206
#define ESP_PANEL_TOUCH_RST_LEVEL (0) // 0: low level, 1: high level
207207
/* IO num of INT pin, set to -1 if not use */
208-
#define ESP_PANEL_TOUCH_IO_INT (-1)
208+
#define ESP_PANEL_TOUCH_IO_INT (4)
209209
#define ESP_PANEL_TOUCH_INT_LEVEL (0) // 0: low level, 1: high level
210210

211211
#endif /* ESP_PANEL_USE_TOUCH */
@@ -242,7 +242,7 @@
242242
* If set to 1, the driver will skip to initialize the corresponding host. Users need to initialize the host in advance.
243243
* It is useful if other devices use the same host. Please ensure that the host is initialized only once.
244244
*/
245-
#define ESP_PANEL_EXPANDER_SKIP_INIT_HOST (1) // 0/1
245+
#define ESP_PANEL_EXPANDER_SKIP_INIT_HOST (0) // 0/1
246246
/* IO expander parameters */
247247
#define ESP_PANEL_EXPANDER_HOST_ID (0) // Typically set to 0
248248
#define ESP_PANEL_EXPANDER_I2C_ADDRESS (0x20)
@@ -262,9 +262,37 @@
262262
// #define ESP_PANEL_BEGIN_START_FUNCTION( panel )
263263
// #define ESP_PANEL_BEGIN_EXPANDER_START_FUNCTION( panel )
264264
// #define ESP_PANEL_BEGIN_EXPANDER_END_FUNCTION( panel )
265-
// #define ESP_PANEL_BEGIN_LCD_START_FUNCTION( panel )
265+
266+
#define ESP_PANEL_BEGIN_LCD_START_FUNCTION( panel ) \
267+
{ \
268+
ESP_LOGD(TAG, "Run ESP32_S3_Touch_LCD_5 LCD start function"); \
269+
constexpr int LCD_DSIP = 2; \
270+
constexpr int LCD_RST = 3; \
271+
auto expander = static_cast<ESP_IOExpander_CH422G*>(panel->getExpander()); \
272+
expander->enableAllIO_Output(); \
273+
expander->digitalWrite(LCD_DSIP, HIGH); \
274+
expander->digitalWrite(LCD_RST, HIGH); \
275+
vTaskDelay(pdMS_TO_TICKS(100)); \
276+
}
277+
266278
// #define ESP_PANEL_BEGIN_LCD_END_FUNCTION( panel )
267-
// #define ESP_PANEL_BEGIN_TOUCH_START_FUNCTION( panel )
279+
280+
#define ESP_PANEL_BEGIN_TOUCH_START_FUNCTION( panel ) \
281+
{ \
282+
ESP_LOGD(TAG, "Run ESP32_S3_Touch_LCD_5 touch start function"); \
283+
gpio_num_t touch_int = static_cast<gpio_num_t>(ESP_PANEL_TOUCH_IO_INT); \
284+
gpio_num_t touch_rst = static_cast<gpio_num_t>(1); \
285+
auto expander = static_cast<ESP_IOExpander_CH422G*>(panel->getExpander()); \
286+
gpio_set_direction(touch_int, GPIO_MODE_OUTPUT); \
287+
gpio_set_level(touch_int, 0); \
288+
vTaskDelay(pdMS_TO_TICKS(10)); \
289+
expander->digitalWrite(touch_rst, 0); \
290+
vTaskDelay(pdMS_TO_TICKS(100)); \
291+
expander->digitalWrite(touch_rst, 1); \
292+
vTaskDelay(pdMS_TO_TICKS(200)); \
293+
gpio_reset_pin(touch_int); \
294+
}
295+
268296
// #define ESP_PANEL_BEGIN_TOUCH_END_FUNCTION( panel )
269297
// #define ESP_PANEL_BEGIN_BACKLIGHT_START_FUNCTION( panel )
270298
// #define ESP_PANEL_BEGIN_BACKLIGHT_END_FUNCTION( panel )

src/board/waveshare/ESP32_S3_Touch_LCD_5_B.h

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
#define ESP_PANEL_TOUCH_IO_RST (-1)
206206
#define ESP_PANEL_TOUCH_RST_LEVEL (0) // 0: low level, 1: high level
207207
/* IO num of INT pin, set to -1 if not use */
208-
#define ESP_PANEL_TOUCH_IO_INT (-1)
208+
#define ESP_PANEL_TOUCH_IO_INT (4)
209209
#define ESP_PANEL_TOUCH_INT_LEVEL (0) // 0: low level, 1: high level
210210

211211
#endif /* ESP_PANEL_USE_TOUCH */
@@ -242,7 +242,7 @@
242242
* If set to 1, the driver will skip to initialize the corresponding host. Users need to initialize the host in advance.
243243
* It is useful if other devices use the same host. Please ensure that the host is initialized only once.
244244
*/
245-
#define ESP_PANEL_EXPANDER_SKIP_INIT_HOST (1) // 0/1
245+
#define ESP_PANEL_EXPANDER_SKIP_INIT_HOST (0) // 0/1
246246
/* IO expander parameters */
247247
#define ESP_PANEL_EXPANDER_HOST_ID (0) // Typically set to 0
248248
#define ESP_PANEL_EXPANDER_I2C_ADDRESS (0x20)
@@ -262,9 +262,37 @@
262262
// #define ESP_PANEL_BEGIN_START_FUNCTION( panel )
263263
// #define ESP_PANEL_BEGIN_EXPANDER_START_FUNCTION( panel )
264264
// #define ESP_PANEL_BEGIN_EXPANDER_END_FUNCTION( panel )
265-
// #define ESP_PANEL_BEGIN_LCD_START_FUNCTION( panel )
265+
266+
#define ESP_PANEL_BEGIN_LCD_START_FUNCTION( panel ) \
267+
{ \
268+
ESP_LOGD(TAG, "Run ESP32_S3_Touch_LCD_5_B LCD start function"); \
269+
constexpr int LCD_DSIP = 2; \
270+
constexpr int LCD_RST = 3; \
271+
auto expander = static_cast<ESP_IOExpander_CH422G*>(panel->getExpander()); \
272+
expander->enableAllIO_Output(); \
273+
expander->digitalWrite(LCD_DSIP, HIGH); \
274+
expander->digitalWrite(LCD_RST, HIGH); \
275+
vTaskDelay(pdMS_TO_TICKS(100)); \
276+
}
277+
266278
// #define ESP_PANEL_BEGIN_LCD_END_FUNCTION( panel )
267-
// #define ESP_PANEL_BEGIN_TOUCH_START_FUNCTION( panel )
279+
280+
#define ESP_PANEL_BEGIN_TOUCH_START_FUNCTION( panel ) \
281+
{ \
282+
ESP_LOGD(TAG, "Run ESP32_S3_Touch_LCD_5_B touch start function"); \
283+
gpio_num_t touch_int = static_cast<gpio_num_t>(ESP_PANEL_TOUCH_IO_INT); \
284+
gpio_num_t touch_rst = static_cast<gpio_num_t>(1); \
285+
auto expander = static_cast<ESP_IOExpander_CH422G*>(panel->getExpander()); \
286+
gpio_set_direction(touch_int, GPIO_MODE_OUTPUT); \
287+
gpio_set_level(touch_int, 0); \
288+
vTaskDelay(pdMS_TO_TICKS(10)); \
289+
expander->digitalWrite(touch_rst, 0); \
290+
vTaskDelay(pdMS_TO_TICKS(100)); \
291+
expander->digitalWrite(touch_rst, 1); \
292+
vTaskDelay(pdMS_TO_TICKS(200)); \
293+
gpio_reset_pin(touch_int); \
294+
}
295+
268296
// #define ESP_PANEL_BEGIN_TOUCH_END_FUNCTION( panel )
269297
// #define ESP_PANEL_BEGIN_BACKLIGHT_START_FUNCTION( panel )
270298
// #define ESP_PANEL_BEGIN_BACKLIGHT_END_FUNCTION( panel )

src/board/waveshare/ESP32_S3_Touch_LCD_7.h

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
#define ESP_PANEL_TOUCH_IO_RST (-1)
206206
#define ESP_PANEL_TOUCH_RST_LEVEL (0) // 0: low level, 1: high level
207207
/* IO num of INT pin, set to -1 if not use */
208-
#define ESP_PANEL_TOUCH_IO_INT (-1)
208+
#define ESP_PANEL_TOUCH_IO_INT (4)
209209
#define ESP_PANEL_TOUCH_INT_LEVEL (0) // 0: low level, 1: high level
210210

211211
#endif /* ESP_PANEL_USE_TOUCH */
@@ -242,7 +242,7 @@
242242
* If set to 1, the driver will skip to initialize the corresponding host. Users need to initialize the host in advance.
243243
* It is useful if other devices use the same host. Please ensure that the host is initialized only once.
244244
*/
245-
#define ESP_PANEL_EXPANDER_SKIP_INIT_HOST (1) // 0/1
245+
#define ESP_PANEL_EXPANDER_SKIP_INIT_HOST (0) // 0/1
246246
/* IO expander parameters */
247247
#define ESP_PANEL_EXPANDER_HOST_ID (0) // Typically set to 0
248248
#define ESP_PANEL_EXPANDER_I2C_ADDRESS (0x20)
@@ -259,15 +259,36 @@
259259
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
260260
///////////////////////////// Please utilize the following macros to execute any additional code if required. //////////
261261
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
262-
// #define ESP_PANEL_BEGIN_START_FUNCTION( panel )
263-
// #define ESP_PANEL_BEGIN_EXPANDER_START_FUNCTION( panel )
264-
// #define ESP_PANEL_BEGIN_EXPANDER_END_FUNCTION( panel )
265-
// #define ESP_PANEL_BEGIN_LCD_START_FUNCTION( panel )
262+
263+
#define ESP_PANEL_BEGIN_LCD_START_FUNCTION( panel ) \
264+
{ \
265+
ESP_LOGD(TAG, "Run ESP32_S3_Touch_LCD_7 LCD start function"); \
266+
constexpr int LCD_DSIP = 2; \
267+
constexpr int LCD_RST = 3; \
268+
auto expander = static_cast<ESP_IOExpander_CH422G*>(panel->getExpander()); \
269+
expander->enableAllIO_Output(); \
270+
expander->digitalWrite(LCD_DSIP, HIGH); \
271+
expander->digitalWrite(LCD_RST, HIGH); \
272+
vTaskDelay(pdMS_TO_TICKS(100)); \
273+
}
274+
266275
// #define ESP_PANEL_BEGIN_LCD_END_FUNCTION( panel )
267-
// #define ESP_PANEL_BEGIN_TOUCH_START_FUNCTION( panel )
268-
// #define ESP_PANEL_BEGIN_TOUCH_END_FUNCTION( panel )
269-
// #define ESP_PANEL_BEGIN_BACKLIGHT_START_FUNCTION( panel )
270-
// #define ESP_PANEL_BEGIN_BACKLIGHT_END_FUNCTION( panel )
271-
// #define ESP_PANEL_BEGIN_END_FUNCTION( panel )
276+
277+
#define ESP_PANEL_BEGIN_TOUCH_START_FUNCTION( panel ) \
278+
{ \
279+
ESP_LOGD(TAG, "Run ESP32_S3_Touch_LCD_7 touch start function"); \
280+
gpio_num_t touch_int = static_cast<gpio_num_t>(ESP_PANEL_TOUCH_IO_INT); \
281+
gpio_num_t touch_rst = static_cast<gpio_num_t>(1); \
282+
auto expander = static_cast<ESP_IOExpander_CH422G*>(panel->getExpander()); \
283+
gpio_set_direction(touch_int, GPIO_MODE_OUTPUT); \
284+
gpio_set_level(touch_int, 0); \
285+
vTaskDelay(pdMS_TO_TICKS(10)); \
286+
expander->digitalWrite(touch_rst, 0); \
287+
vTaskDelay(pdMS_TO_TICKS(100)); \
288+
expander->digitalWrite(touch_rst, 1); \
289+
vTaskDelay(pdMS_TO_TICKS(200)); \
290+
gpio_reset_pin(touch_int); \
291+
}
292+
272293

273294
// *INDENT-OFF*

0 commit comments

Comments
 (0)