This project demonstrates an ESP32-S3 codebase based on the esp_lvgl_port
example, updated to support the ST7789 LCD driver and XPT2046 touch driver. The hardware and software configuration matches the specifications below.
- ESP32-S3 Development Board with 2.8" TFT LCD
- Purchased from Taobao. More info: ESP32-LVGL开发板
Note: This dev board is not recommended due to hardware issues. It may reset automatically, especially when connected to a PC.
- ESP32-S3-N8R8 (8MB external RAM and 8MB external SPI flash)
- LCD Driver: ST7789, 320 x 240 pixels (SPI interface)
- Touch Driver: XPT2046 (SPI interface)
- ESP-IDF: v5.4.2
- LVGL: v9.2.2
- esp_lvgl_port: v2.6.0
- esp_lcd_touch: v1.1.2
- atanisoft__esp_lcd_touch_xpt2046: v1.0.6
- If you are using the same LCD and touch drivers, you can reference this code for hardware initialization, driver integration, and touch calibration.
- Visual Studio Code with the Espressif IDF extension
- ESP-IDF configured to version v5.4.2
-
Clone this repository:
-
Open the project in VS Code.
-
Set the device target to
esp32s3
in the IDF extension. -
Click
Build
andFlash
.
-
The
atanisoft__esp_lcd_touch_xpt2046
component was updated to improve touch point accuracy. The original code did not work correctly. -
The raw output from the XPT2046 driver ranges from approximately
280
to3600
for both X and Y axes. -
A custom conversion was implemented to map the raw touch data to the correct display coordinates (0–240 for X, 0–320 for Y).
-
The following API is provided for touch point calibration:
esp_err_t xpt2046_set_cali_param(esp_lcd_touch_config_t *config, float x_min, float x_max, float y_min, float y_max);