aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32n6/src
diff options
context:
space:
mode:
authoreverdrone <[email protected]>2025-11-11 15:48:56 +0100
committereverdrone <[email protected]>2025-11-11 15:48:56 +0100
commitcede7216861a82b0db55f5a88afb3acf2ace6c4b (patch)
treed92fb578897c77f51317318c5b180931b7b25c63 /examples/stm32n6/src
parentcf55b39f9a54cf3ed01f52c0565a36a444174235 (diff)
parent3d1f09597335d3681699ba09a77da4b39ed984fd (diff)
Merge branch main into n6
Diffstat (limited to 'examples/stm32n6/src')
-rw-r--r--examples/stm32n6/src/bin/blinky.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/examples/stm32n6/src/bin/blinky.rs b/examples/stm32n6/src/bin/blinky.rs
new file mode 100644
index 000000000..018967f08
--- /dev/null
+++ b/examples/stm32n6/src/bin/blinky.rs
@@ -0,0 +1,36 @@
1#![no_std]
2#![no_main]
3
4use defmt::*;
5use embassy_executor::Spawner;
6use embassy_stm32::exti::ExtiInput;
7use embassy_stm32::gpio::{Level, Output, Pull, Speed};
8use embassy_time::Timer;
9use {defmt_rtt as _, panic_probe as _};
10
11#[embassy_executor::task]
12async fn button_task(mut p: ExtiInput<'static>) {
13 loop {
14 p.wait_for_any_edge().await;
15 info!("button pressed!");
16 }
17}
18
19#[embassy_executor::main]
20async fn main(spawner: Spawner) {
21 let p = embassy_stm32::init(Default::default());
22 info!("Hello World!");
23
24 let mut led = Output::new(p.PG10, Level::High, Speed::Low);
25 let button = ExtiInput::new(p.PC13, p.EXTI13, Pull::Up);
26
27 spawner.spawn(button_task(button).unwrap());
28
29 loop {
30 led.set_high();
31 Timer::after_millis(500).await;
32
33 led.set_low();
34 Timer::after_millis(500).await;
35 }
36}