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.
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 thelv_conf.hheader 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 buildWe 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_depLittlevGL 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.
This project contains examples that can run in a desktop simulator.
To run the demo example:
$ DEP_LV_CONFIG_PATH=`pwd`/examples/include cargo run --example demo