This template project is designed to help you kickstart your ESP-IDF projects for LCD-based applications using LVGL (Light and Versatile Graphics Library). It includes a simple structure for creating graphics using LVGL, pinouts and LCD connections configurations in the configs.h
file, and a customizable function draw_ui
in gui.c
for your specific graphics code.
- Model: 2.4-inch Touch LCD
- Driver: ILI9341
Make sure you have the following installed:
- ESP-IDF (Espressif IoT Development Framework)
- CMake
- Python
-
Clone this repository:
git clone https://github.com/kevinjacb/ESP_IDF_LCD_TEMPLATE.git cd ESP_IDF_LCD_TEMPLATE
-
Configure the project:
idf.py menuconfig
- Set up your project configuration, including WiFi credentials, if needed.
- Navigate to
main/configs.h
to set up your LCD pinouts, touch screen configurations, and other relevant settings.
-
Build and flash the project:
idf.py build idf.py -p /dev/ttyUSB0 flash # Use the appropriate serial port
-
Monitor the output:
idf.py -p /dev/ttyUSB0 monitor # Use the appropriate serial port
Edit the draw_ui
function in gui.c
to customize your graphics. This function is responsible for drawing the LVGL GUI elements.
void draw_ui() {
// Add your LVGL graphics code here
lv_obj_t *parent = lv_disp_get_scr_act(display);
// ... (your LVGL graphics initialization code)
}
main/
CMakeLists.txt
: CMake configuration file for the project.configs.h
: Configuration file containing pinouts, LCD connections, and touch screen configurations.gui.h
: Header file (include this wherever necessary)gui.c
: File containing thedraw_ui
function with LVGL graphics code.main.c
: Main application file.
components/
: External components and libraries.