Drivers for ESP32 to be used with LVGL
Go to file
Carlos Diaz 17eb416ef8
Update helpers and drivers to handle LVGLv7 and v8 versions (#161)
* [lvgl_helpers] Cleanup and misc code cleanup

Checks for SPI_HOST_MAX symbol before using it.

Rename lvgl_driver_init to lvgl_interface_init because it now only initialize
the interface bus for display drivers, we still need to remove the indev
drivers from here.

Use types defined in spi_types.h for spi host (spi_host_device_t) and
spi dma channels (spi_dma_chan_t).

Also add a couple of symbols to avoid using magic numbers

* [lvgl_helpers] Reduce usage of if defined in lvgl_interface_init

* [lvgl_helpers] Fix spi dma channel for ESP-IDF versions <= 4.2

* [examples] Update hello_world to call lvgl_interface_init

* Add lvgl_get_display_buffer_size helper

This helper will allow us to get the calculated display buffer size instead of using a global symbol.

* Implement lvgl_get_display_buffer_size

This API will be used to get the calculation of display buffer size.

* Delete DISP_BUF_SIZE symbols

The same functionality is handled by lvgl_get_display_buffer_size

* Move SPI max transfer size calculation to helper

Use calculate_spi_max_transfer_size to calculate the SPI max transfer size for the SPI master configuration

* Remove SPI_BUS_MAX_TRANSFER_SZ definition

Same functionality is now handled in calculate_spi_max_transfer_size

* Update display buffer size calculation

Use lvgl_get_display_buffer_size helper instead of DISP_BUF_SIZE symbol

* Update example to LVGL v8

Add comments about changes from:
- LVGL v7 to LVGL v8
- Configuration helpers and display drivers

* Update lvgl_helpers.c

* Update sh1107 driver

* Update EVE driver

Check for symbols used in previous implementations before trying to use them
and add a fallback temporary implementation when not found.

The falback implementation isn't tested with hardware.

Symbols:
- DISP_BUF_SIZE
- SPI_TRANSFER_SIZE

* Update uc8151d driver

* Update jd79653a driver

* Update ra8875 driver

* Update il3820.h

Check for LV_HOR_RES_MAX and LV_VER_RES_MAX before trying to use them

* Update lvgl_helpers.c

Check for ESP-IDF version before trying to use spi_dma_chan_t type
2022-01-07 17:22:11 -06:00
.github Add automated build of examples 2021-08-11 22:35:49 +02:00
examples Update helpers and drivers to handle LVGLv7 and v8 versions (#161) 2022-01-07 17:22:11 -06:00
lv_port Replace display_port_busy_t with bool 2021-10-01 12:11:28 -05:00
lvgl_i2c Addresses confusion: I2C manager component install only when others need I2C too. 2021-10-22 18:57:08 -05:00
lvgl_tft Update helpers and drivers to handle LVGLv7 and v8 versions (#161) 2022-01-07 17:22:11 -06:00
lvgl_touch fix SPI names for touch 2022-01-05 23:45:54 -06:00
.editorconfig Add editor config for people who use it 2021-02-12 10:20:28 +01:00
.gitignore fix SPI names 2021-12-16 13:40:00 +01:00
.gitmodules Add automated build of examples 2021-08-11 22:35:49 +02:00
CMakeLists.txt Merge branch 'master' into develop 2021-12-14 17:46:46 +01:00
component.mk directory i2c_manager -> lvgl_i2c 2021-07-14 12:43:19 +02:00
CONTRIBUTE_CONTROLLER_SUPPORT.md Update readme 2021-01-04 22:52:33 -06:00
display_config.h ili9488: Start updating to new display port interface (#137) 2021-11-17 21:00:07 -06:00
Kconfig Things suggested by @tore-espressif 2021-07-14 13:12:49 +02:00
LICENSE Initial commit 2020-06-23 11:48:19 +02:00
lvgl_helpers.c Update helpers and drivers to handle LVGLv7 and v8 versions (#161) 2022-01-07 17:22:11 -06:00
lvgl_helpers.h Update helpers and drivers to handle LVGLv7 and v8 versions (#161) 2022-01-07 17:22:11 -06:00
lvgl_spi_conf.h Update helpers and drivers to handle LVGLv7 and v8 versions (#161) 2022-01-07 17:22:11 -06:00
README.md Added PCD8544 to readme, addressed PR comments 2021-11-25 17:16:04 -06:00

Display and touchpad drivers for ESP32 using LVGL

For a ready to use ESP32 project take look at the lv_port_esp32 repository.

Table of content

NOTE: You need to set the display horizontal and vertical size, color depth and swap of RGB565 color on the LVGL configuration menuconfig (it's not handled automatically).

Supported display controllers

Display Controller Type Interface Color depth (LV_COLOR_DEPTH) Swap RGB565 color (LV_COLOR_16_SWAP)
ILI9341 TFT SPI 16: RGB565 Yes
ILI9163C TFT SPI 16: RGB565 Yes
ILI9486 TFT SPI 16: RGB565 Yes
ILI9488 TFT SPI 16: RGB565 No
HX8357B/HX8357D TFT SPI 16: RGB565 Yes
ST7789 TFT SPI 16: RGB565 Yes
ST7735S TFT SPI 16: RGB565 Yes
FT81x TFT Single, Dual, Quad SPI 16: RGB565 No
GC9A01 TFT SPI 16: RGB565 Yes
RA8875 TFT SPI 16: RGB565 Yes
SH1107 Monochrome SPI 1: 1byte per pixel No
SSD1306 Monochrome I2C 1: 1byte per pixel No
PCD8544 Monochrome SPI 1: 1byte per pixel No
IL3820 e-Paper SPI 1: 1byte per pixel No
UC8151D/ GoodDisplay GDEW0154M10 DES e-Paper SPI 1: 1byte per pixel No
FitiPower JD79653A/ GoodDisplay GDEW0154M09 e-Paper SPI 1: 1byte per pixel No

Supported indev controllers

  • XPT2046
  • FT3236, FT6X36
  • FT6206 controllers should work as well (not tested)
  • STMPE610
  • FT81x (Single, Dual, and Quad SPI)

If your display or input device (touch) controller is not supported consider contributing to this repo by adding support to it! Contribute controller support

Support for predefined development kits

You can also use the predefined kits, which selects the correct display controllers on the kit, and sets the gpio numbers for the interface.

Kit name Display controller Interface Hor. Res. Ver. Res.
ESP Wrover Kit v4.1 ILI9341 SPI 240 320
M5Stack ILI9341 SPI 240 320
M5Stack Core2 ILI9341 SPI 240 320
M5Stick SH1107 SPI - -
M5StickC ST7735S SPI 80 160
Adafruit 3.5 Featherwing HX8357 SPI 480 320
RPi MPI3501 ILI9486 SPI - -
Wemos Lolin OLED SSD1306 SPI 64 128
ER-TFT035-6 ILI9488 SPI 480 320
AIRcable ATAGv3 IL3820 SPI 128 296
TTGO T-Display ST7789 SPI 135 240
TTGO Camera Plus ST7789 SPI 240 240

NOTE: See Supported display controllers for more information on display configuration. NOTE: See Supported indev controllers for more information about indev configuration.

Thread-safe I2C with I2C Manager

LVGL can use I2C to read from a touch sensor or write to a display, possibly many times a second. Meanwhile, other tasks may also want to read from i2c devices on the same bus. I2C using the ESP-IDF is not thread-safe.

I2C Manager (i2c_manager) is a component that will let code in multiple threads talk to devices on the I2C ports without getting in each other's way. These drivers use a built-in copy of I2C Manager to talk to the I2C port, but you can also use the I2C Manager component itself and have others play nice with LVGL and vice-versa. Click here for details.

Backlight control

Control of LCD's backlight is provided by separate module that is independent from the display driver. Configuration of the backlight controller can be found in menuconfig LVGL ESP Drivers -> LVGL TFT Display controller.

There are three modes of operation:

  1. Off - No backlight control
  2. Switch - Allows ON/OFF control
  3. PWM - Allows brightness control (by Pulse-Width-Modulated signal)