• Stars
    star
    676
  • Rank 66,790 (Top 2 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 4 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

LVGL bindings for Rust. A powerful and easy-to-use embedded GUI with many widgets, advanced visual effects (opacity, antialiasing, animations) and low memory requirements (16K RAM, 64K Flash).

LVGL - Open-source Embedded GUI Library in Rust

Original LVGL demo image

LVGL provides everything you need to create a Graphical User Interface (GUI) on embedded systems with easy-to-use graphical elements, beautiful visual effects and low memory footprint.

LVGL is compatible with #![no_std] environments by default.

Rust to WASM demo ยท Official LVGL Website ยท C library repository ยท Official live demos


Rust bindings usage demo code.

System Build Dependencies

In order to build the lvgl project you will need the following system dependencies to be installed:

$ sudo apt install build-essential llvm clang

If you want to build the examples, then you will need to install SDL2 as well.

$ sudo apt install libsdl2-dev

Usage

Edit your Cargo.toml file dependencies with:

$ cargo add lvgl

The build requires the environment variable bellow to be set:

  • DEP_LV_CONFIG_PATH: Path to the directory containing the lv_conf.h header file used for configuration of LVGL library.
  • (Optional) LVGL_FONTS_DIR: Directory for custom fonts generated for use in LVGL. See the documentation for usage.
  • (Optional) LVGL_INCLUDE: C headers to include during the build if using the drivers feature, comma-separated. The default is /usr/include,/usr/local/include.
  • (Optional) LVGL_LINK: C libraries to link in during the build if using the drivers feature, comma-separated. The default is SDL2.

We recommend the lv_conf.h file to be in your project's root directory. If so, the command to build your project would be:

$ DEP_LV_CONFIG_PATH=`pwd` cargo build

Building for embedded environments

We make use of bindgen for generating the bindings to LittlevGL at build time. There is a problem in cargo when building for no_std, so we need to use a workaround to build "lvgl-rs". The mainstrem issue in cargo is being tracked at rust-lang/cargo#7915.

$ DEP_LV_CONFIG_PATH=`pwd` cargo build -Zfeatures=build_dep

The unsafe_no_autoinit feature must also be enabled when building for baremetal targets. See its documentation in Cargo.toml for notes on usage.

LVGL Global Allocator

A global allocator for Rust leveraging the LVGL memory allocator is provided, but not enabled by default. Can be enabled by the feature lvgl_alloc. This will make all dynamic memory to be allocated by LVGL internal memory manager.

Running the demo

Hint for macOS users: Before you run the demos you need to make sure you have libsdl installed on your machine. To install it, use HomeBrew:

$ brew install sdl2

This project contains examples that can run in a desktop simulator.

First, make sure to pull lvgl-rs submodules:

$ git submodule init
$ git submodule update 

Then run the demo example:

$ DEP_LV_CONFIG_PATH=`pwd`/examples/include cargo run --example demo --features="alloc"

Feature Support

The bindings are still in development. There are many features of LVGL that needs to be exposed by lvgl-rs. In this section you can check what is implemented at the moment.

Features

List of LVGL features that impacts the library usage in general.

  • Displays: We use embedded_graphics library to draw to the display, along with lv_drivers. You can use lvgl-rs with any of the embedded_graphics supported displays, and those supported by lv_drivers. Note: lv_drivers support is currently experimental.
  • Events: You can listen and trigger events in widget objects.
  • Styles: You can set styles in any exposed object. We are still missing the possibility of defining global base styles.
  • Input Devices: Input devices supported by lv_drivers can be used, and custom handlers can be specified for embedded_graphics. Currently, only pointer input devices are supported. Note: lv_drivers support is currently experimental.
  • Fonts: All fonts built-in to LVGL can be used on nightly Rust if the nightly feature is enabled. Custom fonts can also be encoded into a C file (see the documentation on the font module).
  • Animations: Creating basic animations is supported entirely from Rust.
  • Images
  • File system
  • Tasks

Widgets

Widgets currently implemented might have some missing features. If the widget you want to use is not exposed or is missing a feature you want to make use, please send a Pull Request or open an issue.

SWUbanner

More Repositories

1

lvgl

Embedded graphics library to create beautiful UIs for any MCU, MPU and display type.
C
16,168
star
2

lv_port_esp32

LVGL ported to ESP32 including various display and touchpad drivers
C
1,011
star
3

lv_port_pc_visual_studio

Visual Studio projects for LVGL embedded graphics library. Recommended on Windows. Linux support with Wayland is work in progress.
C
572
star
4

lv_demos

Examples, tutorials and applications for the LVGL embedded GUI library
C
480
star
5

lvgl_esp32_drivers

Drivers for ESP32 to be used with LVGL
C
321
star
6

lv_drivers

TFT and touch pad drivers for LVGL embedded GUI library
C
295
star
7

lv_binding_micropython

LVGL binding for MicroPython
C
250
star
8

lv_port_pc_vscode

C
244
star
9

lv_platformio

PlatformIO project example for LVGL
C
241
star
10

lv_port_linux

LVGL configured to work with a standard Linux framebuffer
C
237
star
11

lv_port_pc_eclipse

PC simulator project for LVGL embedded GUI Library. Recommended on Linux and Mac.
C
235
star
12

lv_font_conv

Converts TTF/WOFF fonts to compact bitmap format
JavaScript
175
star
13

lv_arduino

LVGL as Arduino Library + example sketch
C
147
star
14

lv_port_win_codeblocks

Windows PC simulator project for LVGL embedded GUI Library
C
145
star
15

lv_binding_js

React bindings for LVGL โš›๏ธ
C++
141
star
16

lv_port_windows

LVGL ported to Windows
C
83
star
17

lv_img_conv

Image converter for LVGL, written in JS
TypeScript
72
star
18

lv_port_stm32f429_disco

LVGL ported to STM32F429I-DISC1 using SW4STM32 (Ac6) IDE
C
71
star
19

lv_lib_png

PNG decoder for LVGL
C
60
star
20

lv_i18n

Internationalization (i18n) for LVGL
JavaScript
58
star
21

lv_web_emscripten

LVGL ported to Emscripten to be converted to JavaScript
C
55
star
22

lv_port_stm32f746_disco

LVGL ported to STM32F746G-DISCO using STM32CubeIDE
C
50
star
23

lv_lib_qrcode

QR code generation with LVGL
C
50
star
24

lv_utils

Convert images or system fonts to C arrays. Written for LVGL embedded GUI library
PHP
49
star
25

lv_lib_freetype

Interface to FreeType to generate font bitmaps run time
C
47
star
26

lv_binding_cpp

[WIP] C++ binding for LVGL
C++
45
star
27

docs_old

DEPRECATED: Documentation for LVGL is now located in the main repository: https://github.com/lvgl/lvgl
HTML
42
star
28

lv_fs_if

LVGL interfaces to various file systems (PC, FatFS)
C
40
star
29

lv_lib_split_jpg

JPG decoder for LVGL
C
32
star
30

lv_lib_gif

GIF library for LVGL
C
32
star
31

lv_lib_rlottie

Lottie animation support for LVGL
C
29
star
32

lv_port_stm32f769_disco

LVGL ported to STM32F769 Discovery using CubeIDE
C
26
star
33

lv_gui_builder

[WIP] Drag end drop GUI designer for LVGL
24
star
34

lv_lib_tinygl

EXPERIMENTAL - 3D extension for lvgl using TinyGL
C
21
star
35

lv_port_raspberry_pi_pico_mdk

An MDK template for Raspberry Pi Pico + LVGL
C
19
star
36

blog

Post, News and Tutorials about LVGL embedded GUI library
C
19
star
37

lv_port_stm32f469_disco

LVGL ported to STM32F469 Discovery using SWSTM32 (Ac6) IDE
C
14
star
38

lv_lib_bmp

BMP decoder library for LVGL
C
12
star
39

lv_binding_pikascript

C
11
star
40

lv_port_stm32h7b3i_disco

This repository contains the Light and Versatile Graphics Library (LVGL) port for the STM32H7B3I-DK development board.
C
11
star
41

lv_port_stm32h745i_disco

LVGL ported to STM32H745I DISCO
C
11
star
42

lv_apps

Ready to use UIs and high level components for applications
C
10
star
43

lv_port_maixduino

Maixduino GUI project with LVGL
C
10
star
44

docs

Meta repository for compiled documentation. Do not send PRs here - they will be closed. The Markdown files are now located in the main repository: https://github.com/lvgl/lvgl
HTML
10
star
45

lvgl-project-creator

Create LVGL projects quickly and easily
Python
9
star
46

sim

Meta repository for online LVGL simulators
JavaScript
8
star
47

lv_port_xilinx_zedboard_vitis

This repository contains a template AMP project for the Zedboard using VGA, FreeRTOS, LVGL and USB peripherals
C
8
star
48

lv_port_aurix

LVGL ported to Aurix TFT board
C
7
star
49

lv_port_an547_cm55_sim

A LVGL porting for Cortex-M55 running on an Arm official FPGA prototyping development board called MPS3 (AN547), see Figure 1. It is also possible to run the project template on an emulator called Corstone-300-FVP, which is free. Topics Resources
C
7
star
50

lv_port_stm_nucleo_g071rb

LVGL ported to ST's NUCLEO G071RB board
C
3
star
51

lv_binding_berry

Binding to Berry language
C
3
star
52

lv_port_stm32f746_disco_atollic

DEPRECATED: LittlevGL ported to STM32F746G-DISCO using Atollic IDE
C
2
star
53

template

Template repo with README and CI settings
2
star
54

markup_temporary

Temporary repository to evaluate the markup language support
1
star
55

pic32mx_r61581_no_os

LittlevGL ported to PIC32MX with R61581 display controller
C
1
star