summaryrefslogtreecommitdiff
path: root/examples/stm32g4/src
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/stm32g4/src
parentd881f3ad9186cf3279aa1ba27093bad94035c186 (diff)
downloadembassy-fc6e1e06b305d302d1b7ad17e8ef3a9be986c358.zip
Remove HAL initialization from #[embassy::main] macro.
Diffstat (limited to 'examples/stm32g4/src')
-rw-r--r--examples/stm32g4/src/bin/blinky.rs4
-rw-r--r--examples/stm32g4/src/bin/button_exti.rs4
-rw-r--r--examples/stm32g4/src/bin/pwm.rs4
3 files changed, 6 insertions, 6 deletions
diff --git a/examples/stm32g4/src/bin/blinky.rs b/examples/stm32g4/src/bin/blinky.rs
index ea3c563b..e905a311 100644
--- a/examples/stm32g4/src/bin/blinky.rs
+++ b/examples/stm32g4/src/bin/blinky.rs
@@ -6,11 +6,11 @@ use defmt::*;
use embassy_executor::executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_stm32::gpio::{Level, Output, Speed};
-use embassy_stm32::Peripherals;
use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main]
-async fn main(_spawner: Spawner, p: Peripherals) {
+async fn main(_spawner: Spawner) {
+ let p = embassy_stm32::init(Default::default());
info!("Hello World!");
let mut led = Output::new(p.PA5, Level::High, Speed::Low);
diff --git a/examples/stm32g4/src/bin/button_exti.rs b/examples/stm32g4/src/bin/button_exti.rs
index 60dfb362..25d3bb9c 100644
--- a/examples/stm32g4/src/bin/button_exti.rs
+++ b/examples/stm32g4/src/bin/button_exti.rs
@@ -6,11 +6,11 @@ use defmt::*;
use embassy_executor::executor::Spawner;
use embassy_stm32::exti::ExtiInput;
use embassy_stm32::gpio::{Input, Pull};
-use embassy_stm32::Peripherals;
use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main]
-async fn main(_spawner: Spawner, p: Peripherals) {
+async fn main(_spawner: Spawner) {
+ let p = embassy_stm32::init(Default::default());
info!("Hello World!");
let button = Input::new(p.PC13, Pull::Down);
diff --git a/examples/stm32g4/src/bin/pwm.rs b/examples/stm32g4/src/bin/pwm.rs
index 7c16d0a3..f10da3d6 100644
--- a/examples/stm32g4/src/bin/pwm.rs
+++ b/examples/stm32g4/src/bin/pwm.rs
@@ -8,11 +8,11 @@ use embassy_executor::time::{Duration, Timer};
use embassy_stm32::pwm::simple_pwm::{PwmPin, SimplePwm};
use embassy_stm32::pwm::Channel;
use embassy_stm32::time::khz;
-use embassy_stm32::Peripherals;
use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main]
-async fn main(_spawner: Spawner, p: Peripherals) {
+async fn main(_spawner: Spawner) {
+ let p = embassy_stm32::init(Default::default());
info!("Hello World!");
let ch1 = PwmPin::new_ch1(p.PA5);