Add windows support #55

Merged
TheBotlyNoob merged 4 commits from master into master 2022-05-17 20:52:57 +00:00
3 changed files with 13 additions and 13 deletions
Showing only changes of commit 7aa40158d4 - Show all commits

View file

@ -21,4 +21,4 @@ cty = "0.2.1"
[build-dependencies] [build-dependencies]
cc = "1.0.68" cc = "1.0.68"
bindgen = "0.58.1" bindgen = "0.59.2"

View file

@ -14,7 +14,7 @@ build = "build.rs"
[dependencies] [dependencies]
lvgl-sys = { version = "0.5.2", path = "../lvgl-sys" } lvgl-sys = { version = "0.5.2", path = "../lvgl-sys" }
cty = "0.2.1" cty = "0.2.1"
embedded-graphics = "0.6.2" embedded-graphics = "0.7.1"
cstr_core = "0.2.3" cstr_core = "0.2.3"
bitflags = "1.2.1" bitflags = "1.2.1"
@ -29,8 +29,8 @@ lvgl-codegen = { version = "0.5.2", path = "../lvgl-codegen" }
lvgl-sys = { version = "0.5.2", path = "../lvgl-sys" } lvgl-sys = { version = "0.5.2", path = "../lvgl-sys" }
[dev-dependencies] [dev-dependencies]
embedded-graphics-simulator = "0.2.1" embedded-graphics-simulator = "0.3.0"
heapless = "0.5.5" heapless = "0.7.13"
[[example]] [[example]]
name = "demo" name = "demo"

View file

@ -6,9 +6,9 @@ use core::ptr;
use core::ptr::NonNull; use core::ptr::NonNull;
use core::sync::atomic::{AtomicBool, Ordering}; use core::sync::atomic::{AtomicBool, Ordering};
use core::time::Duration; use core::time::Duration;
use embedded_graphics::pixelcolor::PixelColor; use embedded_graphics::draw_target::DrawTarget;
use embedded_graphics::prelude::*; use embedded_graphics::prelude::*;
use embedded_graphics::{drawable, DrawTarget}; use embedded_graphics::{pixelcolor::PixelColor, Pixel};
// There can only be a single reference to LVGL library. // There can only be a single reference to LVGL library.
static LVGL_IN_USE: AtomicBool = AtomicBool::new(false); static LVGL_IN_USE: AtomicBool = AtomicBool::new(false);
@ -20,7 +20,7 @@ pub(crate) const BUF_SIZE: usize = lvgl_sys::LV_HOR_RES_MAX as usize * REFRESH_B
pub struct UI<T, C> pub struct UI<T, C>
where where
T: DrawTarget<C>, T: DrawTarget<Color = C>,
C: PixelColor + From<Color>, C: PixelColor + From<Color>,
{ {
// LVGL is not thread-safe by default. // LVGL is not thread-safe by default.
@ -32,14 +32,14 @@ where
// LVGL does not use thread locals. // LVGL does not use thread locals.
unsafe impl<T, C> Send for UI<T, C> unsafe impl<T, C> Send for UI<T, C>
where where
T: DrawTarget<C>, T: DrawTarget<Color = C>,
C: PixelColor + From<Color>, C: PixelColor + From<Color>,
{ {
} }
impl<T, C> UI<T, C> impl<T, C> UI<T, C>
where where
T: DrawTarget<C>, T: DrawTarget<Color = C>,
C: PixelColor + From<Color>, C: PixelColor + From<Color>,
{ {
pub fn init() -> LvResult<Self> { pub fn init() -> LvResult<Self> {
@ -135,7 +135,7 @@ where
pub(crate) struct DisplayUserData<T, C> pub(crate) struct DisplayUserData<T, C>
where where
T: DrawTarget<C>, T: DrawTarget<Color = C>,
C: PixelColor + From<Color>, C: PixelColor + From<Color>,
{ {
display: T, display: T,
@ -147,7 +147,7 @@ unsafe extern "C" fn display_callback_wrapper<T, C>(
area: *const lvgl_sys::lv_area_t, area: *const lvgl_sys::lv_area_t,
color_p: *mut lvgl_sys::lv_color_t, color_p: *mut lvgl_sys::lv_color_t,
) where ) where
T: DrawTarget<C>, T: DrawTarget<Color = C>,
C: PixelColor + From<Color>, C: PixelColor + From<Color>,
{ {
// In the `std` world we would make sure to capture panics here and make them not escape across // In the `std` world we would make sure to capture panics here and make them not escape across
@ -178,7 +178,7 @@ fn display_flush<T, C>(
color_p: *mut lvgl_sys::lv_color_t, color_p: *mut lvgl_sys::lv_color_t,
) -> Result<(), T::Error> ) -> Result<(), T::Error>
where where
T: DrawTarget<C>, T: DrawTarget<Color = C>,
C: PixelColor + From<Color>, C: PixelColor + From<Color>,
{ {
let ys = y1..=y2; let ys = y1..=y2;
@ -192,7 +192,7 @@ where
let color_len = x_len * iy + ix; let color_len = x_len * iy + ix;
let lv_color = unsafe { *color_p.add(color_len) }; let lv_color = unsafe { *color_p.add(color_len) };
let raw_color = Color::from_raw(lv_color); let raw_color = Color::from_raw(lv_color);
drawable::Pixel(Point::new(x as i32, y as i32), raw_color.into()) Pixel(Point::new(x as i32, y as i32), raw_color.into())
}) })
}); });