examples: Consistently use unwrap! in favor of .unwrap()

Unfortunately errors from `embedded_graphics` and `core` doesn't provide
the necessary instances currently.
This commit is contained in:
Ben Gamari
2021-07-31 11:51:40 -04:00
committed by Dario Nieuwenhuis
parent 36402b5487
commit f4950c4449
22 changed files with 67 additions and 65 deletions

View File

@ -25,11 +25,11 @@ async fn main(_spawner: Spawner, mut p: Peripherals) {
loop {
info!("high");
led.set_high().unwrap();
unwrap!(led.set_high());
Timer::after(Duration::from_millis(300)).await;
info!("low");
led.set_low().unwrap();
unwrap!(led.set_low());
Timer::after(Duration::from_millis(300)).await;
}
}

View File

@ -27,14 +27,14 @@ fn main() -> ! {
let mut led2 = Output::new(p.PB5, Level::High, Speed::Low);
loop {
if button.is_high().unwrap() {
if unwrap!(button.is_high()) {
info!("high");
led1.set_high().unwrap();
led2.set_low().unwrap();
unwrap!(led1.set_high());
unwrap!(led2.set_low());
} else {
info!("low");
led1.set_low().unwrap();
led2.set_high().unwrap();
unwrap!(led1.set_low());
unwrap!(led2.set_high());
}
}
}