{"id":18301380,"url":"https://github.com/lvgl/lv_binding_rust","last_synced_at":"2025-04-13T07:49:27.548Z","repository":{"id":39995636,"uuid":"254635469","full_name":"lvgl/lv_binding_rust","owner":"lvgl","description":"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). ","archived":false,"fork":false,"pushed_at":"2025-01-22T22:16:16.000Z","size":1587,"stargazers_count":769,"open_issues_count":48,"forks_count":80,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-13T07:49:24.897Z","etag":null,"topics":["embedded","graphics","gui","lvgl","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lvgl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-10T13:00:20.000Z","updated_at":"2025-04-12T15:26:08.000Z","dependencies_parsed_at":"2024-01-23T22:08:22.902Z","dependency_job_id":"d5d303bc-0682-44c4-886e-100b2633520f","html_url":"https://github.com/lvgl/lv_binding_rust","commit_stats":null,"previous_names":["rafaelcaricio/lvgl-rs"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lvgl%2Flv_binding_rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lvgl%2Flv_binding_rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lvgl%2Flv_binding_rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lvgl%2Flv_binding_rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lvgl","download_url":"https://codeload.github.com/lvgl/lv_binding_rust/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248681494,"owners_count":21144700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["embedded","graphics","gui","lvgl","rust"],"created_at":"2024-11-05T15:15:48.490Z","updated_at":"2025-04-13T07:49:27.501Z","avatar_url":"https://github.com/lvgl.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e LVGL - Open-source Embedded GUI Library in Rust\u003c/h1\u003e\n\n![Original LVGL demo image](lv_demo.png)\n\n\u003cp align=\"center\"\u003e\nLVGL 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. \n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\nLVGL is compatible with \u003csamp\u003e#![no_std]\u003c/samp\u003e environments by default.\n\u003c/p\u003e\n\n\u003ch4 align=\"center\"\u003e\n\u003ca href=\"https://github.com/rafaelcaricio/lvgl-rs-wasm\"\u003eRust to WASM demo\u003c/a\u003e \u0026middot;\n\u003ca href=\"https://lvgl.io/\"\u003eOfficial LVGL Website \u003c/a\u003e \u0026middot;\n\u003ca href=\"https://github.com/littlevgl/lvgl\"\u003eC library repository\u003c/a\u003e \u0026middot;\n\u003ca href=\"https://lvgl.io/demos\"\u003eOfficial live demos\u003c/a\u003e\n\u003c/h4\u003e\n\n---\n\n![Rust bindings usage demo code.](demo.png)\n\n## System Build Dependencies\n\nIn order to build the `lvgl` project you will need the following system dependencies to be installed:\n\n```\n$ sudo apt install build-essential llvm clang\n```\n\nIf you want to build the examples, then you will need to install SDL2 as well.\n\n```\n$ sudo apt install libsdl2-dev\n```\n\n## Usage\n\nEdit your `Cargo.toml` file dependencies with:\n```\n$ cargo add lvgl\n```\n\nThe build requires the environment variable bellow to be set:\n\n- `DEP_LV_CONFIG_PATH`: Path to the directory containing the `lv_conf.h` header file used for configuration of LVGL library.\n- (Optional) `LVGL_FONTS_DIR`: Directory for custom fonts generated for use in LVGL. See the documentation for usage.\n- (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`.\n- (Optional) `LVGL_LINK`: C libraries to link in during the build if using the `drivers` feature, comma-separated. The default is `SDL2`.\n\nWe recommend the `lv_conf.h` file to be in your project's root directory. If so, the command to build your project would be:\n```shell script\n$ DEP_LV_CONFIG_PATH=`pwd` cargo build\n```\n\n### Building for embedded environments\n\nWe make use of `bindgen` for generating the bindings to LittlevGL at build time. There is a problem in cargo when building\nfor `no_std`, so we need to use a workaround to build \"lvgl-rs\". The mainstrem issue in cargo is being tracked at\n[rust-lang/cargo#7915](https://github.com/rust-lang/cargo/issues/7915).\n\n```shell\nDEP_LV_CONFIG_PATH=`pwd` cargo build -Z features=build_dep\n```\n\nThe `unsafe_no_autoinit` feature must also be enabled when building for baremetal targets. See its documentation in `Cargo.toml` for notes on usage.\n### LVGL Global Allocator\n\nA [global allocator](https://doc.rust-lang.org/std/alloc/trait.GlobalAlloc.html) for Rust leveraging the\n[LVGL memory allocator](https://github.com/lvgl/lvgl/blob/master/src/misc/lv_mem.h) is provided, but not enabled \nby default. Can be enabled by the feature `lvgl_alloc`. This will make all dynamic memory to be allocated by LVGL \ninternal memory manager.\n\n## Running the demo\n\n**Hint for macOS users**: Before you run the demos you need to make sure you have [libsdl](https://www.libsdl.org)\ninstalled on your machine. To install it, use HomeBrew:\n\n```shell\n$ brew install sdl2\n```\n\n[This project contains examples that can run in a desktop simulator.](./examples)\n\nFirst, make sure to pull `lvgl-rs` submodules:\n```shell\n$ git submodule init\n$ git submodule update \n```\n\nThen run the `demo` example:\n\n```shell\n$ DEP_LV_CONFIG_PATH=`pwd`/examples/include cargo run --example demo --features=\"alloc\"\n```\n\n## Feature Support\n\nThe bindings are still in development. There are many features of LVGL that needs to be exposed by `lvgl-rs`. In\nthis section you can check what is implemented at the moment.\n\nUnsafe bindings are located in `lvgl-sys` folder are generated via `bindgen`.\n\nSafe bindings are generated using the `lvgl-codegen` lib, which takes the raw unsafe bindings and generate safe/rust idiomatic bindings (check the `build.rs` script in the `lvgl` folder).\n\n### Features\n\nList of LVGL features that impacts the library usage in general.\n- [x] Displays: We use [`embedded_graphics`](https://docs.rs/embedded-graphics/0.6.2/embedded_graphics/) library to\n      draw to the display, along with [`lv_drivers`](https://github.com/lvgl/lv_drivers). You can\n      use `lvgl-rs` with any of the [`embedded_graphics`](https://docs.rs/embedded-graphics/0.6.2/embedded_graphics/#supported-displays) supported\n      displays, and those supported by [`lv_drivers`](https://github.com/lvgl/lv_drivers).\n      **Note:** [`lv_drivers`](https://github.com/lvgl/lv_drivers) support is currently experimental.\n- [x] Events: You can listen and trigger events in widget objects.\n- [x] Styles: You can set styles in any exposed object. We are still missing the possibility of defining global base styles.\n- [x] Input Devices: Input devices supported by [`lv_drivers`](https://github.com/lvgl/lv_drivers)\n      can be used, and custom handlers can be specified for [`embedded_graphics`](https://docs.rs/embedded-graphics/0.6.2/embedded_graphics/). Currently, only pointer input devices are supported.\n      **Note:** [`lv_drivers`](https://github.com/lvgl/lv_drivers) support is currently experimental.\n- [x] 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).\n- [x] Animations: Creating basic animations is supported entirely from Rust.\n- [ ] Images\n- [ ] File system\n- [ ] Tasks\n\n### Widgets\n\nWidgets currently implemented might have some missing features. If the widget you want to use is not exposed or\nis missing a feature you want to make use, please send a Pull Request or open an issue.\n\n### Troubleshooting\n\nHere's a list of known issues that can be faced when using this repo:\n\n- [Enum alignment issues](https://github.com/lvgl/lv_binding_rust/issues/163)\n\n\n[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flvgl%2Flv_binding_rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flvgl%2Flv_binding_rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flvgl%2Flv_binding_rust/lists"}