diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-08-17 20:27:42 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-08-17 20:27:42 +0000 |
| commit | 1c5b54a4823d596db730eb476c3ab78110557214 (patch) | |
| tree | 1d22c32eae26435677df89083d71f50fc298a09f /docs | |
| parent | d881f3ad9186cf3279aa1ba27093bad94035c186 (diff) | |
| parent | 2e85eaf7d5f4dcf6d84f426542b8ec87aa51c429 (diff) | |
Merge #908
908: Remove HAL initialization from #[embassy_executor::main] macro. r=Dirbaio a=Dirbaio
Co-authored-by: Dario Nieuwenhuis <[email protected]>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/modules/ROOT/examples/basic/src/main.rs | 5 | ||||
| -rw-r--r-- | docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/docs/modules/ROOT/examples/basic/src/main.rs b/docs/modules/ROOT/examples/basic/src/main.rs index cec39fd91..d680dd064 100644 --- a/docs/modules/ROOT/examples/basic/src/main.rs +++ b/docs/modules/ROOT/examples/basic/src/main.rs | |||
| @@ -7,7 +7,6 @@ use embassy_executor::executor::Spawner; | |||
| 7 | use embassy_executor::time::{Duration, Timer}; | 7 | use embassy_executor::time::{Duration, Timer}; |
| 8 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; | 8 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; |
| 9 | use embassy_nrf::peripherals::P0_13; | 9 | use embassy_nrf::peripherals::P0_13; |
| 10 | use embassy_nrf::Peripherals; | ||
| 11 | use {defmt_rtt as _, panic_probe as _}; // global logger | 10 | use {defmt_rtt as _, panic_probe as _}; // global logger |
| 12 | 11 | ||
| 13 | #[embassy_executor::task] | 12 | #[embassy_executor::task] |
| @@ -21,7 +20,9 @@ async fn blinker(mut led: Output<'static, P0_13>, interval: Duration) { | |||
| 21 | } | 20 | } |
| 22 | 21 | ||
| 23 | #[embassy_executor::main] | 22 | #[embassy_executor::main] |
| 24 | async fn main(spawner: Spawner, p: Peripherals) { | 23 | async fn main(spawner: Spawner) { |
| 24 | let p = embassy_nrf::init(Default::default()); | ||
| 25 | |||
| 25 | let led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); | 26 | let led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); |
| 26 | unwrap!(spawner.spawn(blinker(led, Duration::from_millis(300)))); | 27 | unwrap!(spawner.spawn(blinker(led, Duration::from_millis(300)))); |
| 27 | } | 28 | } |
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs b/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs index b944a7994..7d62b6107 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs +++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs | |||
| @@ -5,11 +5,11 @@ | |||
| 5 | use embassy_executor::executor::Spawner; | 5 | use embassy_executor::executor::Spawner; |
| 6 | use embassy_stm32::exti::ExtiInput; | 6 | use embassy_stm32::exti::ExtiInput; |
| 7 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 7 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; |
| 8 | use embassy_stm32::Peripherals; | ||
| 9 | use {defmt_rtt as _, panic_probe as _}; | 8 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 9 | ||
| 11 | #[embassy_executor::main] | 10 | #[embassy_executor::main] |
| 12 | async fn main(_s: Spawner, p: Peripherals) { | 11 | async fn main(_spawner: Spawner) { |
| 12 | let p = embassy_stm32::init(Default::default()); | ||
| 13 | let mut led = Output::new(p.PB14, Level::Low, Speed::VeryHigh); | 13 | let mut led = Output::new(p.PB14, Level::Low, Speed::VeryHigh); |
| 14 | let mut button = ExtiInput::new(Input::new(p.PC13, Pull::Up), p.EXTI13); | 14 | let mut button = ExtiInput::new(Input::new(p.PC13, Pull::Up), p.EXTI13); |
| 15 | 15 | ||
