fw-rust: Clear the screen

After initializing the LCD display, clear the screen.
This commit is contained in:
finga 2022-03-04 13:20:56 +01:00
parent 817776d735
commit c42b4595c7

View file

@ -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() };