diff options
Diffstat (limited to 'examples/stm32f7')
| -rw-r--r-- | examples/stm32f7/src/bin/blinky.rs | 5 | ||||
| -rw-r--r-- | examples/stm32f7/src/bin/button.rs | 11 |
2 files changed, 7 insertions, 9 deletions
diff --git a/examples/stm32f7/src/bin/blinky.rs b/examples/stm32f7/src/bin/blinky.rs index c4857195f..00d67dac0 100644 --- a/examples/stm32f7/src/bin/blinky.rs +++ b/examples/stm32f7/src/bin/blinky.rs | |||
| @@ -8,7 +8,6 @@ use embassy::executor::Spawner; | |||
| 8 | use embassy::time::{Duration, Timer}; | 8 | use embassy::time::{Duration, Timer}; |
| 9 | use embassy_stm32::gpio::{Level, Output, Speed}; | 9 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 10 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 11 | use embedded_hal::digital::v2::OutputPin; | ||
| 12 | use example_common::*; | 11 | use example_common::*; |
| 13 | 12 | ||
| 14 | #[embassy::main] | 13 | #[embassy::main] |
| @@ -19,11 +18,11 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 19 | 18 | ||
| 20 | loop { | 19 | loop { |
| 21 | info!("high"); | 20 | info!("high"); |
| 22 | unwrap!(led.set_high()); | 21 | led.set_high(); |
| 23 | Timer::after(Duration::from_millis(300)).await; | 22 | Timer::after(Duration::from_millis(300)).await; |
| 24 | 23 | ||
| 25 | info!("low"); | 24 | info!("low"); |
| 26 | unwrap!(led.set_low()); | 25 | led.set_low(); |
| 27 | Timer::after(Duration::from_millis(300)).await; | 26 | Timer::after(Duration::from_millis(300)).await; |
| 28 | } | 27 | } |
| 29 | } | 28 | } |
diff --git a/examples/stm32f7/src/bin/button.rs b/examples/stm32f7/src/bin/button.rs index 95dee7c74..24eef75b2 100644 --- a/examples/stm32f7/src/bin/button.rs +++ b/examples/stm32f7/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] |
| @@ -21,14 +20,14 @@ fn main() -> ! { | |||
| 21 | let mut led3 = Output::new(p.PB14, Level::High, Speed::Low); | 20 | let mut led3 = Output::new(p.PB14, Level::High, Speed::Low); |
| 22 | 21 | ||
| 23 | loop { | 22 | loop { |
| 24 | if unwrap!(button.is_high()) { | 23 | if button.is_high() { |
| 25 | info!("high"); | 24 | info!("high"); |
| 26 | unwrap!(led1.set_high()); | 25 | led1.set_high(); |
| 27 | unwrap!(led3.set_low()); | 26 | led3.set_low(); |
| 28 | } else { | 27 | } else { |
| 29 | info!("low"); | 28 | info!("low"); |
| 30 | unwrap!(led1.set_low()); | 29 | led1.set_low(); |
| 31 | unwrap!(led3.set_high()); | 30 | led3.set_high(); |
| 32 | } | 31 | } |
| 33 | } | 32 | } |
| 34 | } | 33 | } |
