diff options
| author | WillaWillNot <[email protected]> | 2025-11-20 16:24:15 -0500 |
|---|---|---|
| committer | WillaWillNot <[email protected]> | 2025-11-21 16:36:15 -0500 |
| commit | 623623a25f213f76de932eaf4458c3120823d205 (patch) | |
| tree | a1039bcdb29488180f4fe669f16ac0b33370404e /examples/stm32n6 | |
| parent | de4d7f56473df58d9b3fa8ec4917ab86550005ae (diff) | |
Updated documentation, fixed EXTI definition issues with chips that have touch sensing, updated examples, added generation of convenience method to bind_interrupts for easier type erasure
Diffstat (limited to 'examples/stm32n6')
| -rw-r--r-- | examples/stm32n6/src/bin/blinky.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/examples/stm32n6/src/bin/blinky.rs b/examples/stm32n6/src/bin/blinky.rs index 018967f08..c72e45628 100644 --- a/examples/stm32n6/src/bin/blinky.rs +++ b/examples/stm32n6/src/bin/blinky.rs | |||
| @@ -3,11 +3,18 @@ | |||
| 3 | 3 | ||
| 4 | use defmt::*; | 4 | use defmt::*; |
| 5 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
| 6 | use embassy_stm32::exti::ExtiInput; | 6 | use embassy_stm32::bind_interrupts; |
| 7 | use embassy_stm32::exti::{self, ExtiInput}; | ||
| 7 | use embassy_stm32::gpio::{Level, Output, Pull, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Pull, Speed}; |
| 9 | use embassy_stm32::interrupt; | ||
| 8 | use embassy_time::Timer; | 10 | use embassy_time::Timer; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 12 | ||
| 13 | bind_interrupts!( | ||
| 14 | pub struct Irqs{ | ||
| 15 | EXTI13 => exti::InterruptHandler<interrupt::typelevel::EXTI13>; | ||
| 16 | }); | ||
| 17 | |||
| 11 | #[embassy_executor::task] | 18 | #[embassy_executor::task] |
| 12 | async fn button_task(mut p: ExtiInput<'static>) { | 19 | async fn button_task(mut p: ExtiInput<'static>) { |
| 13 | loop { | 20 | loop { |
| @@ -22,7 +29,12 @@ async fn main(spawner: Spawner) { | |||
| 22 | info!("Hello World!"); | 29 | info!("Hello World!"); |
| 23 | 30 | ||
| 24 | let mut led = Output::new(p.PG10, Level::High, Speed::Low); | 31 | let mut led = Output::new(p.PG10, Level::High, Speed::Low); |
| 25 | let button = ExtiInput::new(p.PC13, p.EXTI13, Pull::Up); | 32 | let button = ExtiInput::new( |
| 33 | p.PC13, | ||
| 34 | p.EXTI13, | ||
| 35 | Pull::Up, | ||
| 36 | Irqs::as_any::<interrupt::typelevel::EXTI13, exti::InterruptHandler<interrupt::typelevel::EXTI13>>(), | ||
| 37 | ); | ||
| 26 | 38 | ||
| 27 | spawner.spawn(button_task(button).unwrap()); | 39 | spawner.spawn(button_task(button).unwrap()); |
| 28 | 40 | ||
