LittlevGL 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).
Go to file
2020-06-04 20:47:40 +02:00
examples LVGL 7.0.1 basic setup 2020-06-04 20:47:40 +02:00
lvgl Remove some UB 2020-06-02 19:59:41 +02:00
lvgl-sys LVGL 7.0.1 basic setup 2020-06-04 20:47:40 +02:00
.gitignore Don't commit auto-generated code 2020-05-30 16:45:58 +02:00
.gitmodules LVGL 7.0.1 basic setup 2020-06-04 20:47:40 +02:00
Cargo.toml Bar widget (#12) 2020-05-31 09:12:37 +02:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2020-05-31 00:13:57 +02:00
demo.png Sync code with image 2020-05-30 09:42:42 +02:00
LICENSE Initial commit 2020-04-10 15:00:21 +02:00
lv_demo.png Update images and links in README 2020-05-30 09:37:40 +02:00
README.md Rename ObjectX to GenericObject 2020-06-02 19:21:44 +02:00

LittlevGL - Open-source Embedded GUI Library in Rust

Original LittlevGL demo image

LittlevGL 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.

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

Official LittlevGL Website · C library repository · Live demo


Rust bindings usage demo code.

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 LittlevGL library.

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

Requirements / Limitations

LittlevGL C libary do allocate memory dynamically and we need to allocate memory on the heap in the Rust side as well (Box). That is required, so we can safely provide Rust pointers through FFI. For that reason, we do require alloc module to be available.

Running the demo

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

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. You can use lvgl-rs with any of the embedded_graphics supported displays.
  • 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 base styles.
  • Input Devices
  • Fonts
  • Images
  • File system
  • Animations
  • Tasks

Widgets

  • Base object (lv_obj)
  • Arc (lv_arc)
  • Bar (lv_bar)
  • Button (lv_btn)
  • Button matrix (lv_btnm)
  • Calendar (lv_calendar)
  • Canvas (lv_canvas)
  • Checkbox (lv_cb)
  • Chart (lv_chart)
  • Container (lv_cont)
  • Color picker (lv_cpicker)
  • Drop-down list (lv_ddlist)
  • Gauge (lv_gauge)
  • Image (lv_img)
  • Image button (lv_imgbtn)
  • Keyboard (lv_kb)
  • Label (lv_label)
  • LED (lv_led)
  • Line (lv_line)
  • List (lv_list)
  • Line meter (lv_lmeter)
  • Message box (lv_mbox)
  • Page (lv_page)
  • Preloader (lv_preload)
  • Roller (lv_roller)
  • Slider (lv_slider)
  • Spinbox (lv_spinbox)
  • Switch (lv_sw)
  • Table (lv_table)
  • Tabview (lv_tabview)
  • Text area (lv_ta)
  • Tile view (lv_tileview)
  • Window (lv_win)

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.