diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-08-17 18:49:55 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-08-17 22:16:46 +0200 |
| commit | fc6e1e06b305d302d1b7ad17e8ef3a9be986c358 (patch) | |
| tree | 545ad829660f6053d29a01da286d03ec3d49f5ca /examples/stm32h7/src/bin/adc.rs | |
| parent | d881f3ad9186cf3279aa1ba27093bad94035c186 (diff) | |
Remove HAL initialization from #[embassy::main] macro.
Diffstat (limited to 'examples/stm32h7/src/bin/adc.rs')
| -rw-r--r-- | examples/stm32h7/src/bin/adc.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/stm32h7/src/bin/adc.rs b/examples/stm32h7/src/bin/adc.rs index f50976a30..96457e766 100644 --- a/examples/stm32h7/src/bin/adc.rs +++ b/examples/stm32h7/src/bin/adc.rs | |||
| @@ -8,7 +8,7 @@ use embassy_executor::time::{Delay, Duration, Timer}; | |||
| 8 | use embassy_stm32::adc::{Adc, SampleTime}; | 8 | use embassy_stm32::adc::{Adc, SampleTime}; |
| 9 | use embassy_stm32::rcc::AdcClockSource; | 9 | use embassy_stm32::rcc::AdcClockSource; |
| 10 | use embassy_stm32::time::mhz; | 10 | use embassy_stm32::time::mhz; |
| 11 | use embassy_stm32::{Config, Peripherals}; | 11 | use embassy_stm32::Config; |
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
| 14 | pub fn config() -> Config { | 14 | pub fn config() -> Config { |
| @@ -20,8 +20,9 @@ pub fn config() -> Config { | |||
| 20 | config | 20 | config |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | #[embassy_executor::main(config = "config()")] | 23 | #[embassy_executor::main] |
| 24 | async fn main(_spawner: Spawner, mut p: Peripherals) { | 24 | async fn main(_spawner: Spawner) { |
| 25 | let mut p = embassy_stm32::init(config()); | ||
| 25 | info!("Hello World!"); | 26 | info!("Hello World!"); |
| 26 | 27 | ||
| 27 | let mut adc = Adc::new(p.ADC3, &mut Delay); | 28 | let mut adc = Adc::new(p.ADC3, &mut Delay); |
