aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-stm32/src/rcc/f0/mod.rs10
-rw-r--r--examples/stm32f0/src/bin/hello.rs2
-rw-r--r--examples/stm32f0/src/example_common.rs8
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
3use embassy::util::Unborrow; 3use embassy::util::Unborrow;
4 4
5use crate::pac::{DBGMCU, FLASH, RCC}; 5use crate::dbgmcu::Dbgmcu;
6use crate::pac::{FLASH, RCC};
6use crate::peripherals; 7use crate::peripherals;
7use crate::time::Hertz; 8use 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"]
15mod example_common; 15mod example_common;
16 16
17#[embassy::main] 17#[embassy::main(config = "example_common::config()")]
18async fn main(_spawner: Spawner, _p: Peripherals) -> ! { 18async 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 _;
6pub use defmt::*; 6pub use defmt::*;
7 7
8use core::sync::atomic::{AtomicUsize, Ordering}; 8use core::sync::atomic::{AtomicUsize, Ordering};
9use embassy_stm32::rcc;
10use embassy_stm32::Config;
11
12pub 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
10defmt::timestamp! {"{=u64}", { 18defmt::timestamp! {"{=u64}", {
11 static COUNT: AtomicUsize = AtomicUsize::new(0); 19 static COUNT: AtomicUsize = AtomicUsize::new(0);