Rust bindings API review #51
|
@ -14,11 +14,10 @@ build = "build.rs"
|
|||
[dependencies]
|
||||
lvgl-sys = { version = "0.5.2", path = "../lvgl-sys" }
|
||||
cty = "0.2.1"
|
||||
embedded-graphics = { version = "0.6.2", optional = true }
|
||||
cstr_core = "0.2.3"
|
||||
bitflags = "1.2.1"
|
||||
parking_lot = "0.11.1"
|
||||
heapless = "0.7.1"
|
||||
embedded-graphics = { version = "0.6.2", optional = true }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
|
|
@ -64,14 +64,14 @@ impl DefaultDisplay {
|
|||
I use a I use a `Mutex` here, to satisfy the Rust guarantees. But maybe it is not necessary... some food for thought.
TODO: Remove this code duplication. TODO: Remove this code duplication.
I use a I use a `Mutex` here, to satisfy the Rust guarantees. But maybe it is not necessary... some food for thought.
|
||||
|
||||
pub struct DrawBuffer<const N: usize> {
|
||||
initialized: RunOnce,
|
||||
refresh_buffer: Mutex<RefCell<heapless::Vec<lvgl_sys::lv_color_t, N>>>,
|
||||
TODO: Remove this code duplication. TODO: Remove this code duplication.
I use a I use a `Mutex` here, to satisfy the Rust guarantees. But maybe it is not necessary... some food for thought.
|
||||
refresh_buffer: Mutex<RefCell<[MaybeUninit<lvgl_sys::lv_color_t>; N]>>,
|
||||
TODO: Remove this code duplication. TODO: Remove this code duplication.
I use a I use a `Mutex` here, to satisfy the Rust guarantees. But maybe it is not necessary... some food for thought.
I'm using a Mutex here just to make this I'm using a Mutex here just to make this `Sync`, not sure if there is a way to remove it but still keep the memory statically allocated.
|
||||
}
|
||||
|
||||
impl<const N: usize> DrawBuffer<N> {
|
||||
pub const fn new() -> Self {
|
||||
Self {
|
||||
initialized: RunOnce::new(),
|
||||
refresh_buffer: const_mutex(RefCell::new(heapless::Vec::new())),
|
||||
TODO: Remove this code duplication. TODO: Remove this code duplication.
I use a I use a `Mutex` here, to satisfy the Rust guarantees. But maybe it is not necessary... some food for thought.
|
||||
refresh_buffer: const_mutex(RefCell::new([MaybeUninit::uninit(); N])),
|
||||
TODO: Remove this code duplication. TODO: Remove this code duplication.
I use a I use a `Mutex` here, to satisfy the Rust guarantees. But maybe it is not necessary... some food for thought.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|||
TODO: Remove this code duplication. TODO: Remove this code duplication.
I use a I use a `Mutex` here, to satisfy the Rust guarantees. But maybe it is not necessary... some food for thought.
TODO: Remove this code duplication. TODO: Remove this code duplication.
I use a I use a `Mutex` here, to satisfy the Rust guarantees. But maybe it is not necessary... some food for thought.
|
TODO: Remove this code duplication.