aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32f0/src/bin/button_exti.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/stm32f0/src/bin/button_exti.rs')
-rw-r--r--examples/stm32f0/src/bin/button_exti.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/examples/stm32f0/src/bin/button_exti.rs b/examples/stm32f0/src/bin/button_exti.rs
index fd615a215..d1312e1be 100644
--- a/examples/stm32f0/src/bin/button_exti.rs
+++ b/examples/stm32f0/src/bin/button_exti.rs
@@ -3,17 +3,23 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::exti::ExtiInput; 6use embassy_stm32::exti::{self, ExtiInput};
7use embassy_stm32::gpio::Pull; 7use embassy_stm32::gpio::Pull;
8use embassy_stm32::{bind_interrupts, interrupt};
8use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
9 10
11bind_interrupts!(
12 pub struct Irqs{
13 EXTI4_15 => exti::InterruptHandler<interrupt::typelevel::EXTI4_15>;
14});
15
10#[embassy_executor::main] 16#[embassy_executor::main]
11async fn main(_spawner: Spawner) { 17async fn main(_spawner: Spawner) {
12 // Initialize and create handle for devicer peripherals 18 // Initialize and create handle for devicer peripherals
13 let p = embassy_stm32::init(Default::default()); 19 let p = embassy_stm32::init(Default::default());
14 // Configure the button pin and obtain handler. 20 // Configure the button pin and obtain handler.
15 // On the Nucleo F091RC there is a button connected to pin PC13. 21 // On the Nucleo F091RC there is a button connected to pin PC13.
16 let mut button = ExtiInput::new(p.PC13, p.EXTI13, Pull::Down); 22 let mut button = ExtiInput::new(p.PC13, p.EXTI13, Pull::Down, Irqs);
17 23
18 info!("Press the USER button..."); 24 info!("Press the USER button...");
19 loop { 25 loop {