You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
I have tried to make this as simple as possible for paople to use.There are some glitches still in it I am sure. If you come across an issueplease let me know.
I am still in development mode for the unix port. I am writing an SDL driverthat conforms To the rest of the driver framework. I have started working onwriting the frameworks for the different indev (input) types that LVGL supports.The frameworks are written to make it easier to write display and input driversfor the binding.
Build Instructions
I have changed the design of the binding so it is no longer a dependancy ofMicroPython. Instead MicroPython is now a dependency of the binding. By doingthis I have simplified the process up updating the MicroPython version. Onlysmall changes are now needed to support newer versions of MicroPython.
In order to make this all work I have written a Python script that handlesBuilding the binding. The only prerequesits are that you have a C compilerinstalled (gcc, clang, msvc) and the necessary support libs.
Requirements
compiling for ESP32
Ubuntu (Linux): you can install all of these usingapt-get install
build-essential
cmake
ninja-build
python
macOS
command xcode-select–install
brew install make
brew install cmake
brew install ninja
brew install python
Compiling for RP2
Ubuntu (Linux): you can install all of these usingapt-get install
build-essential
cmake
ninja-build
python
gcc-arm-none-eabi
libnewlib-arm-none-eabi
macOS
command xcode-select–install
brew install make
brew install cmake
brew install ninja
brew install python
brew install armmbed/formulae/arm-none-eabi-gcc
Windows
Not yet supported
Compiling for STM32:
Ubuntu (Linux): you can install all of these usingapt-get install
gcc-arm-none-eabi
libnewlib-arm-none-eabi
build-essential
ninja-build
python
macOS
command xcode-select–install
brew install make
brew install ninja
brew install python
brew install armmbed/formulae/arm-none-eabi-gcc
Windows
Not yet supported
Compiling for Ubuntu (Linux): you can install all of these usingapt-get install
build-essential
libffi-dev
pkg-config
cmake
ninja-build
gnome-desktop-testing
libasound2-dev
libpulse-dev
libaudio-dev
libjack-dev
libsndio-dev
libx11-dev
libxext-dev
libxrandr-dev
libxcursor-dev
libxfixes-dev
libxi-dev
libxss-dev
libxkbcommon-dev
libdrm-dev
libgbm-dev
libgl1-mesa-dev
libgles2-mesa-dev
libegl1-mesa-dev
libdbus-1-dev
libibus-1.0-dev
libudev-dev
fcitx-libs-dev
libpipewire-0.3-dev
libwayland-dev
libdecor-0-dev
Compiling for macOS
command xcode-select–install
brew install libffi
brew install ninja
brew install make
Compiling for Windows
not supported yet
Build Target
You are also going to need Python >= 3.10 installed for all builds
There is a single entry point for all builds. That is the make.py script in theroot of the repository.
The first argument is positional and it must be one of the following.
esp32
windows
macOS
stm32
unix
rp2
renesas-ra
nrf
mimxrt
samd
Build Options
The next few arguments are optional to some degree.
submodules**: collects all needed dependencies to perform the build
clean: cleans the build environment
mpy_cross**: compiles mpy-crossthis is not used for all builds. if it is not supported it will do nothing.
**must be run only one time when the build is intially started. after that you will not needto add these arguments. There is internal checking that is done to see if the argument needs tobe carried out. So you can also optionally leave it there if you want.
Identifying the MCU board
The next group of options are going to be port specific, some may have them and some may not.
BOARD: The MCU to build for. This follows the same symantics as what MIcroPython uses.
BOARD_VARIANT: if there is a variation of the board that it to be compiled for.
I will go into specifics for what what boards and variants are available for a specific port alittle bit further down.
Additional Arguments
LV_CFLAGS: additional compiler flags that get passed to the LVGL build only.
FROZEN_MANIFEST: path to a custom frozen manifest file
DISPLAY: this can either be the file name (less the .py) of a displaydriver that is in the driver/display folder or it can be the absolutepath to your own custom driver (with the .py extension)
INDEV: this can either be the file name (less the .py) of an indevdriver that is in the driver/indev folder or it can be the absolutepath to your own custom driver (with the .py extension)
ESP32 specific options
--skip-partition-resize: do not resize the firmware partition
--partition-size: set a custom firmware partition size
--octal-flash ¹: This is only available for the 16mb flash and the 32mb flash
--flash-size ² ³: This is how much flash storage is available.
Allowed Values are:
ESP32-S3: 4, 8, 16 and 32 (default is 8)
ESP32-S2: 2 and 4 (default is 4)
ESP32: 4, 8 and 16 (default is 4), The default is 8.
¹ Available for the ESP32-S3 whenBOARD_VARIANT is set toSPIRAM_OCT ² Available for the ESP32, ESP32-S2 and ESP32-S3 ³ Available only whenBOARD_VARIANT is set toSPIRAM orSPIRAM_OCT
I always recommend building with the clean command, this will ensure you get a good fresh build.
NOTE:There is a bug in the ESP32 build. The first time around it will fail saying thatone of the sumbodules is not available. Run the build again with the submodulesargument in there and then it will build fine. For the life of me I cam not able to locatewhere the issue is stemming from. I will find it eventually.
I will provide directions on how to use the driver framework and also the drivers that are includedwith the binding in the coming weeks.
SDL fpr Unix is working properly. Make sure you review the requirements needed to compile for unix!!!The build system compiles the latest version of SDL2 so the list is pretty long for the requirements.
I recommend making 2 frame buffers as seen in the code example below. This will give youbetter performance.
DO NOT enable LV_USE_DRAW_SDL, I have not written code to allow for it's use (yet).
I recommend runninglv.task_handler once every 5 milliseconds, shorter than that and youwill have a lot of CPU time comsumed. Linger than that and your mouse response is notgoing to be great.
Here is some example code for the unix port
from micropython import const # NOQA_WIDTH = const(480)_HEIGHT = const(320)_BUFFER_SIZE = _WIDTH * _HEIGHT * 3import lcd_bus # NOQAbus = lcd_bus.SDLBus(flags=0)buf1 = bus.allocate_framebuffer(_BUFFER_SIZE, 0)buf2 = bus.allocate_framebuffer(_BUFFER_SIZE, 0)import lvgl as lv # NOQAimport sdl_display # NOQAlv.init()display = sdl_display.SDLDisplay( data_bus=bus, display_width=_WIDTH, display_height=_HEIGHT, frame_buffer1=buf1, frame_buffer2=buf2, color_space=lv.COLOR_FORMAT.RGB888)display.init()import sdl_pointermouse = sdl_pointer.SDLPointer()scrn = lv.screen_active()scrn.set_style_bg_color(lv.color_hex(0x000000), 0)slider = lv.slider(scrn)slider.set_size(300, 25)slider.center()import task_handler# the duration needs to be set to 5 to have a good response from the mouse.# There is a thread that runs that facilitates double buffering. th = task_handler.TaskHandler(duration=5)
Thank again and enjoy!!
About
LVGL module for MicroPython, customized for MicroPythonOS