aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32f4-examples
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-stm32f4-examples')
-rw-r--r--embassy-stm32f4-examples/src/bin/exti.rs7
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;
13use embassy::executor::{task, Executor}; 13use embassy::executor::{task, Executor};
14use embassy::traits::gpio::*; 14use embassy::traits::gpio::*;
15use embassy::util::Forever; 15use embassy::util::Forever;
16use embassy_stm32f4::exti; 16use embassy_stm32f4::exti::ExtiPin;
17use embassy_stm32f4::interrupt; 17use embassy_stm32f4::interrupt;
18use futures::pin_mut; 18use futures::pin_mut;
19use stm32f4xx_hal::prelude::*; 19use stm32f4xx_hal::prelude::*;
20use stm32f4xx_hal::stm32; 20use stm32f4xx_hal::stm32;
21 21
22static EXTI: Forever<exti::ExtiManager> = Forever::new();
23
24#[task] 22#[task]
25async fn run(dp: stm32::Peripherals, _cp: cortex_m::Peripherals) { 23async 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");