diff options
Diffstat (limited to 'embassy-stm32f4-examples/src')
| -rw-r--r-- | embassy-stm32f4-examples/src/bin/exti.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/embassy-stm32f4-examples/src/bin/exti.rs b/embassy-stm32f4-examples/src/bin/exti.rs index 0c6561cda..2201189eb 100644 --- a/embassy-stm32f4-examples/src/bin/exti.rs +++ b/embassy-stm32f4-examples/src/bin/exti.rs | |||
| @@ -13,22 +13,19 @@ use cortex_m_rt::entry; | |||
| 13 | use embassy::executor::{task, Executor}; | 13 | use embassy::executor::{task, Executor}; |
| 14 | use embassy::traits::gpio::*; | 14 | use embassy::traits::gpio::*; |
| 15 | use embassy::util::Forever; | 15 | use embassy::util::Forever; |
| 16 | use embassy_stm32f4::exti; | 16 | use embassy_stm32f4::exti::ExtiPin; |
| 17 | use embassy_stm32f4::interrupt; | 17 | use embassy_stm32f4::interrupt; |
| 18 | use futures::pin_mut; | 18 | use futures::pin_mut; |
| 19 | use stm32f4xx_hal::prelude::*; | 19 | use stm32f4xx_hal::prelude::*; |
| 20 | use stm32f4xx_hal::stm32; | 20 | use stm32f4xx_hal::stm32; |
| 21 | 21 | ||
| 22 | static EXTI: Forever<exti::ExtiManager> = Forever::new(); | ||
| 23 | |||
| 24 | #[task] | 22 | #[task] |
| 25 | async fn run(dp: stm32::Peripherals, _cp: cortex_m::Peripherals) { | 23 | async fn run(dp: stm32::Peripherals, _cp: cortex_m::Peripherals) { |
| 26 | let gpioa = dp.GPIOA.split(); | 24 | let gpioa = dp.GPIOA.split(); |
| 27 | 25 | ||
| 28 | let button = gpioa.pa0.into_pull_up_input(); | 26 | let button = gpioa.pa0.into_pull_up_input(); |
| 29 | 27 | ||
| 30 | let exti = EXTI.put(exti::ExtiManager::new(dp.EXTI, dp.SYSCFG.constrain())); | 28 | let pin = ExtiPin::new(button, interrupt::take!(EXTI0)); |
| 31 | let pin = exti.new_pin(button, interrupt::take!(EXTI0)); | ||
| 32 | pin_mut!(pin); | 29 | pin_mut!(pin); |
| 33 | 30 | ||
| 34 | info!("Starting loop"); | 31 | info!("Starting loop"); |
