Update display label in demo app
This commit is contained in:
parent
bd91097ecd
commit
7bf1ac0cae
1 changed files with 10 additions and 4 deletions
|
@ -103,8 +103,9 @@ fn main() -> Result<(), String> {
|
||||||
power.set_align(&mut screen, lvgl::Align::InTopRight, 0, 0);
|
power.set_align(&mut screen, lvgl::Align::InTopRight, 0, 0);
|
||||||
|
|
||||||
let mut event_pump = sdl_context.event_pump()?;
|
let mut event_pump = sdl_context.event_pump()?;
|
||||||
|
let mut i = 0;
|
||||||
'running: loop {
|
'running: loop {
|
||||||
for event in event_pump.poll_iter() {
|
if let Some(event) = event_pump.poll_event() {
|
||||||
match event {
|
match event {
|
||||||
Event::Quit { .. }
|
Event::Quit { .. }
|
||||||
| Event::KeyDown {
|
| Event::KeyDown {
|
||||||
|
@ -117,12 +118,17 @@ fn main() -> Result<(), String> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
::std::thread::sleep(Duration::from_millis(
|
if i > 59 {
|
||||||
lvgl_sys::LV_DISP_DEF_REFR_PERIOD as u64,
|
i = 0;
|
||||||
));
|
}
|
||||||
|
time.set_text(format!("21:{:02}\0", i).as_str());
|
||||||
|
i = 1 + i;
|
||||||
|
|
||||||
|
::std::thread::sleep(Duration::from_millis(10));
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
lvgl_sys::lv_task_handler();
|
lvgl_sys::lv_task_handler();
|
||||||
|
lvgl_sys::lv_tick_inc(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue