Looking for a working example with esp_lcd_touch_cst816s
Posted: Thu Apr 30, 2026 10:38 am
Trying to convert an existing application to use esp_lvgl_port, esp_lcd_st77916 and esp_lcd_touch_cst816s.
As long as the touch device (CST816) is not enabled, LVGL works fine.
However, if the touch device is enabled the screen is cleared and no LVGL widgets are displayed.
The code to enable the touch device is:
and this is the line that if used will result in a black display:
After the touch device is created "new", the following code is used:
It's the esp_lcd_touch_new_i2c_cst816s that seems to be the root of the issue.
Thoughts?
I cannot find any example application that uses the esp_lcd_touch_cst816s module.
As long as the touch device (CST816) is not enabled, LVGL works fine.
However, if the touch device is enabled the screen is cleared and no LVGL widgets are displayed.
The code to enable the touch device is:
Code: Select all
esp_lcd_panel_io_handle_t tp_io_handle = NULL;
esp_lcd_panel_io_i2c_config_t tp_io_config = ESP_LCD_TOUCH_IO_I2C_CST816S_CONFIG();
ESP_ERROR_CHECK( esp_lcd_new_panel_io_i2c( i2c_handle, &tp_io_config, &tp_io_handle ) );
esp_lcd_touch_config_t tp_cfg = {
.x_max = LCD_WIDTH,
.y_max = LCD_HEIGHT,
.rst_gpio_num = (gpio_num_t)(CHIP_CST816_IO_RST),
.int_gpio_num = CHIP_CST816_IO_INT,
.levels = {
.reset = 0,
.interrupt = 0,
},
.flags = {
.swap_xy = 0,
.mirror_x = 0,
.mirror_y = 0,
},
.interrupt_callback = touch_callback,
};
Code: Select all
esp_lcd_touch_new_i2c_cst816s( tp_io_handle, &tp_cfg, &tp_handle );
Code: Select all
lvgl_port_touch_cfg_t touch_cfg = {
.disp = disp_handle,
.handle = tp_handle,
};
lvgl_port_add_touch( &touch_cfg );
Thoughts?
I cannot find any example application that uses the esp_lcd_touch_cst816s module.