diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-01-14 22:02:00 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-01-19 17:59:55 +0100 |
| commit | 58fc64722c65bbdc209ae0fd1700f03702bbcd08 (patch) | |
| tree | 77f9412b47259cd4cf4170b0a257b371398d4f2c /examples/stm32wl55/src/bin/button.rs | |
| parent | 52e156b429417bde59d0ea67d11256866f1dcec9 (diff) | |
stm32/gpio: expose all functionality as inherent methods.
Diffstat (limited to 'examples/stm32wl55/src/bin/button.rs')
| -rw-r--r-- | examples/stm32wl55/src/bin/button.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/stm32wl55/src/bin/button.rs b/examples/stm32wl55/src/bin/button.rs index 55b688663..be8f60e26 100644 --- a/examples/stm32wl55/src/bin/button.rs +++ b/examples/stm32wl55/src/bin/button.rs | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | #[path = "../example_common.rs"] | 5 | #[path = "../example_common.rs"] |
| 6 | mod example_common; | 6 | mod example_common; |
| 7 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 7 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; |
| 8 | use embedded_hal::digital::v2::{InputPin, OutputPin}; | ||
| 9 | use example_common::*; | 8 | use example_common::*; |
| 10 | 9 | ||
| 11 | use cortex_m_rt::entry; | 10 | use cortex_m_rt::entry; |
| @@ -21,12 +20,12 @@ fn main() -> ! { | |||
| 21 | let mut led2 = Output::new(p.PB9, Level::High, Speed::Low); | 20 | let mut led2 = Output::new(p.PB9, Level::High, Speed::Low); |
| 22 | 21 | ||
| 23 | loop { | 22 | loop { |
| 24 | if button.is_high().unwrap() { | 23 | if button.is_high() { |
| 25 | led1.set_high().unwrap(); | 24 | led1.set_high(); |
| 26 | led2.set_low().unwrap(); | 25 | led2.set_low(); |
| 27 | } else { | 26 | } else { |
| 28 | led1.set_low().unwrap(); | 27 | led1.set_low(); |
| 29 | led2.set_high().unwrap(); | 28 | led2.set_high(); |
| 30 | } | 29 | } |
| 31 | } | 30 | } |
| 32 | } | 31 | } |
