diff options
Diffstat (limited to 'examples/stm32f3/src/bin/button_events.rs')
| -rw-r--r-- | examples/stm32f3/src/bin/button_events.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/stm32f3/src/bin/button_events.rs b/examples/stm32f3/src/bin/button_events.rs index 45862ddc6..ef5110316 100644 --- a/examples/stm32f3/src/bin/button_events.rs +++ b/examples/stm32f3/src/bin/button_events.rs | |||
| @@ -11,14 +11,14 @@ | |||
| 11 | #![feature(type_alias_impl_trait)] | 11 | #![feature(type_alias_impl_trait)] |
| 12 | 12 | ||
| 13 | use defmt::*; | 13 | use defmt::*; |
| 14 | use embassy::blocking_mutex::raw::ThreadModeRawMutex; | 14 | use embassy_executor::executor::Spawner; |
| 15 | use embassy::channel::mpmc::Channel; | 15 | use embassy_executor::time::{with_timeout, Duration, Timer}; |
| 16 | use embassy::executor::Spawner; | ||
| 17 | use embassy::time::{with_timeout, Duration, Timer}; | ||
| 18 | use embassy_stm32::exti::ExtiInput; | 16 | use embassy_stm32::exti::ExtiInput; |
| 19 | use embassy_stm32::gpio::{AnyPin, Input, Level, Output, Pin, Pull, Speed}; | 17 | use embassy_stm32::gpio::{AnyPin, Input, Level, Output, Pin, Pull, Speed}; |
| 20 | use embassy_stm32::peripherals::PA0; | 18 | use embassy_stm32::peripherals::PA0; |
| 21 | use embassy_stm32::Peripherals; | 19 | use embassy_stm32::Peripherals; |
| 20 | use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; | ||
| 21 | use embassy_util::channel::mpmc::Channel; | ||
| 22 | use {defmt_rtt as _, panic_probe as _}; | 22 | use {defmt_rtt as _, panic_probe as _}; |
| 23 | 23 | ||
| 24 | struct Leds<'a> { | 24 | struct Leds<'a> { |
| @@ -99,7 +99,7 @@ enum ButtonEvent { | |||
| 99 | 99 | ||
| 100 | static CHANNEL: Channel<ThreadModeRawMutex, ButtonEvent, 4> = Channel::new(); | 100 | static CHANNEL: Channel<ThreadModeRawMutex, ButtonEvent, 4> = Channel::new(); |
| 101 | 101 | ||
| 102 | #[embassy::main] | 102 | #[embassy_executor::main] |
| 103 | async fn main(spawner: Spawner, p: Peripherals) { | 103 | async fn main(spawner: Spawner, p: Peripherals) { |
| 104 | let button = Input::new(p.PA0, Pull::Down); | 104 | let button = Input::new(p.PA0, Pull::Down); |
| 105 | let button = ExtiInput::new(button, p.EXTI0); | 105 | let button = ExtiInput::new(button, p.EXTI0); |
| @@ -120,14 +120,14 @@ async fn main(spawner: Spawner, p: Peripherals) { | |||
| 120 | spawner.spawn(led_blinker(leds)).unwrap(); | 120 | spawner.spawn(led_blinker(leds)).unwrap(); |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | #[embassy::task] | 123 | #[embassy_executor::task] |
| 124 | async fn led_blinker(mut leds: Leds<'static>) { | 124 | async fn led_blinker(mut leds: Leds<'static>) { |
| 125 | loop { | 125 | loop { |
| 126 | leds.show().await; | 126 | leds.show().await; |
| 127 | } | 127 | } |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | #[embassy::task] | 130 | #[embassy_executor::task] |
| 131 | async fn button_waiter(mut button: ExtiInput<'static, PA0>) { | 131 | async fn button_waiter(mut button: ExtiInput<'static, PA0>) { |
| 132 | const DOUBLE_CLICK_DELAY: u64 = 250; | 132 | const DOUBLE_CLICK_DELAY: u64 = 250; |
| 133 | const HOLD_DELAY: u64 = 1000; | 133 | const HOLD_DELAY: u64 = 1000; |
