Skip to content

tommokmok/esp32s3_lvgl_idf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP32-S3 Example Project: IDF v5.4.2 & LVGL v9.2.2 with ST7789 LCD & XPT2046 Touch

Introduction

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.

Hardware

  • ESP32-S3 Development Board with 2.8" TFT LCD

    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)

Software Dependencies

  • 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

How This Project May Help You

  • If you are using the same LCD and touch drivers, you can reference this code for hardware initialization, driver integration, and touch calibration.

Screenshots

esp32-lvgl-port-demo

Prerequisites

  • Visual Studio Code with the Espressif IDF extension
  • ESP-IDF configured to version v5.4.2

Building & Flashing

  1. Clone this repository:

  2. Open the project in VS Code.

  3. Set the device target to esp32s3 in the IDF extension.

  4. Click Build and Flash.

Implementation Notes

  • 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 to 3600 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);

About

ESP32-S3 Example Project: IDF v5.4.2 & LVGL v9.2.2 with ST7789 LCD & XPT2046 Touch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published