|
205 | 205 | #define ESP_PANEL_TOUCH_IO_RST (-1) |
206 | 206 | #define ESP_PANEL_TOUCH_RST_LEVEL (0) // 0: low level, 1: high level |
207 | 207 | /* 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) |
209 | 209 | #define ESP_PANEL_TOUCH_INT_LEVEL (0) // 0: low level, 1: high level |
210 | 210 |
|
211 | 211 | #endif /* ESP_PANEL_USE_TOUCH */ |
|
242 | 242 | * If set to 1, the driver will skip to initialize the corresponding host. Users need to initialize the host in advance. |
243 | 243 | * It is useful if other devices use the same host. Please ensure that the host is initialized only once. |
244 | 244 | */ |
245 | | -#define ESP_PANEL_EXPANDER_SKIP_INIT_HOST (1) // 0/1 |
| 245 | +#define ESP_PANEL_EXPANDER_SKIP_INIT_HOST (0) // 0/1 |
246 | 246 | /* IO expander parameters */ |
247 | 247 | #define ESP_PANEL_EXPANDER_HOST_ID (0) // Typically set to 0 |
248 | 248 | #define ESP_PANEL_EXPANDER_I2C_ADDRESS (0x20) |
|
259 | 259 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
260 | 260 | ///////////////////////////// Please utilize the following macros to execute any additional code if required. ////////// |
261 | 261 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
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 | + |
266 | 275 | // #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 | + |
272 | 293 |
|
273 | 294 | // *INDENT-OFF* |
0 commit comments