diff --git a/examples/lcd.rs b/examples/lcd.rs index e25e3a1..a6d8ec9 100755 --- a/examples/lcd.rs +++ b/examples/lcd.rs @@ -1,8 +1,7 @@ #![no_main] #![no_std] -use defmt::{debug, error, info, println, trace, warn}; -use hal::pwm::Pin; +use defmt::info; use panic_probe as _; use defmt_rtt as _; // global logger @@ -12,7 +11,6 @@ use core::fmt::Write; use cortex_m_rt::entry; use hal::{pac, prelude::*, rcc::Config}; use hd44780_driver::HD44780; -use heapless::Vec; #[defmt::panic_handler] fn panic() -> ! { @@ -30,10 +28,6 @@ fn main() -> ! { let gpiob = dp.GPIOB.split(&mut rcc); let gpioc = dp.GPIOC.split(&mut rcc); - // contrast over A0 analog port - // analog output seems to not be supported somehow? - let mut vO = gpioa.pa0.into_push_pull_output(); - // literal D4-D7 ports etc as written on the nucleo board, mapped to the D4-D7 ports of the LCD // controller let d4 = gpiob.pb5.into_push_pull_output(); @@ -41,10 +35,10 @@ fn main() -> ! { let d6 = gpiob.pb10.into_push_pull_output(); let d7 = gpioa.pa8.into_push_pull_output(); - // clock enable on D8 - let en = gpioa.pa9.into_push_pull_output(); - // register select on D9, the lib wants that but I'd just put it on ground otherwise - let rs = gpioc.pc7.into_push_pull_output(); + // clock enable on D9 + let en = gpioc.pc7.into_push_pull_output(); + // register select on D8, the lib wants that but I'd just put it on ground otherwise + let rs = gpioa.pa9.into_push_pull_output(); // See https://en.wikipedia.org/wiki/Hitachi_HD44780_LCD_controller#Interface // for the pins of the LCD @@ -69,7 +63,6 @@ fn main() -> ! { let mut i = 0; loop { - vO.set_low().expect("set contrast low boom?"); led.set_high().unwrap(); info!("Writing to LCD..."); lcd.write_str("Hello world!\nGoing on", &mut delay)