Remove direct dependencies
This commit is contained in:
parent
e68275a7c8
commit
82a0b4b2ef
7 changed files with 19 additions and 29 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -9,3 +9,5 @@ Cargo.lock
|
|||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
.idea/
|
||||
examples/demo/target/
|
||||
lvgl/target/
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
[workspace]
|
||||
members = [
|
||||
"lvgl-sys",
|
||||
"lvgl",
|
||||
"examples/demo",
|
||||
]
|
||||
|
|
@ -8,6 +8,6 @@ publish = false
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
lvgl-sys = { path = "../../lvgl-sys" }
|
||||
lvgl = { path = "../../lvgl" }
|
||||
lvgl-sys = "0.1.0"
|
||||
sdl2 = "0.33.0"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
[package]
|
||||
name = "lvgl"
|
||||
description = "LittlevGL 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)."
|
||||
version = "0.1.0"
|
||||
authors = ["Rafael Caricio <crates.lvgl@caric.io>"]
|
||||
edition = "2018"
|
||||
|
@ -12,5 +13,5 @@ keywords = ["littlevgl", "lvgl", "graphical_interfaces"]
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
lvgl-sys = { path = "../lvgl-sys", version = "0.1.0" }
|
||||
lvgl-sys = "0.1.0"
|
||||
cty = "0.2.1"
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
|
||||
use crate::objx::Object;
|
||||
use core::ptr;
|
||||
|
||||
pub fn get_active_screen() -> Object {
|
||||
let raw = unsafe {
|
||||
ptr::NonNull::new_unchecked(lvgl_sys::lv_disp_get_scr_act(ptr::null_mut()))
|
||||
};
|
||||
let raw =
|
||||
unsafe { ptr::NonNull::new_unchecked(lvgl_sys::lv_disp_get_scr_act(ptr::null_mut())) };
|
||||
Object::new(raw)
|
||||
}
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
#![no_std]
|
||||
|
||||
mod objx;
|
||||
pub mod display;
|
||||
mod objx;
|
||||
|
||||
pub use objx::*;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn it_works() {
|
||||
assert_eq!(2 + 2, 4);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use lvgl_sys;
|
||||
use core::ffi;
|
||||
use core::ptr;
|
||||
use cty;
|
||||
use lvgl_sys;
|
||||
|
||||
pub trait Container {
|
||||
fn raw(&self) -> ptr::NonNull<lvgl_sys::lv_obj_t>;
|
||||
|
@ -19,9 +18,7 @@ impl Object {
|
|||
|
||||
impl Container for Object {
|
||||
fn raw(&self) -> ptr::NonNull<lvgl_sys::lv_obj_t> {
|
||||
unsafe {
|
||||
ptr::NonNull::new_unchecked(self.raw.as_ptr())
|
||||
}
|
||||
unsafe { ptr::NonNull::new_unchecked(self.raw.as_ptr()) }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +38,11 @@ impl Button {
|
|||
|
||||
pub fn set_pos(&mut self, x: u16, y: u16) {
|
||||
unsafe {
|
||||
lvgl_sys::lv_obj_set_pos(self.raw().as_mut(), x as lvgl_sys::lv_coord_t, y as lvgl_sys::lv_coord_t);
|
||||
lvgl_sys::lv_obj_set_pos(
|
||||
self.raw().as_mut(),
|
||||
x as lvgl_sys::lv_coord_t,
|
||||
y as lvgl_sys::lv_coord_t,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +69,10 @@ impl Label {
|
|||
|
||||
pub fn set_text(&mut self, text: &str) {
|
||||
unsafe {
|
||||
lvgl_sys::lv_label_set_text(self.core.raw().as_mut(), text.as_ptr() as *const cty::c_char);
|
||||
lvgl_sys::lv_label_set_text(
|
||||
self.core.raw().as_mut(),
|
||||
text.as_ptr() as *const cty::c_char,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue