Skip to content

LVGL on ESP32 with MicroPython (as a USER_C_MODULE)

License

Notifications You must be signed in to change notification settings

MathyV/lvgl_esp32_mpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LVGL on ESP32 with MicroPython (as a USER_C_MODULE)

This repository is an attempt to create an out-of-the-box LVGL experience on ESP32 files using MicroPython.

Rationale

While there are a lot of libraries, examples and information available on getting LVGL working on MicroPython there is a huge amount of fragmented, outdated and non-working code out there.

After spending several days getting increasingly frustrated about the state of things I decided to fragment a bit more and create my own module with the following requirements:

  • Must compile as a USER_C_MODULE
  • Works with latest release of LVGL
  • Works with latest release of MicroPython
  • Works with latest (supported by MicroPython) release of ESP-IDF
  • Uses the esp_lcd driver of ESP-IDF with an SPI bus
  • Allows sharing SPI for example with SD card

There are currently no plans to support

  • non-ESP32 devices
  • other than the standard esp_lcd displays
  • other buses than SPI
  • other displays than ST7789 as I do not possess any to test

The final objective of this project is to support the camp badges for Fri3d Camp and as such certain functionality you'd expect from a display driver might be missing as they are not necessary for that project.

Don't hesitate to create a pull request to add the required functionality.

Board configuration

This wrapper requires that you activate the following options in your sdkconfig.board:

# lv_tick_inc is called from an esp_timer configured with interrupts
CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD=y

Building

First follow the MicroPython documentation to create a build for your device without this module and verify it is working.

Once you are sure it does, clone the repository with recursive submodules, this makes sure

git clone --recurse-submodules <repository-url>

Then you need to alter your partition table and add it into your sdkconfig.board, app partition (where binary micropython.bin exist) size need 0x260000 at least(depend on your project's manifest), following is an example partition table with 16MiB flash:

# Name,   Type, SubType, Offset,  Size, Flags  
nvs,      data, nvs,     0x9000,  0x6000,  
phy_init, data, phy,     0xf000,  0x1000,  
factory,  app,  factory, 0x10000, 0x2F0000,  
vfs,      data, fat,     0x300000, 0x700000,  

Compile adding the USER_C_MODULES parameter to the make command.

make USER_C_MODULES=/path/to/lvgl_esp32_mpy/micropython.cmake <other options>

Broken things

Missing things

Things I'll probably still implement at some point:

  • Rotation of displays

Supported versions

  • LVGL: 9.1
  • MicroPython: 1.23.0
  • ESP-IDF: 5.2.2

Acknowledgements

A lot of ideas and/or work were borrowed from

About

LVGL on ESP32 with MicroPython (as a USER_C_MODULE)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •