diff --git a/firmware/rust/src/lcd.rs b/firmware/rust/src/lcd.rs index f360796..414c954 100644 --- a/firmware/rust/src/lcd.rs +++ b/firmware/rust/src/lcd.rs @@ -1,5 +1,4 @@ use atmega_hal::{ - clock::MHz8, delay::Delay, port::{mode::Output, Pin, PB0, PB1}, Spi, @@ -8,7 +7,7 @@ use core::convert::TryInto; use embedded_hal::{blocking::delay::DelayMs, spi::FullDuplex}; use nb::block; -use crate::{assets::SYMBOL_TABLE, eeprom, CONTRAST}; +use crate::{assets::SYMBOL_TABLE, eeprom, DefaultClock, CONTRAST}; // TODO: Make `cd` and `rst` pins generic pins pub struct Lcd { @@ -23,7 +22,7 @@ impl Lcd { } pub fn init(&mut self) { - let mut delay = Delay::::new(); + let mut delay = Delay::::new(); // TODO: Test if delay is really needed delay.delay_ms(1_u8); @@ -71,7 +70,7 @@ impl Lcd { fn fill(&mut self, segment: u8, page: u8, width: u8, data: u8) { assert!(segment + width <= 102); - let mut delay = Delay::::new(); + let mut delay = Delay::::new(); self.move_cursor(segment, page); @@ -97,7 +96,7 @@ impl Lcd { } pub fn print(&mut self, segment: u8, page: u8, string: &str) { - let mut delay = Delay::::new(); + let mut delay = Delay::::new(); for i in 0..2 { self.move_cursor(segment, page + i); @@ -123,7 +122,7 @@ impl Lcd { } pub fn print_inverted(&mut self, segment: u8, page: u8, string: &str) { - let mut delay = Delay::::new(); + let mut delay = Delay::::new(); for i in 0..2 { self.move_cursor(segment, page + i); @@ -150,7 +149,7 @@ impl Lcd { pub fn print_u8(&mut self, segment: u8, page: u8, digits: u8, data: u8) { assert!(digits <= 3); - let mut delay = Delay::::new(); + let mut delay = Delay::::new(); let mut array = [0usize; 3]; for (i, item) in array.iter_mut().enumerate() { @@ -183,7 +182,7 @@ impl Lcd { pub fn print_u8_inverted(&mut self, segment: u8, page: u8, digits: u8, data: u8) { assert!(digits <= 3); - let mut delay = Delay::::new(); + let mut delay = Delay::::new(); let mut array = [0usize; 3]; for (i, item) in array.iter_mut().enumerate() { @@ -215,7 +214,7 @@ impl Lcd { } pub fn print_freq(&mut self, segment: u8, page: u8, data: u32) { - let mut delay = Delay::::new(); + let mut delay = Delay::::new(); let mut array = [0usize; 9]; for (i, item) in array.iter_mut().enumerate() { @@ -269,7 +268,7 @@ impl Lcd { } pub fn print_freq_digit(&mut self, segment: u8, page: u8, data: u32, digit: u8) { - let mut delay = Delay::::new(); + let mut delay = Delay::::new(); let mut array = [0usize; 9]; for (i, item) in array.iter_mut().enumerate() { @@ -342,7 +341,7 @@ impl Lcd { } pub fn print_icon(&mut self, segment: u8, page: u8, symbol: &[u8]) { - let mut delay = Delay::::new(); + let mut delay = Delay::::new(); self.move_cursor(segment, page); // TODO: This delay fixes issues, try find a better solution diff --git a/firmware/rust/src/main.rs b/firmware/rust/src/main.rs index 5436d92..18fe0d4 100644 --- a/firmware/rust/src/main.rs +++ b/firmware/rust/src/main.rs @@ -52,7 +52,7 @@ struct ClockGenerator { exint: EXINT, encoder: Rotary, PB6>, Pin, PB7>>, button: Pin, PC0>, - delay: Delay, + delay: Delay, } impl ClockGenerator { @@ -93,7 +93,7 @@ impl ClockGenerator { ), tc1: dp.TC1, exint: dp.EXINT, - delay: Delay::::new(), + delay: Delay::::new(), encoder: Rotary::new(pins.pb6.into_pull_up_input(), pins.pb7.into_pull_up_input()), button: pins.pc0.into_pull_up_input(), } diff --git a/firmware/rust/src/screen/splash.rs b/firmware/rust/src/screen/splash.rs index d31774d..1f95039 100644 --- a/firmware/rust/src/screen/splash.rs +++ b/firmware/rust/src/screen/splash.rs @@ -1,8 +1,9 @@ use crate::{ assets::{ONDERS_ORG, SACRED_CHAO}, lcd::Lcd, + DefaultClock, }; -use atmega_hal::{clock::MHz8, delay::Delay}; +use atmega_hal::delay::Delay; use embedded_hal::{blocking::delay::DelayMs, spi::FullDuplex}; use nb::block; @@ -10,7 +11,7 @@ pub struct Splash; impl Splash { pub fn draw(&self, lcd: &mut Lcd) { - let mut delay = Delay::::new(); + let mut delay = Delay::::new(); for (i, page) in SACRED_CHAO.iter().enumerate() { lcd.move_cursor(31, 1 + i as u8);