lvgl / lv_binding_rust

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).
MIT License
687 stars 71 forks source link

Generate code for most of the widgets #20

Closed rafaelcaricio closed 4 years ago

rafaelcaricio commented 4 years ago

This PR sets a foundation on how we can generate most of the safe Rust code from the C99 API. After discovering code patterns by manually implementing some parts of the API bindings in Rust, we can generalise the pattern and generate code for all the other places where the pattern is identified.

Initially, I'm focusing on generating code for the widgets. I use the lvgl-codegen package as a tool to generate code at compile time. Maybe a good option to move to procedural macros, but we need to work around the bindgen conflict on trying to instantiate Clang object in different threads.