aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32f4/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/stm32f4/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/stm32f4/src')
-rw-r--r--examples/stm32f4/src/bin/blinky.rs4
-rw-r--r--examples/stm32f4/src/bin/button.rs10
-rw-r--r--examples/stm32f4/src/bin/usart.rs6
-rw-r--r--examples/stm32f4/src/bin/usart_dma.rs2
4 files changed, 11 insertions, 11 deletions
diff --git a/examples/stm32f4/src/bin/blinky.rs b/examples/stm32f4/src/bin/blinky.rs
index 00eab761e..b3a0ffb8e 100644
--- a/examples/stm32f4/src/bin/blinky.rs
+++ b/examples/stm32f4/src/bin/blinky.rs
@@ -26,11 +26,11 @@ async fn main(_spawner: Spawner, p: Peripherals) {
26 26
27 loop { 27 loop {
28 info!("high"); 28 info!("high");
29 led.set_high().unwrap(); 29 unwrap!(led.set_high());
30 Timer::after(Duration::from_millis(300)).await; 30 Timer::after(Duration::from_millis(300)).await;
31 31
32 info!("low"); 32 info!("low");
33 led.set_low().unwrap(); 33 unwrap!(led.set_low());
34 Timer::after(Duration::from_millis(300)).await; 34 Timer::after(Duration::from_millis(300)).await;
35 } 35 }
36} 36}
diff --git a/examples/stm32f4/src/bin/button.rs b/examples/stm32f4/src/bin/button.rs
index 82c83e80e..90998cf46 100644
--- a/examples/stm32f4/src/bin/button.rs
+++ b/examples/stm32f4/src/bin/button.rs
@@ -28,14 +28,14 @@ fn main() -> ! {
28 let mut led3 = Output::new(p.PB14, Level::High, Speed::Low); 28 let mut led3 = Output::new(p.PB14, Level::High, Speed::Low);
29 29
30 loop { 30 loop {
31 if button.is_high().unwrap() { 31 if unwrap!(button.is_high()) {
32 info!("high"); 32 info!("high");
33 led1.set_high().unwrap(); 33 unwrap!(led1.set_high());
34 led3.set_low().unwrap(); 34 unwrap!(led3.set_low());
35 } else { 35 } else {
36 info!("low"); 36 info!("low");
37 led1.set_low().unwrap(); 37 unwrap!(led1.set_low());
38 led3.set_high().unwrap(); 38 unwrap!(led3.set_high());
39 } 39 }
40 } 40 }
41} 41}
diff --git a/examples/stm32f4/src/bin/usart.rs b/examples/stm32f4/src/bin/usart.rs
index da3261949..fd4f19e20 100644
--- a/examples/stm32f4/src/bin/usart.rs
+++ b/examples/stm32f4/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.USART3, p.PD9, p.PD8, NoDma, NoDma, config); 27 let mut usart = Uart::new(p.USART3, p.PD9, p.PD8, 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).unwbrap());
35 usart.bwrite_all(&buf).unwrap(); 35 unwrap!(usart.bwrite_all(&buf).unwrap());
36 } 36 }
37} 37}
diff --git a/examples/stm32f4/src/bin/usart_dma.rs b/examples/stm32f4/src/bin/usart_dma.rs
index 05a550e95..bf50b8ad9 100644
--- a/examples/stm32f4/src/bin/usart_dma.rs
+++ b/examples/stm32f4/src/bin/usart_dma.rs
@@ -31,7 +31,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
31 let mut s: String<128> = String::new(); 31 let mut s: String<128> = String::new();
32 core::write!(&mut s, "Hello DMA World {}!\r\n", n).unwrap(); 32 core::write!(&mut s, "Hello DMA World {}!\r\n", n).unwrap();
33 33
34 usart.write(s.as_bytes()).await.unwrap(); 34 unwrap!(usart.write(s.as_bytes()).await);
35 info!("wrote DMA"); 35 info!("wrote DMA");
36 } 36 }
37} 37}