diff options
| -rw-r--r-- | embassy-stm32/src/rcc/f0/mod.rs | 10 | ||||
| -rw-r--r-- | examples/stm32f0/src/bin/hello.rs | 2 | ||||
| -rw-r--r-- | examples/stm32f0/src/example_common.rs | 8 |
3 files changed, 12 insertions, 8 deletions
diff --git a/embassy-stm32/src/rcc/f0/mod.rs b/embassy-stm32/src/rcc/f0/mod.rs index 870fe42cf..6600a1e28 100644 --- a/embassy-stm32/src/rcc/f0/mod.rs +++ b/embassy-stm32/src/rcc/f0/mod.rs | |||
| @@ -2,7 +2,8 @@ use core::marker::PhantomData; | |||
| 2 | 2 | ||
| 3 | use embassy::util::Unborrow; | 3 | use embassy::util::Unborrow; |
| 4 | 4 | ||
| 5 | use crate::pac::{DBGMCU, FLASH, RCC}; | 5 | use crate::dbgmcu::Dbgmcu; |
| 6 | use crate::pac::{FLASH, RCC}; | ||
| 6 | use crate::peripherals; | 7 | use crate::peripherals; |
| 7 | use crate::time::Hertz; | 8 | use crate::time::Hertz; |
| 8 | 9 | ||
| @@ -193,12 +194,7 @@ impl<'d> Rcc<'d> { | |||
| 193 | if self.config.enable_debug_wfe { | 194 | if self.config.enable_debug_wfe { |
| 194 | RCC.ahbenr().modify(|w| w.set_dmaen(true)); | 195 | RCC.ahbenr().modify(|w| w.set_dmaen(true)); |
| 195 | 196 | ||
| 196 | critical_section::with(|_| { | 197 | critical_section::with(|_| Dbgmcu::enable_all()); |
| 197 | DBGMCU.cr().modify(|w| { | ||
| 198 | w.set_dbg_standby(true); | ||
| 199 | w.set_dbg_stop(true); | ||
| 200 | }); | ||
| 201 | }); | ||
| 202 | } | 198 | } |
| 203 | } | 199 | } |
| 204 | 200 | ||
diff --git a/examples/stm32f0/src/bin/hello.rs b/examples/stm32f0/src/bin/hello.rs index a78b9892f..6ebb5cd4d 100644 --- a/examples/stm32f0/src/bin/hello.rs +++ b/examples/stm32f0/src/bin/hello.rs | |||
| @@ -14,7 +14,7 @@ use embassy_stm32::Peripherals; | |||
| 14 | #[path = "../example_common.rs"] | 14 | #[path = "../example_common.rs"] |
| 15 | mod example_common; | 15 | mod example_common; |
| 16 | 16 | ||
| 17 | #[embassy::main] | 17 | #[embassy::main(config = "example_common::config()")] |
| 18 | async fn main(_spawner: Spawner, _p: Peripherals) -> ! { | 18 | async fn main(_spawner: Spawner, _p: Peripherals) -> ! { |
| 19 | loop { | 19 | loop { |
| 20 | Timer::after(Duration::from_secs(1)).await; | 20 | Timer::after(Duration::from_secs(1)).await; |
diff --git a/examples/stm32f0/src/example_common.rs b/examples/stm32f0/src/example_common.rs index 54d633837..e0ba4cd01 100644 --- a/examples/stm32f0/src/example_common.rs +++ b/examples/stm32f0/src/example_common.rs | |||
| @@ -6,6 +6,14 @@ use panic_probe as _; | |||
| 6 | pub use defmt::*; | 6 | pub use defmt::*; |
| 7 | 7 | ||
| 8 | use core::sync::atomic::{AtomicUsize, Ordering}; | 8 | use core::sync::atomic::{AtomicUsize, Ordering}; |
| 9 | use embassy_stm32::rcc; | ||
| 10 | use embassy_stm32::Config; | ||
| 11 | |||
| 12 | pub fn config() -> Config { | ||
| 13 | let mut rcc_config = rcc::Config::default(); | ||
| 14 | rcc_config.enable_debug_wfe = true; | ||
| 15 | Config::default().rcc(rcc_config) | ||
| 16 | } | ||
| 9 | 17 | ||
| 10 | defmt::timestamp! {"{=u64}", { | 18 | defmt::timestamp! {"{=u64}", { |
| 11 | static COUNT: AtomicUsize = AtomicUsize::new(0); | 19 | static COUNT: AtomicUsize = AtomicUsize::new(0); |
