This is an ESP32 demo project showcasing LVGL v7 with support for several display controllers and touch controllers.
The demo application is the lv_demo_widgets
project from the lv_examples repository.
- Version of LVGL used: 7.9.
- Version of lv_examples used: 7.9.
- Get started
- Use LVGL in your ESP-IDF project
- Use lvgl_esp32_drivers in your project
- Platformio support
Example demo for TFT displays:
Monochrome support:
The display and touch (indev) controllers are now into it's own repository, you can find it here.
To report any issue or add new display or touch (indev) drivers you can do so in the lvgl_esp32_drivers
repo.
- ESP-IDF Framework.
This project tries to be compatible with both the ESP-IDF v3.x and v4.0, but using v4.0 is recommended.
Instructions assume you are using the v4.x toolchain, otherwise use the make commands, e.g. instead of running idf.py menuconfig
, run make menuconfig
.
-
Clone this project by
git clone --recurse-submodules https://github.com/lvgl/lv_port_esp32.git
, this will pull this repo and its submodules. -
Get into the created
lv_port_esp32
directory. -
Run
idf.py menuconfig
-
Configure LVGL in
Components config->LVGL Configuration
. For monochrome displays use the mono theme and we suggest enabling theunscii 8
font. -
Configure your display and/or touch controllers in
Components config->LVGL TFT Display Configuration
andComponents config->LVGL TOUCH Configuration
. -
Store your project configuration.
-
Build the project with
idf.py build
-
If the build don't throw any errors, flash the demo with
idf.py -p (YOUR SERIAL PORT) flash
(withmake
this is justmake flash
- in 3.x PORT is configured inmenuconfig
)
LVGL now includes a Kconfig file which is used to configure most of the LVGL configuration options via menuconfig, so it's not necessary to use a custom lv_conf.h
file.
It is recommended to add LVGL as a submodule in your IDF project's git repo.
From your project's root directory:
- Create a directory named
components
(if you don't have one already) withmkdir -p components
. - Clone the lvgl repository inside the
components
directory withgit submodule add https://github.com/lvgl/lvgl.git components/lvgl
- Run
idf.py menuconfig
, go toComponent config
thenLVGL configuration
to configure LVGL.
It is recommended to add lvgl_esp32_drivers as a submodule in your IDF project's git repo.
From your project's root directory:
- Create a directory named
components
(if you don't have one already) withmkdir -p components
. - Clone the lvgl_esp32_drivers repository inside the
components
directory withgit submodule add https://github.com/lvgl/lvgl_esp32_drivers.git components/lvgl_esp32_drivers
- Run
idf.py menuconfig
, go toComponent config
thenLVGL TFT configuration
andLVGL TFT Display configuration
to configure lvgl_esp32_drivers.
Using the lv_platformio project add the following lines to platformio.ini
file:
[env:esp32]
platform = espressif32
framework = espidf
board = esp-wrover-kit
Change the default environment to default_envs = esp32
.
Modify the main.c
like this:
#include "lvgl.h"
// #include "driver.h"
#include "demo.h"
int app_main(void)
{
lv_init();
/* Initialize your hardware. */
/* hw_init(); */
demo_create();
/* Create the UI or start a task for it.
* In the end, don't forget to call `lv_task_handler` in a loop. */
/* hw_loop(); */
return 0;
For more information see: platformio with espidf framework compability.