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).
In light of #24 it might be a good idea to allow for common bolierplate-y things like LVGL initialization, task/timer handler updates, etc. to be abstracted away. My idea is doing something like:
/* use ... */
static shared_native_display: RefCell<SimulatorDisplay<ColorSpace>> =
RefCell::new(SimulatorDisplay::new(Size::new(240 as u32, 240 as u32)));
fn disp_handler<N>(refresh: &DisplayRefresh<N>) {
shared_native_display.borrow_mut().draw_iter(refresh.as_pixels()).unwrap();
}
#[lvgl_main]
fn main() {
let output_settings = OutputSettingsBuilder::new().scale(2).build();
let mut window = Window::new("Macro Example", &output_settings);
#[lvgl_display(hor = 240, ver = 240, handler = disp_handler)]
let display;
let screen = display.get_scr_act()?
/* Styling, widgets. etc */
#[lvgl_event_loop(frame_time = 16)]
'running: loop {
/* GUI logic */
}
}
More could certainly be done (interesting ideas might include attribute macros for widgets as well, to be able to specify e.g. event handlers) but this might be a start.
In light of #24 it might be a good idea to allow for common bolierplate-y things like LVGL initialization, task/timer handler updates, etc. to be abstracted away. My idea is doing something like:
More could certainly be done (interesting ideas might include attribute macros for widgets as well, to be able to specify e.g. event handlers) but this might be a start.
Is this something worth working on?