mod app; use std::{ thread::sleep, time::{Duration, Instant}, }; use embedded_graphics::pixelcolor::BinaryColor; use embedded_graphics::prelude::*; use g13_driver::G13; use crate::app::App; fn main() -> Result<(), Box> { let mut g13 = G13::new()?; let mut app = App::new(); let events = g13.events(); loop { let start = Instant::now(); if let Ok(event) = events.try_recv() { app.update(event); } g13.clear(BinaryColor::Off)?; if let Err(e) = app.draw(&mut g13) { eprintln!("{:?}", e); } g13.render()?; let elapsed = Instant::now() - start; if elapsed.as_millis() < 33 { sleep(Duration::from_millis(33) - (elapsed)); } } }