aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32l4/src
diff options
context:
space:
mode:
authorBen Gamari <[email protected]>2021-07-31 11:51:40 -0400
committerDario Nieuwenhuis <[email protected]>2021-08-05 22:39:59 +0200
commitf4950c44499b2d1ba1280000a05a1a5edd03d8ca (patch)
treeba2c93392868fe6910868d1d5d58562760ed0ab7 /examples/stm32l4/src
parent36402b5487a7001c859bf85673e74c64cc2b59cd (diff)
examples: Consistently use unwrap! in favor of .unwrap()
Unfortunately errors from `embedded_graphics` and `core` doesn't provide the necessary instances currently.
Diffstat (limited to 'examples/stm32l4/src')
-rw-r--r--examples/stm32l4/src/bin/blinky.rs4
-rw-r--r--examples/stm32l4/src/bin/button.rs2
-rw-r--r--examples/stm32l4/src/bin/spi_dma.rs4
-rw-r--r--examples/stm32l4/src/bin/usart.rs6
4 files changed, 8 insertions, 8 deletions
diff --git a/examples/stm32l4/src/bin/blinky.rs b/examples/stm32l4/src/bin/blinky.rs
index fc86b11eb..c9ba587e4 100644
--- a/examples/stm32l4/src/bin/blinky.rs
+++ b/examples/stm32l4/src/bin/blinky.rs
@@ -25,9 +25,9 @@ async fn main(_spawner: Spawner, p: Peripherals) {
25 let mut led = Output::new(p.PB14, Level::High, Speed::Low); 25 let mut led = Output::new(p.PB14, Level::High, Speed::Low);
26 26
27 loop { 27 loop {
28 led.set_high().unwrap(); 28 unwrap!(led.set_high());
29 Timer::after(Duration::from_millis(300)).await; 29 Timer::after(Duration::from_millis(300)).await;
30 led.set_low().unwrap(); 30 unwrap!(led.set_low());
31 Timer::after(Duration::from_millis(300)).await; 31 Timer::after(Duration::from_millis(300)).await;
32 } 32 }
33} 33}
diff --git a/examples/stm32l4/src/bin/button.rs b/examples/stm32l4/src/bin/button.rs
index e2756b711..883a0d6c8 100644
--- a/examples/stm32l4/src/bin/button.rs
+++ b/examples/stm32l4/src/bin/button.rs
@@ -24,7 +24,7 @@ fn main() -> ! {
24 let button = Input::new(p.PC13, Pull::Up); 24 let button = Input::new(p.PC13, Pull::Up);
25 25
26 loop { 26 loop {
27 if button.is_high().unwrap() { 27 if unwrap!(button.is_high()) {
28 info!("high"); 28 info!("high");
29 } else { 29 } else {
30 info!("low"); 30 info!("low");
diff --git a/examples/stm32l4/src/bin/spi_dma.rs b/examples/stm32l4/src/bin/spi_dma.rs
index ba77331be..d626a1290 100644
--- a/examples/stm32l4/src/bin/spi_dma.rs
+++ b/examples/stm32l4/src/bin/spi_dma.rs
@@ -45,10 +45,10 @@ async fn main(_spawner: Spawner, p: Peripherals) {
45 let ready = Input::new(p.PE1, Pull::Up); 45 let ready = Input::new(p.PE1, Pull::Up);
46 46
47 cortex_m::asm::delay(100_000); 47 cortex_m::asm::delay(100_000);
48 reset.set_high().unwrap(); 48 unwrap!(reset.set_high());
49 cortex_m::asm::delay(100_000); 49 cortex_m::asm::delay(100_000);
50 50
51 while ready.is_low().unwrap() { 51 while unwrap!(ready.is_low()) {
52 info!("waiting for ready"); 52 info!("waiting for ready");
53 } 53 }
54 54
diff --git a/examples/stm32l4/src/bin/usart.rs b/examples/stm32l4/src/bin/usart.rs
index ccb82b8d4..95ac84b23 100644
--- a/examples/stm32l4/src/bin/usart.rs
+++ b/examples/stm32l4/src/bin/usart.rs
@@ -26,12 +26,12 @@ fn main() -> ! {
26 let config = Config::default(); 26 let config = Config::default();
27 let mut usart = Uart::new(p.UART4, p.PA1, p.PA0, NoDma, NoDma, config); 27 let mut usart = Uart::new(p.UART4, p.PA1, p.PA0, NoDma, NoDma, config);
28 28
29 usart.bwrite_all(b"Hello Embassy World!\r\n").unwrap(); 29 unwrap!(usart.bwrite_all(b"Hello Embassy World!\r\n"));
30 info!("wrote Hello, starting echo"); 30 info!("wrote Hello, starting echo");
31 31
32 let mut buf = [0u8; 1]; 32 let mut buf = [0u8; 1];
33 loop { 33 loop {
34 usart.read_blocking(&mut buf).unwrap(); 34 unwrap!(usart.read_blocking(&mut buf));
35 usart.bwrite_all(&buf).unwrap(); 35 unwrap!(usart.bwrite_all(&buf));
36 } 36 }
37} 37}