Code Monkey home page Code Monkey logo

lvgl-rs's Introduction

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

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

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. 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 global base styles.
  • Input Devices
  • Fonts
  • Images
  • File system
  • Animations
  • 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.

lvgl-rs's People

Contributors

rafaelcaricio avatar jakubclark avatar justinmoon avatar rwbr avatar spadi0 avatar rtwfroody avatar harksin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.