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
@ -25,9 +25,9 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
let mut led = Output::new(p.PB14, Level::High, Speed::Low);
|
||||
|
||||
loop {
|
||||
led.set_high().unwrap();
|
||||
unwrap!(led.set_high());
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
led.set_low().unwrap();
|
||||
unwrap!(led.set_low());
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ fn main() -> ! {
|
||||
let button = Input::new(p.PC13, Pull::Up);
|
||||
|
||||
loop {
|
||||
if button.is_high().unwrap() {
|
||||
if unwrap!(button.is_high()) {
|
||||
info!("high");
|
||||
} else {
|
||||
info!("low");
|
||||
|
@ -45,10 +45,10 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
let ready = Input::new(p.PE1, Pull::Up);
|
||||
|
||||
cortex_m::asm::delay(100_000);
|
||||
reset.set_high().unwrap();
|
||||
unwrap!(reset.set_high());
|
||||
cortex_m::asm::delay(100_000);
|
||||
|
||||
while ready.is_low().unwrap() {
|
||||
while unwrap!(ready.is_low()) {
|
||||
info!("waiting for ready");
|
||||
}
|
||||
|
||||
|
@ -26,12 +26,12 @@ fn main() -> ! {
|
||||
let config = Config::default();
|
||||
let mut usart = Uart::new(p.UART4, p.PA1, p.PA0, 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));
|
||||
unwrap!(usart.bwrite_all(&buf));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user