diff --git a/firmware/rust/src/main.rs b/firmware/rust/src/main.rs index 38569cb..f7e5bda 100644 --- a/firmware/rust/src/main.rs +++ b/firmware/rust/src/main.rs @@ -61,7 +61,7 @@ fn main() -> ! { ); // Init LCD - let _lcd_cd = pins.pb0.into_output(); + let mut lcd_cd = pins.pb0.into_output(); let mut lcd_rst = pins.pb1.into_output(); // TODO: Test if delay is really needed delay.delay_ms(1_u8); @@ -80,6 +80,25 @@ fn main() -> ! { block!(spi.send(0x08)).unwrap(); // (9) Set Electronic Volume: Set Contrast // TODO: Use EEPROM block!(spi.send(0xAF)).unwrap(); // (12) Set Display Enable: Display on + // Clear screen + for page in 0..8 { + block!(spi.send(0x00)).unwrap(); + block!(spi.send(0x10)).unwrap(); + block!(spi.send(0xB0 + page)).unwrap(); + + // TODO: This delay fixes issues, try find a better solution + delay.delay_ms(1_u8); + lcd_cd.set_high(); + + for _ in 0..102 { + block!(spi.send(0x00)).unwrap(); + } + + // TODO: This delay fixes issues, try find a better solution + delay.delay_ms(1_u8); + lcd_cd.set_low(); + } + // Enable interrupts unsafe { interrupt::enable() };