summaryrefslogtreecommitdiff
path: root/examples/stm32f4/src
diff options
context:
space:
mode:
Diffstat (limited to 'examples/stm32f4/src')
-rw-r--r--examples/stm32f4/src/bin/adc.rs4
-rw-r--r--examples/stm32f4/src/bin/blinky.rs4
-rw-r--r--examples/stm32f4/src/bin/button_exti.rs4
-rw-r--r--examples/stm32f4/src/bin/dac.rs4
-rw-r--r--examples/stm32f4/src/bin/flash.rs4
-rw-r--r--examples/stm32f4/src/bin/hello.rs7
-rw-r--r--examples/stm32f4/src/bin/pwm.rs4
-rw-r--r--examples/stm32f4/src/bin/sdmmc.rs7
-rw-r--r--examples/stm32f4/src/bin/spi_dma.rs4
-rw-r--r--examples/stm32f4/src/bin/usart_buffered.rs5
-rw-r--r--examples/stm32f4/src/bin/usart_dma.rs4
-rw-r--r--examples/stm32f4/src/bin/wdt.rs4
12 files changed, 29 insertions, 26 deletions
diff --git a/examples/stm32f4/src/bin/adc.rs b/examples/stm32f4/src/bin/adc.rs
index 27ed4fcc..1dc01edd 100644
--- a/examples/stm32f4/src/bin/adc.rs
+++ b/examples/stm32f4/src/bin/adc.rs
@@ -6,11 +6,11 @@ use defmt::*;
use embassy_executor::executor::Spawner;
use embassy_executor::time::{Delay, Duration, Timer};
use embassy_stm32::adc::Adc;
-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 adc = Adc::new(p.ADC1, &mut Delay);
diff --git a/examples/stm32f4/src/bin/blinky.rs b/examples/stm32f4/src/bin/blinky.rs
index f71fe098..249bbd88 100644
--- a/examples/stm32f4/src/bin/blinky.rs
+++ b/examples/stm32f4/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.PB7, Level::High, Speed::Low);
diff --git a/examples/stm32f4/src/bin/button_exti.rs b/examples/stm32f4/src/bin/button_exti.rs
index 60dfb362..25d3bb9c 100644
--- a/examples/stm32f4/src/bin/button_exti.rs
+++ b/examples/stm32f4/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/stm32f4/src/bin/dac.rs b/examples/stm32f4/src/bin/dac.rs
index 392f5bf4..9098a971 100644
--- a/examples/stm32f4/src/bin/dac.rs
+++ b/examples/stm32f4/src/bin/dac.rs
@@ -5,11 +5,11 @@
use defmt::*;
use embassy_executor::executor::Spawner;
use embassy_stm32::dac::{Channel, Dac, Value};
-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, dude!");
let mut dac = Dac::new_1ch(p.DAC, p.PA4);
diff --git a/examples/stm32f4/src/bin/flash.rs b/examples/stm32f4/src/bin/flash.rs
index 4f780656..0d96efb6 100644
--- a/examples/stm32f4/src/bin/flash.rs
+++ b/examples/stm32f4/src/bin/flash.rs
@@ -5,12 +5,12 @@
use defmt::{info, unwrap};
use embassy_executor::executor::Spawner;
use embassy_stm32::flash::Flash;
-use embassy_stm32::Peripherals;
use embedded_storage::nor_flash::{NorFlash, ReadNorFlash};
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 Flash!");
let mut f = Flash::unlock(p.FLASH);
diff --git a/examples/stm32f4/src/bin/hello.rs b/examples/stm32f4/src/bin/hello.rs
index f957656e..6facb9bb 100644
--- a/examples/stm32f4/src/bin/hello.rs
+++ b/examples/stm32f4/src/bin/hello.rs
@@ -6,7 +6,7 @@ use defmt::info;
use embassy_executor::executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_stm32::time::Hertz;
-use embassy_stm32::{Config, Peripherals};
+use embassy_stm32::Config;
use {defmt_rtt as _, panic_probe as _};
fn config() -> Config {
@@ -15,8 +15,9 @@ fn config() -> Config {
config
}
-#[embassy_executor::main(config = "config()")]
-async fn main(_spawner: Spawner, _p: Peripherals) -> ! {
+#[embassy_executor::main]
+async fn main(_spawner: Spawner) -> ! {
+ let _p = embassy_stm32::init(config());
loop {
info!("Hello World!");
Timer::after(Duration::from_secs(1)).await;
diff --git a/examples/stm32f4/src/bin/pwm.rs b/examples/stm32f4/src/bin/pwm.rs
index 0b352c2b..1d4f426b 100644
--- a/examples/stm32f4/src/bin/pwm.rs
+++ b/examples/stm32f4/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.PE9);
diff --git a/examples/stm32f4/src/bin/sdmmc.rs b/examples/stm32f4/src/bin/sdmmc.rs
index 6eef1996..996694f2 100644
--- a/examples/stm32f4/src/bin/sdmmc.rs
+++ b/examples/stm32f4/src/bin/sdmmc.rs
@@ -6,7 +6,7 @@ use defmt::*;
use embassy_executor::executor::Spawner;
use embassy_stm32::sdmmc::Sdmmc;
use embassy_stm32::time::mhz;
-use embassy_stm32::{interrupt, Config, Peripherals};
+use embassy_stm32::{interrupt, Config};
use {defmt_rtt as _, panic_probe as _};
fn config() -> Config {
@@ -15,8 +15,9 @@ fn config() -> Config {
config
}
-#[embassy_executor::main(config = "config()")]
-async fn main(_spawner: Spawner, p: Peripherals) -> ! {
+#[embassy_executor::main]
+async fn main(_spawner: Spawner) -> ! {
+ let p = embassy_stm32::init(config());
info!("Hello World!");
let irq = interrupt::take!(SDIO);
diff --git a/examples/stm32f4/src/bin/spi_dma.rs b/examples/stm32f4/src/bin/spi_dma.rs
index 023ca097..f871c1d3 100644
--- a/examples/stm32f4/src/bin/spi_dma.rs
+++ b/examples/stm32f4/src/bin/spi_dma.rs
@@ -9,12 +9,12 @@ use defmt::*;
use embassy_executor::executor::Spawner;
use embassy_stm32::spi::{Config, Spi};
use embassy_stm32::time::Hertz;
-use embassy_stm32::Peripherals;
use heapless::String;
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 spi = Spi::new(
diff --git a/examples/stm32f4/src/bin/usart_buffered.rs b/examples/stm32f4/src/bin/usart_buffered.rs
index 2555998c..9c269ae2 100644
--- a/examples/stm32f4/src/bin/usart_buffered.rs
+++ b/examples/stm32f4/src/bin/usart_buffered.rs
@@ -5,13 +5,14 @@
use defmt::*;
use embassy_executor::executor::Spawner;
use embassy_stm32::dma::NoDma;
+use embassy_stm32::interrupt;
use embassy_stm32::usart::{BufferedUart, Config, State, Uart};
-use embassy_stm32::{interrupt, Peripherals};
use embedded_io::asynch::BufRead;
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 config = Config::default();
diff --git a/examples/stm32f4/src/bin/usart_dma.rs b/examples/stm32f4/src/bin/usart_dma.rs
index 7859ba2a..febdec6b 100644
--- a/examples/stm32f4/src/bin/usart_dma.rs
+++ b/examples/stm32f4/src/bin/usart_dma.rs
@@ -8,12 +8,12 @@ use defmt::*;
use embassy_executor::executor::Spawner;
use embassy_stm32::dma::NoDma;
use embassy_stm32::usart::{Config, Uart};
-use embassy_stm32::Peripherals;
use heapless::String;
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 config = Config::default();
diff --git a/examples/stm32f4/src/bin/wdt.rs b/examples/stm32f4/src/bin/wdt.rs
index 48394f4f..a5128525 100644
--- a/examples/stm32f4/src/bin/wdt.rs
+++ b/examples/stm32f4/src/bin/wdt.rs
@@ -7,11 +7,11 @@ use embassy_executor::executor::Spawner;
use embassy_executor::time::{Duration, Timer};
use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_stm32::wdg::IndependentWatchdog;
-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.PB7, Level::High, Speed::Low);