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:
committed by
Dario Nieuwenhuis
parent
36402b5487
commit
f4950c4449
@ -26,11 +26,11 @@ async fn main(_spawner: Spawner, 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;
|
||||
}
|
||||
}
|
||||
|
@ -28,14 +28,14 @@ fn main() -> ! {
|
||||
let mut led3 = Output::new(p.PB14, Level::High, Speed::Low);
|
||||
|
||||
loop {
|
||||
if button.is_high().unwrap() {
|
||||
if unwrap!(button.is_high()) {
|
||||
info!("high");
|
||||
led1.set_high().unwrap();
|
||||
led3.set_low().unwrap();
|
||||
unwrap!(led1.set_high());
|
||||
unwrap!(led3.set_low());
|
||||
} else {
|
||||
info!("low");
|
||||
led1.set_low().unwrap();
|
||||
led3.set_high().unwrap();
|
||||
unwrap!(led1.set_low());
|
||||
unwrap!(led3.set_high());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,12 +26,12 @@ fn main() -> ! {
|
||||
let config = Config::default();
|
||||
let mut usart = Uart::new(p.USART3, p.PD9, p.PD8, NoDma, NoDma, config);
|
||||
|
||||
usart.bwrite_all(b"Hello Embassy World!\r\n").unwrap();
|
||||
unwrap!(usart.bwrite_all(b"Hello Embassy World!\r\n"));
|
||||
info!("wrote Hello, starting echo");
|
||||
|
||||
let mut buf = [0u8; 1];
|
||||
loop {
|
||||
usart.read_blocking(&mut buf).unwrap();
|
||||
usart.bwrite_all(&buf).unwrap();
|
||||
unwrap!(usart.read_blocking(&mut buf).unwbrap());
|
||||
unwrap!(usart.bwrite_all(&buf).unwrap());
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
let mut s: String<128> = String::new();
|
||||
core::write!(&mut s, "Hello DMA World {}!\r\n", n).unwrap();
|
||||
|
||||
usart.write(s.as_bytes()).await.unwrap();
|
||||
unwrap!(usart.write(s.as_bytes()).await);
|
||||
info!("wrote DMA");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user