diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-04-08 03:15:27 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-04-08 03:15:27 +0200 |
| commit | 0c07d0375406c6079e4b143cd7ac380d0a2bfd5f (patch) | |
| tree | 68de96e3c66e3fd077aae60aa002f2b2941ee4af /examples/stm32wl/src/bin/blinky.rs | |
| parent | 50ff63ab888352b6818898617588cc844250c9b7 (diff) | |
Add missing stm32wl/stm32wb chips except stm32wle
Diffstat (limited to 'examples/stm32wl/src/bin/blinky.rs')
| -rw-r--r-- | examples/stm32wl/src/bin/blinky.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/examples/stm32wl/src/bin/blinky.rs b/examples/stm32wl/src/bin/blinky.rs new file mode 100644 index 000000000..78079bfd3 --- /dev/null +++ b/examples/stm32wl/src/bin/blinky.rs | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | |||
| 5 | use defmt::*; | ||
| 6 | use defmt_rtt as _; // global logger | ||
| 7 | use embassy::executor::Spawner; | ||
| 8 | use embassy::time::{Duration, Timer}; | ||
| 9 | use embassy_stm32::gpio::{Level, Output, Speed}; | ||
| 10 | use embassy_stm32::Peripherals; | ||
| 11 | use panic_probe as _; | ||
| 12 | |||
| 13 | #[embassy::main] | ||
| 14 | async fn main(_spawner: Spawner, p: Peripherals) { | ||
| 15 | info!("Hello World!"); | ||
| 16 | |||
| 17 | let mut led = Output::new(p.PB15, Level::High, Speed::Low); | ||
| 18 | |||
| 19 | loop { | ||
| 20 | info!("high"); | ||
| 21 | led.set_high(); | ||
| 22 | Timer::after(Duration::from_millis(500)).await; | ||
| 23 | |||
| 24 | info!("low"); | ||
| 25 | led.set_low(); | ||
| 26 | Timer::after(Duration::from_millis(500)).await; | ||
| 27 | } | ||
| 28 | } | ||
