fw-rust: Clear the screen
After initializing the LCD display, clear the screen.
This commit is contained in:
parent
817776d735
commit
c42b4595c7
1 changed files with 20 additions and 1 deletions
|
@ -61,7 +61,7 @@ fn main() -> ! {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Init LCD
|
// 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();
|
let mut lcd_rst = pins.pb1.into_output();
|
||||||
// TODO: Test if delay is really needed
|
// TODO: Test if delay is really needed
|
||||||
delay.delay_ms(1_u8);
|
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(0x08)).unwrap(); // (9) Set Electronic Volume: Set Contrast // TODO: Use EEPROM
|
||||||
block!(spi.send(0xAF)).unwrap(); // (12) Set Display Enable: Display on
|
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
|
// Enable interrupts
|
||||||
unsafe { interrupt::enable() };
|
unsafe { interrupt::enable() };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue