diff options
Diffstat (limited to 'examples/stm32f3')
| -rw-r--r-- | examples/stm32f3/src/bin/blinky.rs | 4 | ||||
| -rw-r--r-- | examples/stm32f3/src/bin/button_events.rs | 4 | ||||
| -rw-r--r-- | examples/stm32f3/src/bin/button_exti.rs | 4 | ||||
| -rw-r--r-- | examples/stm32f3/src/bin/flash.rs | 4 | ||||
| -rw-r--r-- | examples/stm32f3/src/bin/hello.rs | 7 | ||||
| -rw-r--r-- | examples/stm32f3/src/bin/spi_dma.rs | 4 | ||||
| -rw-r--r-- | examples/stm32f3/src/bin/usart_dma.rs | 4 | ||||
| -rw-r--r-- | examples/stm32f3/src/bin/usb_serial.rs | 7 |
8 files changed, 20 insertions, 18 deletions
diff --git a/examples/stm32f3/src/bin/blinky.rs b/examples/stm32f3/src/bin/blinky.rs index 7146eaa54..84d7c50a6 100644 --- a/examples/stm32f3/src/bin/blinky.rs +++ b/examples/stm32f3/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.PA5, Level::High, Speed::Low); | 16 | let mut led = Output::new(p.PA5, Level::High, Speed::Low); |
diff --git a/examples/stm32f3/src/bin/button_events.rs b/examples/stm32f3/src/bin/button_events.rs index ef5110316..404946f2a 100644 --- a/examples/stm32f3/src/bin/button_events.rs +++ b/examples/stm32f3/src/bin/button_events.rs | |||
| @@ -16,7 +16,6 @@ use embassy_executor::time::{with_timeout, Duration, Timer}; | |||
| 16 | use embassy_stm32::exti::ExtiInput; | 16 | use embassy_stm32::exti::ExtiInput; |
| 17 | use embassy_stm32::gpio::{AnyPin, Input, Level, Output, Pin, Pull, Speed}; | 17 | use embassy_stm32::gpio::{AnyPin, Input, Level, Output, Pin, Pull, Speed}; |
| 18 | use embassy_stm32::peripherals::PA0; | 18 | use embassy_stm32::peripherals::PA0; |
| 19 | use embassy_stm32::Peripherals; | ||
| 20 | use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; | 19 | use embassy_util::blocking_mutex::raw::ThreadModeRawMutex; |
| 21 | use embassy_util::channel::mpmc::Channel; | 20 | use embassy_util::channel::mpmc::Channel; |
| 22 | use {defmt_rtt as _, panic_probe as _}; | 21 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -100,7 +99,8 @@ enum ButtonEvent { | |||
| 100 | static CHANNEL: Channel<ThreadModeRawMutex, ButtonEvent, 4> = Channel::new(); | 99 | static CHANNEL: Channel<ThreadModeRawMutex, ButtonEvent, 4> = Channel::new(); |
| 101 | 100 | ||
| 102 | #[embassy_executor::main] | 101 | #[embassy_executor::main] |
| 103 | async fn main(spawner: Spawner, p: Peripherals) { | 102 | async fn main(spawner: Spawner) { |
| 103 | let p = embassy_stm32::init(Default::default()); | ||
| 104 | let button = Input::new(p.PA0, Pull::Down); | 104 | let button = Input::new(p.PA0, Pull::Down); |
| 105 | let button = ExtiInput::new(button, p.EXTI0); | 105 | let button = ExtiInput::new(button, p.EXTI0); |
| 106 | info!("Press the USER button..."); | 106 | info!("Press the USER button..."); |
diff --git a/examples/stm32f3/src/bin/button_exti.rs b/examples/stm32f3/src/bin/button_exti.rs index dee06e5de..b770b338b 100644 --- a/examples/stm32f3/src/bin/button_exti.rs +++ b/examples/stm32f3/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::Down); | 16 | let button = Input::new(p.PA0, Pull::Down); |
diff --git a/examples/stm32f3/src/bin/flash.rs b/examples/stm32f3/src/bin/flash.rs index be2f6f671..c7982884f 100644 --- a/examples/stm32f3/src/bin/flash.rs +++ b/examples/stm32f3/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 = 0x26000; | 16 | const ADDR: u32 = 0x26000; |
diff --git a/examples/stm32f3/src/bin/hello.rs b/examples/stm32f3/src/bin/hello.rs index bd9953a0e..7846912c9 100644 --- a/examples/stm32f3/src/bin/hello.rs +++ b/examples/stm32f3/src/bin/hello.rs | |||
| @@ -6,7 +6,7 @@ use defmt::info; | |||
| 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::time::Hertz; | 8 | use embassy_stm32::time::Hertz; |
| 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 { |
| @@ -16,8 +16,9 @@ fn config() -> Config { | |||
| 16 | config | 16 | config |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | #[embassy_executor::main(config = "config()")] | 19 | #[embassy_executor::main] |
| 20 | async fn main(_spawner: Spawner, _p: Peripherals) -> ! { | 20 | async fn main(_spawner: Spawner) -> ! { |
| 21 | let _p = embassy_stm32::init(config()); | ||
| 21 | loop { | 22 | loop { |
| 22 | info!("Hello World!"); | 23 | info!("Hello World!"); |
| 23 | Timer::after(Duration::from_secs(1)).await; | 24 | Timer::after(Duration::from_secs(1)).await; |
diff --git a/examples/stm32f3/src/bin/spi_dma.rs b/examples/stm32f3/src/bin/spi_dma.rs index f554c509a..7f874bb66 100644 --- a/examples/stm32f3/src/bin/spi_dma.rs +++ b/examples/stm32f3/src/bin/spi_dma.rs | |||
| @@ -9,12 +9,12 @@ use defmt::*; | |||
| 9 | use embassy_executor::executor::Spawner; | 9 | use embassy_executor::executor::Spawner; |
| 10 | use embassy_stm32::spi::{Config, Spi}; | 10 | use embassy_stm32::spi::{Config, Spi}; |
| 11 | use embassy_stm32::time::Hertz; | 11 | use embassy_stm32::time::Hertz; |
| 12 | use embassy_stm32::Peripherals; | ||
| 13 | use heapless::String; | 12 | use heapless::String; |
| 14 | use {defmt_rtt as _, panic_probe as _}; | 13 | use {defmt_rtt as _, panic_probe as _}; |
| 15 | 14 | ||
| 16 | #[embassy_executor::main] | 15 | #[embassy_executor::main] |
| 17 | async fn main(_spawner: Spawner, p: Peripherals) { | 16 | async fn main(_spawner: Spawner) { |
| 17 | let p = embassy_stm32::init(Default::default()); | ||
| 18 | info!("Hello World!"); | 18 | info!("Hello World!"); |
| 19 | 19 | ||
| 20 | let mut spi = Spi::new( | 20 | let mut spi = Spi::new( |
diff --git a/examples/stm32f3/src/bin/usart_dma.rs b/examples/stm32f3/src/bin/usart_dma.rs index 62d165029..2b27a8daa 100644 --- a/examples/stm32f3/src/bin/usart_dma.rs +++ b/examples/stm32f3/src/bin/usart_dma.rs | |||
| @@ -8,12 +8,12 @@ use defmt::*; | |||
| 8 | use embassy_executor::executor::Spawner; | 8 | use embassy_executor::executor::Spawner; |
| 9 | use embassy_stm32::dma::NoDma; | 9 | use embassy_stm32::dma::NoDma; |
| 10 | use embassy_stm32::usart::{Config, Uart}; | 10 | use embassy_stm32::usart::{Config, Uart}; |
| 11 | use embassy_stm32::Peripherals; | ||
| 12 | use heapless::String; | 11 | use heapless::String; |
| 13 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 14 | 13 | ||
| 15 | #[embassy_executor::main] | 14 | #[embassy_executor::main] |
| 16 | async fn main(_spawner: Spawner, p: Peripherals) { | 15 | async fn main(_spawner: Spawner) { |
| 16 | let p = embassy_stm32::init(Default::default()); | ||
| 17 | info!("Hello World!"); | 17 | info!("Hello World!"); |
| 18 | 18 | ||
| 19 | let config = Config::default(); | 19 | let config = Config::default(); |
diff --git a/examples/stm32f3/src/bin/usb_serial.rs b/examples/stm32f3/src/bin/usb_serial.rs index 87b1138f5..36d38d87f 100644 --- a/examples/stm32f3/src/bin/usb_serial.rs +++ b/examples/stm32f3/src/bin/usb_serial.rs | |||
| @@ -8,7 +8,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::time::mhz; | 9 | use embassy_stm32::time::mhz; |
| 10 | use embassy_stm32::usb::{Driver, Instance}; | 10 | use embassy_stm32::usb::{Driver, Instance}; |
| 11 | use embassy_stm32::{interrupt, Config, Peripherals}; | 11 | use embassy_stm32::{interrupt, Config}; |
| 12 | use embassy_usb::driver::EndpointError; | 12 | use embassy_usb::driver::EndpointError; |
| 13 | use embassy_usb::Builder; | 13 | use embassy_usb::Builder; |
| 14 | use embassy_usb_serial::{CdcAcmClass, State}; | 14 | use embassy_usb_serial::{CdcAcmClass, State}; |
| @@ -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 | info!("Hello World!"); | 33 | info!("Hello World!"); |
| 33 | 34 | ||
| 34 | // Needed for nucleo-stm32f303ze | 35 | // Needed for nucleo-stm32f303ze |
