diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-08-17 18:49:55 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-08-17 22:16:46 +0200 |
| commit | fc6e1e06b305d302d1b7ad17e8ef3a9be986c358 (patch) | |
| tree | 545ad829660f6053d29a01da286d03ec3d49f5ca /examples/stm32l5 | |
| parent | d881f3ad9186cf3279aa1ba27093bad94035c186 (diff) | |
Remove HAL initialization from #[embassy::main] macro.
Diffstat (limited to 'examples/stm32l5')
| -rw-r--r-- | examples/stm32l5/src/bin/button_exti.rs | 4 | ||||
| -rw-r--r-- | examples/stm32l5/src/bin/rng.rs | 7 | ||||
| -rw-r--r-- | examples/stm32l5/src/bin/usb_ethernet.rs | 7 | ||||
| -rw-r--r-- | examples/stm32l5/src/bin/usb_hid_mouse.rs | 5 | ||||
| -rw-r--r-- | examples/stm32l5/src/bin/usb_serial.rs | 7 |
5 files changed, 17 insertions, 13 deletions
diff --git a/examples/stm32l5/src/bin/button_exti.rs b/examples/stm32l5/src/bin/button_exti.rs index 99462e597..ac3942521 100644 --- a/examples/stm32l5/src/bin/button_exti.rs +++ b/examples/stm32l5/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.PC13, Pull::Down); | 16 | let button = Input::new(p.PC13, Pull::Down); |
diff --git a/examples/stm32l5/src/bin/rng.rs b/examples/stm32l5/src/bin/rng.rs index 45094374b..b7919424a 100644 --- a/examples/stm32l5/src/bin/rng.rs +++ b/examples/stm32l5/src/bin/rng.rs | |||
| @@ -6,7 +6,7 @@ use defmt::*; | |||
| 6 | use embassy_executor::executor::Spawner; | 6 | use embassy_executor::executor::Spawner; |
| 7 | use embassy_stm32::rcc::{ClockSrc, PLLClkDiv, PLLMul, PLLSource, PLLSrcDiv}; | 7 | use embassy_stm32::rcc::{ClockSrc, PLLClkDiv, PLLMul, PLLSource, PLLSrcDiv}; |
| 8 | use embassy_stm32::rng::Rng; | 8 | use embassy_stm32::rng::Rng; |
| 9 | use embassy_stm32::{Config, Peripherals}; | 9 | use embassy_stm32::Config; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | fn config() -> Config { | 12 | fn config() -> Config { |
| @@ -21,8 +21,9 @@ fn config() -> Config { | |||
| 21 | config | 21 | config |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | #[embassy_executor::main(config = "config()")] | 24 | #[embassy_executor::main] |
| 25 | async fn main(_spawner: Spawner, p: Peripherals) { | 25 | async fn main(_spawner: Spawner) { |
| 26 | let p = embassy_stm32::init(config()); | ||
| 26 | info!("Hello World!"); | 27 | info!("Hello World!"); |
| 27 | 28 | ||
| 28 | let mut rng = Rng::new(p.RNG); | 29 | let mut rng = Rng::new(p.RNG); |
diff --git a/examples/stm32l5/src/bin/usb_ethernet.rs b/examples/stm32l5/src/bin/usb_ethernet.rs index 9e1df15dd..cc7578990 100644 --- a/examples/stm32l5/src/bin/usb_ethernet.rs +++ b/examples/stm32l5/src/bin/usb_ethernet.rs | |||
| @@ -14,7 +14,7 @@ use embassy_stm32::rcc::*; | |||
| 14 | use embassy_stm32::rng::Rng; | 14 | use embassy_stm32::rng::Rng; |
| 15 | use embassy_stm32::time::Hertz; | 15 | use embassy_stm32::time::Hertz; |
| 16 | use embassy_stm32::usb::Driver; | 16 | use embassy_stm32::usb::Driver; |
| 17 | use embassy_stm32::{interrupt, Config, Peripherals}; | 17 | use embassy_stm32::{interrupt, Config}; |
| 18 | use embassy_usb::{Builder, UsbDevice}; | 18 | use embassy_usb::{Builder, UsbDevice}; |
| 19 | use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State}; | 19 | use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State}; |
| 20 | use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; | 20 | use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; |
| @@ -93,8 +93,9 @@ fn config() -> Config { | |||
| 93 | config | 93 | config |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | #[embassy_executor::main(config = "config()")] | 96 | #[embassy_executor::main] |
| 97 | async fn main(spawner: Spawner, p: Peripherals) { | 97 | async fn main(spawner: Spawner) { |
| 98 | let p = embassy_stm32::init(config()); | ||
| 98 | // Create the driver, from the HAL. | 99 | // Create the driver, from the HAL. |
| 99 | let irq = interrupt::take!(USB_FS); | 100 | let irq = interrupt::take!(USB_FS); |
| 100 | let driver = Driver::new(p.USB, irq, p.PA12, p.PA11); | 101 | let driver = Driver::new(p.USB, irq, p.PA12, p.PA11); |
diff --git a/examples/stm32l5/src/bin/usb_hid_mouse.rs b/examples/stm32l5/src/bin/usb_hid_mouse.rs index 6aac00881..b8eef6d0d 100644 --- a/examples/stm32l5/src/bin/usb_hid_mouse.rs +++ b/examples/stm32l5/src/bin/usb_hid_mouse.rs | |||
| @@ -27,8 +27,9 @@ fn config() -> Config { | |||
| 27 | config | 27 | config |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | #[embassy_executor::main(config = "config()")] | 30 | #[embassy_executor::main] |
| 31 | async fn main(_spawner: Spawner, p: Peripherals) { | 31 | async fn main(_spawner: Spawner) { |
| 32 | let p = embassy_stm32::init(config()); | ||
| 32 | // Create the driver, from the HAL. | 33 | // Create the driver, from the HAL. |
| 33 | let irq = interrupt::take!(USB_FS); | 34 | let irq = interrupt::take!(USB_FS); |
| 34 | let driver = Driver::new(p.USB, irq, p.PA12, p.PA11); | 35 | let driver = Driver::new(p.USB, irq, p.PA12, p.PA11); |
diff --git a/examples/stm32l5/src/bin/usb_serial.rs b/examples/stm32l5/src/bin/usb_serial.rs index 508bce8a8..f8894231c 100644 --- a/examples/stm32l5/src/bin/usb_serial.rs +++ b/examples/stm32l5/src/bin/usb_serial.rs | |||
| @@ -7,7 +7,7 @@ use embassy_executor::executor::Spawner; | |||
| 7 | use embassy_stm32::rcc::*; | 7 | use embassy_stm32::rcc::*; |
| 8 | use embassy_stm32::time::Hertz; | 8 | use embassy_stm32::time::Hertz; |
| 9 | use embassy_stm32::usb::{Driver, Instance}; | 9 | use embassy_stm32::usb::{Driver, Instance}; |
| 10 | use embassy_stm32::{interrupt, Config, Peripherals}; | 10 | use embassy_stm32::{interrupt, Config}; |
| 11 | use embassy_usb::driver::EndpointError; | 11 | use embassy_usb::driver::EndpointError; |
| 12 | use embassy_usb::Builder; | 12 | use embassy_usb::Builder; |
| 13 | use embassy_usb_serial::{CdcAcmClass, State}; | 13 | use embassy_usb_serial::{CdcAcmClass, State}; |
| @@ -24,8 +24,9 @@ fn config() -> Config { | |||
| 24 | config | 24 | config |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | #[embassy_executor::main(config = "config()")] | 27 | #[embassy_executor::main] |
| 28 | async fn main(_spawner: Spawner, p: Peripherals) { | 28 | async fn main(_spawner: Spawner) { |
| 29 | let p = embassy_stm32::init(config()); | ||
| 29 | info!("Hello World!"); | 30 | info!("Hello World!"); |
| 30 | 31 | ||
| 31 | // Create the driver, from the HAL. | 32 | // Create the driver, from the HAL. |
