diff options
Diffstat (limited to 'examples/stm32f3/src/bin/button.rs')
| -rw-r--r-- | examples/stm32f3/src/bin/button.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/stm32f3/src/bin/button.rs b/examples/stm32f3/src/bin/button.rs index c5fab138b..131d4af42 100644 --- a/examples/stm32f3/src/bin/button.rs +++ b/examples/stm32f3/src/bin/button.rs | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | mod example_common; | 6 | mod example_common; |
| 7 | use cortex_m_rt::entry; | 7 | use cortex_m_rt::entry; |
| 8 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 8 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; |
| 9 | use embedded_hal::digital::v2::{InputPin, OutputPin}; | ||
| 10 | use example_common::*; | 9 | use example_common::*; |
| 11 | 10 | ||
| 12 | #[entry] | 11 | #[entry] |
| @@ -20,14 +19,14 @@ fn main() -> ! { | |||
| 20 | let mut led2 = Output::new(p.PE15, Level::High, Speed::Low); | 19 | let mut led2 = Output::new(p.PE15, Level::High, Speed::Low); |
| 21 | 20 | ||
| 22 | loop { | 21 | loop { |
| 23 | if unwrap!(button.is_high()) { | 22 | if button.is_high() { |
| 24 | info!("high"); | 23 | info!("high"); |
| 25 | unwrap!(led1.set_high()); | 24 | led1.set_high(); |
| 26 | unwrap!(led2.set_low()); | 25 | led2.set_low(); |
| 27 | } else { | 26 | } else { |
| 28 | info!("low"); | 27 | info!("low"); |
| 29 | unwrap!(led1.set_low()); | 28 | led1.set_low(); |
| 30 | unwrap!(led2.set_high()); | 29 | led2.set_high(); |
| 31 | } | 30 | } |
| 32 | } | 31 | } |
| 33 | } | 32 | } |
