diff options
| author | Ben Gamari <[email protected]> | 2021-07-31 11:51:40 -0400 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-08-05 22:39:59 +0200 |
| commit | f4950c44499b2d1ba1280000a05a1a5edd03d8ca (patch) | |
| tree | ba2c93392868fe6910868d1d5d58562760ed0ab7 /examples/stm32l0/src | |
| parent | 36402b5487a7001c859bf85673e74c64cc2b59cd (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/stm32l0/src')
| -rw-r--r-- | examples/stm32l0/src/bin/blinky.rs | 4 | ||||
| -rw-r--r-- | examples/stm32l0/src/bin/button.rs | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/examples/stm32l0/src/bin/blinky.rs b/examples/stm32l0/src/bin/blinky.rs index faa42896b..29f5d7c74 100644 --- a/examples/stm32l0/src/bin/blinky.rs +++ b/examples/stm32l0/src/bin/blinky.rs | |||
| @@ -25,11 +25,11 @@ async fn main(_spawner: Spawner, mut p: Peripherals) { | |||
| 25 | 25 | ||
| 26 | loop { | 26 | loop { |
| 27 | info!("high"); | 27 | info!("high"); |
| 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 | 30 | ||
| 31 | info!("low"); | 31 | info!("low"); |
| 32 | led.set_low().unwrap(); | 32 | unwrap!(led.set_low()); |
| 33 | Timer::after(Duration::from_millis(300)).await; | 33 | Timer::after(Duration::from_millis(300)).await; |
| 34 | } | 34 | } |
| 35 | } | 35 | } |
diff --git a/examples/stm32l0/src/bin/button.rs b/examples/stm32l0/src/bin/button.rs index 6b75de509..e37d3f26d 100644 --- a/examples/stm32l0/src/bin/button.rs +++ b/examples/stm32l0/src/bin/button.rs | |||
| @@ -27,14 +27,14 @@ fn main() -> ! { | |||
| 27 | let mut led2 = Output::new(p.PB5, Level::High, Speed::Low); | 27 | let mut led2 = Output::new(p.PB5, Level::High, Speed::Low); |
| 28 | 28 | ||
| 29 | loop { | 29 | loop { |
| 30 | if button.is_high().unwrap() { | 30 | if unwrap!(button.is_high()) { |
| 31 | info!("high"); | 31 | info!("high"); |
| 32 | led1.set_high().unwrap(); | 32 | unwrap!(led1.set_high()); |
| 33 | led2.set_low().unwrap(); | 33 | unwrap!(led2.set_low()); |
| 34 | } else { | 34 | } else { |
| 35 | info!("low"); | 35 | info!("low"); |
| 36 | led1.set_low().unwrap(); | 36 | unwrap!(led1.set_low()); |
| 37 | led2.set_high().unwrap(); | 37 | unwrap!(led2.set_high()); |
| 38 | } | 38 | } |
| 39 | } | 39 | } |
| 40 | } | 40 | } |
