2021-05-29 18:03:36 +00:00
|
|
|
use embedded_graphics::pixelcolor::Rgb565;
|
|
|
|
use embedded_graphics::prelude::*;
|
|
|
|
use embedded_graphics_simulator::{OutputSettingsBuilder, SimulatorDisplay, Window};
|
|
|
|
use lvgl;
|
2021-05-30 22:34:12 +00:00
|
|
|
use lvgl::display::Display;
|
2021-06-01 20:08:37 +00:00
|
|
|
use lvgl::widgets::Label;
|
|
|
|
use parking_lot::Mutex;
|
|
|
|
use std::cell::RefCell;
|
|
|
|
use std::sync::Arc;
|
2021-05-29 18:03:36 +00:00
|
|
|
|
|
|
|
type ColorSpace = Rgb565;
|
|
|
|
|
|
|
|
fn main() {
|
2021-05-29 22:51:25 +00:00
|
|
|
let embedded_graphics_display: SimulatorDisplay<ColorSpace> = SimulatorDisplay::new(Size::new(
|
|
|
|
lvgl_sys::LV_HOR_RES_MAX,
|
|
|
|
lvgl_sys::LV_VER_RES_MAX,
|
|
|
|
));
|
2021-05-29 18:03:36 +00:00
|
|
|
|
|
|
|
let output_settings = OutputSettingsBuilder::new().scale(2).build();
|
|
|
|
let mut window = Window::new("App Example", &output_settings);
|
|
|
|
|
2021-06-01 20:08:37 +00:00
|
|
|
let mut shared_native_display = Arc::new(Mutex::new(embedded_graphics_display));
|
|
|
|
|
2021-05-29 18:03:36 +00:00
|
|
|
// LVGL usage
|
|
|
|
lvgl::init();
|
2021-06-01 20:08:37 +00:00
|
|
|
let display = Display::register_shared(&shared_native_display).unwrap();
|
|
|
|
let label = Label::new().unwrap();
|
|
|
|
|
|
|
|
{
|
|
|
|
let mut val = shared_native_display.lock();
|
|
|
|
val.draw_pixel(Pixel::default()).unwrap();
|
|
|
|
}
|
2021-05-29 18:03:36 +00:00
|
|
|
}
|