diff options
Diffstat (limited to 'examples/stm32f0/src/bin')
| -rw-r--r-- | examples/stm32f0/src/bin/button_controlled_blink.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/stm32f0/src/bin/button_controlled_blink.rs b/examples/stm32f0/src/bin/button_controlled_blink.rs index 4465483d9..744df3e3b 100644 --- a/examples/stm32f0/src/bin/button_controlled_blink.rs +++ b/examples/stm32f0/src/bin/button_controlled_blink.rs | |||
| @@ -8,14 +8,15 @@ use core::sync::atomic::{AtomicU32, Ordering}; | |||
| 8 | use defmt::info; | 8 | use defmt::info; |
| 9 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| 10 | use embassy_stm32::exti::ExtiInput; | 10 | use embassy_stm32::exti::ExtiInput; |
| 11 | use embassy_stm32::gpio::{AnyPin, Level, Output, Pin, Pull, Speed}; | 11 | use embassy_stm32::gpio::{AnyPin, Level, Output, Pull, Speed}; |
| 12 | use embassy_stm32::Peri; | ||
| 12 | use embassy_time::Timer; | 13 | use embassy_time::Timer; |
| 13 | use {defmt_rtt as _, panic_probe as _}; | 14 | use {defmt_rtt as _, panic_probe as _}; |
| 14 | 15 | ||
| 15 | static BLINK_MS: AtomicU32 = AtomicU32::new(0); | 16 | static BLINK_MS: AtomicU32 = AtomicU32::new(0); |
| 16 | 17 | ||
| 17 | #[embassy_executor::task] | 18 | #[embassy_executor::task] |
| 18 | async fn led_task(led: AnyPin) { | 19 | async fn led_task(led: Peri<'static, AnyPin>) { |
| 19 | // Configure the LED pin as a push pull output and obtain handler. | 20 | // Configure the LED pin as a push pull output and obtain handler. |
| 20 | // On the Nucleo F091RC there's an on-board LED connected to pin PA5. | 21 | // On the Nucleo F091RC there's an on-board LED connected to pin PA5. |
| 21 | let mut led = Output::new(led, Level::Low, Speed::Low); | 22 | let mut led = Output::new(led, Level::Low, Speed::Low); |
| @@ -45,7 +46,7 @@ async fn main(spawner: Spawner) { | |||
| 45 | BLINK_MS.store(del_var, Ordering::Relaxed); | 46 | BLINK_MS.store(del_var, Ordering::Relaxed); |
| 46 | 47 | ||
| 47 | // Spawn LED blinking task | 48 | // Spawn LED blinking task |
| 48 | spawner.spawn(led_task(p.PA5.degrade())).unwrap(); | 49 | spawner.spawn(led_task(p.PA5.into())).unwrap(); |
| 49 | 50 | ||
| 50 | loop { | 51 | loop { |
| 51 | // Check if button got pressed | 52 | // Check if button got pressed |
