summaryrefslogtreecommitdiff
path: root/examples/boot/application/stm32h7
diff options
context:
space:
mode:
authorDario Nieuwenhuis <dirbaio@dirbaio.net>2022-08-17 18:49:55 +0200
committerDario Nieuwenhuis <dirbaio@dirbaio.net>2022-08-17 22:16:46 +0200
commitfc6e1e06b305d302d1b7ad17e8ef3a9be986c358 (patch)
tree545ad829660f6053d29a01da286d03ec3d49f5ca /examples/boot/application/stm32h7
parentd881f3ad9186cf3279aa1ba27093bad94035c186 (diff)
downloadembassy-fc6e1e06b305d302d1b7ad17e8ef3a9be986c358.zip
Remove HAL initialization from #[embassy::main] macro.
Diffstat (limited to 'examples/boot/application/stm32h7')
-rw-r--r--examples/boot/application/stm32h7/src/bin/a.rs5
-rw-r--r--examples/boot/application/stm32h7/src/bin/b.rs4
2 files changed, 5 insertions, 4 deletions
diff --git a/examples/boot/application/stm32h7/src/bin/a.rs b/examples/boot/application/stm32h7/src/bin/a.rs
index cc363bb3..8407adac 100644
--- a/examples/boot/application/stm32h7/src/bin/a.rs
+++ b/examples/boot/application/stm32h7/src/bin/a.rs
@@ -6,16 +6,17 @@
use defmt_rtt::*;
use embassy_boot_stm32::FirmwareUpdater;
use embassy_embedded_hal::adapter::BlockingAsync;
+use embassy_executor::executor::Spawner;
use embassy_stm32::exti::ExtiInput;
use embassy_stm32::flash::Flash;
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
-use embassy_stm32::Peripherals;
use panic_reset as _;
static APP_B: &[u8] = include_bytes!("../../b.bin");
#[embassy_executor::main]
-async fn main(_s: embassy_executor::executor::Spawner, p: Peripherals) {
+async fn main(_spawner: Spawner) {
+ let p = embassy_stm32::init(Default::default());
let flash = Flash::unlock(p.FLASH);
let mut flash = BlockingAsync::new(flash);
diff --git a/examples/boot/application/stm32h7/src/bin/b.rs b/examples/boot/application/stm32h7/src/bin/b.rs
index 3fa63bdc..cc694e84 100644
--- a/examples/boot/application/stm32h7/src/bin/b.rs
+++ b/examples/boot/application/stm32h7/src/bin/b.rs
@@ -7,11 +7,11 @@ use defmt_rtt::*;
use embassy_executor::executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_stm32::gpio::{Level, Output, Speed};
-use embassy_stm32::Peripherals;
use panic_reset as _;
#[embassy_executor::main]
-async fn main(_spawner: Spawner, p: Peripherals) {
+async fn main(_spawner: Spawner) {
+ let p = embassy_stm32::init(Default::default());
Timer::after(Duration::from_millis(300)).await;
let mut led = Output::new(p.PB14, Level::High, Speed::Low);
led.set_high();