diff options
Diffstat (limited to 'examples/stm32wl/src')
| -rw-r--r-- | examples/stm32wl/src/bin/blinky.rs | 4 | ||||
| -rw-r--r-- | examples/stm32wl/src/bin/button_exti.rs | 4 | ||||
| -rw-r--r-- | examples/stm32wl/src/bin/flash.rs | 4 | ||||
| -rw-r--r-- | examples/stm32wl/src/bin/lorawan.rs | 8 | ||||
| -rw-r--r-- | examples/stm32wl/src/bin/subghz.rs | 8 |
5 files changed, 16 insertions, 12 deletions
diff --git a/examples/stm32wl/src/bin/blinky.rs b/examples/stm32wl/src/bin/blinky.rs index e764b4cc3..4b8588bbc 100644 --- a/examples/stm32wl/src/bin/blinky.rs +++ b/examples/stm32wl/src/bin/blinky.rs | |||
| @@ -6,11 +6,11 @@ use defmt::*; | |||
| 6 | use embassy_executor::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_executor::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 9 | use embassy_stm32::Peripherals; | ||
| 10 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 10 | ||
| 12 | #[embassy_executor::main] | 11 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 12 | async fn main(_spawner: Spawner) { |
| 13 | let p = embassy_stm32::init(Default::default()); | ||
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
| 16 | let mut led = Output::new(p.PB15, Level::High, Speed::Low); | 16 | let mut led = Output::new(p.PB15, Level::High, Speed::Low); |
diff --git a/examples/stm32wl/src/bin/button_exti.rs b/examples/stm32wl/src/bin/button_exti.rs index 9f143597d..ebc255626 100644 --- a/examples/stm32wl/src/bin/button_exti.rs +++ b/examples/stm32wl/src/bin/button_exti.rs | |||
| @@ -6,11 +6,11 @@ use defmt::*; | |||
| 6 | use embassy_executor::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::exti::ExtiInput; | 7 | use embassy_stm32::exti::ExtiInput; |
| 8 | use embassy_stm32::gpio::{Input, Pull}; | 8 | use embassy_stm32::gpio::{Input, Pull}; |
| 9 | use embassy_stm32::Peripherals; | ||
| 10 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 10 | ||
| 12 | #[embassy_executor::main] | 11 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 12 | async fn main(_spawner: Spawner) { |
| 13 | let p = embassy_stm32::init(Default::default()); | ||
| 14 | info!("Hello World!"); | 14 | info!("Hello World!"); |
| 15 | 15 | ||
| 16 | let button = Input::new(p.PA0, Pull::Up); | 16 | let button = Input::new(p.PA0, Pull::Up); |
diff --git a/examples/stm32wl/src/bin/flash.rs b/examples/stm32wl/src/bin/flash.rs index 46183b8a2..3c4da1e9b 100644 --- a/examples/stm32wl/src/bin/flash.rs +++ b/examples/stm32wl/src/bin/flash.rs | |||
| @@ -5,12 +5,12 @@ | |||
| 5 | use defmt::{info, unwrap}; | 5 | use defmt::{info, unwrap}; |
| 6 | use embassy_executor::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::flash::Flash; | 7 | use embassy_stm32::flash::Flash; |
| 8 | use embassy_stm32::Peripherals; | ||
| 9 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; | 8 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 10 | ||
| 12 | #[embassy_executor::main] | 11 | #[embassy_executor::main] |
| 13 | async fn main(_spawner: Spawner, p: Peripherals) { | 12 | async fn main(_spawner: Spawner) { |
| 13 | let p = embassy_stm32::init(Default::default()); | ||
| 14 | info!("Hello Flash!"); | 14 | info!("Hello Flash!"); |
| 15 | 15 | ||
| 16 | const ADDR: u32 = 0x36000; | 16 | const ADDR: u32 = 0x36000; |
diff --git a/examples/stm32wl/src/bin/lorawan.rs b/examples/stm32wl/src/bin/lorawan.rs index 2db022ea2..35dae71a6 100644 --- a/examples/stm32wl/src/bin/lorawan.rs +++ b/examples/stm32wl/src/bin/lorawan.rs | |||
| @@ -5,13 +5,14 @@ | |||
| 5 | #![feature(generic_associated_types)] | 5 | #![feature(generic_associated_types)] |
| 6 | #![feature(type_alias_impl_trait)] | 6 | #![feature(type_alias_impl_trait)] |
| 7 | 7 | ||
| 8 | use embassy_executor::executor::Spawner; | ||
| 8 | use embassy_lora::stm32wl::*; | 9 | use embassy_lora::stm32wl::*; |
| 9 | use embassy_lora::LoraTimer; | 10 | use embassy_lora::LoraTimer; |
| 10 | use embassy_stm32::dma::NoDma; | 11 | use embassy_stm32::dma::NoDma; |
| 11 | use embassy_stm32::gpio::{Level, Output, Pin, Speed}; | 12 | use embassy_stm32::gpio::{Level, Output, Pin, Speed}; |
| 12 | use embassy_stm32::rng::Rng; | 13 | use embassy_stm32::rng::Rng; |
| 13 | use embassy_stm32::subghz::*; | 14 | use embassy_stm32::subghz::*; |
| 14 | use embassy_stm32::{interrupt, pac, Peripherals}; | 15 | use embassy_stm32::{interrupt, pac}; |
| 15 | use lorawan::default_crypto::DefaultFactory as Crypto; | 16 | use lorawan::default_crypto::DefaultFactory as Crypto; |
| 16 | use lorawan_device::async_device::{region, Device, JoinMode}; | 17 | use lorawan_device::async_device::{region, Device, JoinMode}; |
| 17 | use {defmt_rtt as _, panic_probe as _}; | 18 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -23,8 +24,9 @@ fn config() -> embassy_stm32::Config { | |||
| 23 | config | 24 | config |
| 24 | } | 25 | } |
| 25 | 26 | ||
| 26 | #[embassy_executor::main(config = "config()")] | 27 | #[embassy_executor::main] |
| 27 | async fn main(_spawner: embassy_executor::executor::Spawner, p: Peripherals) { | 28 | async fn main(_spawner: Spawner) { |
| 29 | let p = embassy_stm32::init(config()); | ||
| 28 | unsafe { pac::RCC.ccipr().modify(|w| w.set_rngsel(0b01)) } | 30 | unsafe { pac::RCC.ccipr().modify(|w| w.set_rngsel(0b01)) } |
| 29 | 31 | ||
| 30 | let ctrl1 = Output::new(p.PC3.degrade(), Level::High, Speed::High); | 32 | let ctrl1 = Output::new(p.PC3.degrade(), Level::High, Speed::High); |
diff --git a/examples/stm32wl/src/bin/subghz.rs b/examples/stm32wl/src/bin/subghz.rs index 775dfbbfc..0e2d4103f 100644 --- a/examples/stm32wl/src/bin/subghz.rs +++ b/examples/stm32wl/src/bin/subghz.rs | |||
| @@ -6,12 +6,13 @@ | |||
| 6 | #![feature(type_alias_impl_trait)] | 6 | #![feature(type_alias_impl_trait)] |
| 7 | 7 | ||
| 8 | use defmt::*; | 8 | use defmt::*; |
| 9 | use embassy_executor::executor::Spawner; | ||
| 9 | use embassy_stm32::dma::NoDma; | 10 | use embassy_stm32::dma::NoDma; |
| 10 | use embassy_stm32::exti::ExtiInput; | 11 | use embassy_stm32::exti::ExtiInput; |
| 11 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 12 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; |
| 13 | use embassy_stm32::interrupt; | ||
| 12 | use embassy_stm32::interrupt::{Interrupt, InterruptExt}; | 14 | use embassy_stm32::interrupt::{Interrupt, InterruptExt}; |
| 13 | use embassy_stm32::subghz::*; | 15 | use embassy_stm32::subghz::*; |
| 14 | use embassy_stm32::{interrupt, Peripherals}; | ||
| 15 | use embassy_util::channel::signal::Signal; | 16 | use embassy_util::channel::signal::Signal; |
| 16 | use {defmt_rtt as _, panic_probe as _}; | 17 | use {defmt_rtt as _, panic_probe as _}; |
| 17 | 18 | ||
| @@ -57,8 +58,9 @@ fn config() -> embassy_stm32::Config { | |||
| 57 | config | 58 | config |
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | #[embassy_executor::main(config = "config()")] | 61 | #[embassy_executor::main] |
| 61 | async fn main(_spawner: embassy_executor::executor::Spawner, p: Peripherals) { | 62 | async fn main(_spawner: Spawner) { |
| 63 | let p = embassy_stm32::init(config()); | ||
| 62 | let mut led1 = Output::new(p.PB15, Level::High, Speed::Low); | 64 | let mut led1 = Output::new(p.PB15, Level::High, Speed::Low); |
| 63 | let mut led2 = Output::new(p.PB9, Level::Low, Speed::Low); | 65 | let mut led2 = Output::new(p.PB9, Level::Low, Speed::Low); |
| 64 | let mut led3 = Output::new(p.PB11, Level::Low, Speed::Low); | 66 | let mut led3 = Output::new(p.PB11, Level::Low, Speed::Low); |
