Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
env:
CARGO_TERM_COLOR: always
DEP_LV_CONFIG_PATH: /home/runner/work/lvgl-rs/lvgl-rs/examples/include
LVGL_INCLUDE: /usr/include,/usr/local/include
LVGL_LINK: SDL2

jobs:
build:
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[submodule "lvgl-sys/vendor/lvgl"]
path = lvgl-sys/vendor/lvgl
url = https://github.com/lvgl/lvgl.git

[submodule "lvgl-sys/vendor/lv_drivers"]
path = lvgl-sys/vendor/lv_drivers
url = https://github.com/lvgl/lv_drivers.git
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,15 @@ this section you can check what is implemented at the moment.

List of LVGL features that impacts the library usage in general.
- [x] Displays: We use [`embedded_graphics`](https://docs.rs/embedded-graphics/0.6.2/embedded_graphics/) library to
draw to the display. You can use `lvgl-rs` with any of the
[`embedded_graphics` supported displays](https://docs.rs/embedded-graphics/0.6.2/embedded_graphics/#supported-displays).
draw to the display, along with [`lv_drivers`](https://github.com/lvgl/lv_drivers). You can
use `lvgl-rs` with any of the [`embedded_graphics`](https://docs.rs/embedded-graphics/0.6.2/embedded_graphics/#supported-displays) supported
displays, and those supported by [`lv_drivers`](https://github.com/lvgl/lv_drivers).
**Note:** [`lv_drivers`](https://github.com/lvgl/lv_drivers) support is currently experimental.
- [x] Events: You can listen and trigger events in widget objects.
- [x] Styles: You can set styles in any exposed object. We are still missing the possibility of defining global base styles.
- [ ] Input Devices
- [x] Input Devices: Input devices supported by [`lv_drivers`](https://github.com/lvgl/lv_drivers)
can be used.
**Note:** [`lv_drivers`](https://github.com/lvgl/lv_drivers) support is currently experimental.
- [ ] Fonts
- [ ] Images
- [ ] File system
Expand Down
2 changes: 0 additions & 2 deletions examples/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,4 @@ fn main() {
.unwrap();
})
.unwrap();

let label: Label = "Nice!".into();
}
6 changes: 5 additions & 1 deletion examples/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use lvgl::widgets::{Arc, Label};
use lvgl::{Align, Color, Display, DrawBuffer, LvError, Part, Widget};
use lvgl_sys;
use std::time::Duration;
use std::time::Instant;
use std::thread::sleep;

fn mem_info() -> lvgl_sys::lv_mem_monitor_t {
let mut info = lvgl_sys::lv_mem_monitor_t {
Expand Down Expand Up @@ -74,6 +76,7 @@ fn main() -> Result<(), LvError> {
let mut i = 0;

'running: loop {
let start = Instant::now();
if i > 270 {
forward = if forward { false } else { true };
i = 1;
Expand All @@ -92,7 +95,8 @@ fn main() -> Result<(), LvError> {
_ => {}
}
}
lvgl::tick_inc(Duration::from_millis(15));
sleep(Duration::from_millis(15));
lvgl::tick_inc(Instant::now().duration_since(start));
}
println!("meminfo end: {:?}", mem_info());

Expand Down
7 changes: 5 additions & 2 deletions examples/bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use lvgl::widgets::{Bar, Label};
use lvgl::{Align, Animation, Color, Display, DrawBuffer, Event, LvError, Part, Widget};
use std::cell::RefCell;
use std::time::Duration;
use std::time::Instant;
use std::thread::sleep;

fn main() -> Result<(), LvError> {
const HOR_RES: u32 = 240;
Expand Down Expand Up @@ -64,6 +66,7 @@ fn main() -> Result<(), LvError> {

let mut i = 0;
'running: loop {
let start = Instant::now();
if i > 100 {
i = 0;
lvgl::event_send(&mut bar, Event::Clicked)?;
Expand All @@ -80,8 +83,8 @@ fn main() -> Result<(), LvError> {
_ => {}
}
}

lvgl::tick_inc(Duration::from_millis(10));
sleep(Duration::from_millis(15));
lvgl::tick_inc(Instant::now().duration_since(start));
}

Ok(())
Expand Down
6 changes: 5 additions & 1 deletion examples/button_click.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ use lvgl::style::Style;
use lvgl::widgets::{Btn, Label};
use lvgl::{Align, Color, Display, DrawBuffer, LvError, Part, Widget};
use std::time::Duration;
use std::time::Instant;
use std::thread::sleep;

#[allow(unused_assignments)]
fn main() -> Result<(), LvError> {
Expand Down Expand Up @@ -71,6 +73,7 @@ fn main() -> Result<(), LvError> {

let mut latest_touch_point = Point::new(0, 0);
'running: loop {
let start = Instant::now();
lvgl::task_handler();
window.update(&sim_display);

Expand All @@ -97,7 +100,8 @@ fn main() -> Result<(), LvError> {
_ => {}
}
}
lvgl::tick_inc(Duration::from_millis(15));
sleep(Duration::from_millis(15));
lvgl::tick_inc(Instant::now().duration_since(start));
}

Ok(())
Expand Down
6 changes: 4 additions & 2 deletions examples/demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use lvgl::{Align, Color, Display, DrawBuffer, LvError, Part, TextAlign, Widget};
use lvgl_sys;
use std::thread::sleep;
use std::time::Duration;
use std::time::Instant;

fn main() -> Result<(), LvError> {
const HOR_RES: u32 = 240;
Expand Down Expand Up @@ -53,7 +54,7 @@ fn main() -> Result<(), LvError> {
style_time.set_text_align(TextAlign::Center);
// Need to set font too
time.add_style(Part::Main, &mut style_time)?;
time.set_align(Align::Center, 0, 0)?;
time.set_align(Align::Center, 0, 100)?;
time.set_width(240)?;
time.set_height(240)?;

Expand All @@ -71,6 +72,7 @@ fn main() -> Result<(), LvError> {

let mut i = 0;
'running: loop {
let start = Instant::now();
if i > 59 {
i = 0;
}
Expand All @@ -89,7 +91,7 @@ fn main() -> Result<(), LvError> {
}
//println!("During run: {:?}", mem_info());
sleep(Duration::from_secs(1));
lvgl::tick_inc(Duration::from_secs(1));
lvgl::tick_inc(Instant::now().duration_since(start));
}

//println!("Final part of demo app: {:?}", mem_info());
Expand Down
4 changes: 2 additions & 2 deletions examples/include/lv_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
*-----------*/

/*Enable the log module*/
#define LV_USE_LOG 0
#define LV_USE_LOG 1
#if LV_USE_LOG

/*How important log should be added:
Expand All @@ -232,7 +232,7 @@
*LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
*LV_LOG_LEVEL_USER Only logs added by the user
*LV_LOG_LEVEL_NONE Do not log anything*/
#define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
#define LV_LOG_LEVEL LV_LOG_LEVEL_INFO

/*1: Print the log with 'printf';
*0: User need to register a callback with `lv_log_register_print_cb()`*/
Expand Down
Loading