aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Enderle <[email protected]>2023-09-21 17:17:58 +0200
committerChristian Enderle <[email protected]>2023-09-21 17:17:58 +0200
commitad64d7b20b26e0854c4d1302f562df51e67a022b (patch)
tree78e649b6d6764620e7af955e2727917c6a0c3a8e
parent5626a28af269ac2c70a9db6f9a39c3526f9d15b0 (diff)
fix low-power: APB1 needed for LSE
-rw-r--r--embassy-stm32/src/rcc/bd.rs5
-rw-r--r--embassy-stm32/src/rtc/mod.rs2
2 files changed, 5 insertions, 2 deletions
diff --git a/embassy-stm32/src/rcc/bd.rs b/embassy-stm32/src/rcc/bd.rs
index 762e84355..4915d5e2a 100644
--- a/embassy-stm32/src/rcc/bd.rs
+++ b/embassy-stm32/src/rcc/bd.rs
@@ -88,6 +88,11 @@ impl BackupDomain {
88 ))] 88 ))]
89 #[allow(dead_code, unused_variables)] 89 #[allow(dead_code, unused_variables)]
90 pub fn configure_ls(clock_source: RtcClockSource, lsi: bool, lse: Option<LseDrive>) { 90 pub fn configure_ls(clock_source: RtcClockSource, lsi: bool, lse: Option<LseDrive>) {
91 if lsi || lse.is_some() {
92 use crate::rtc::sealed::Instance;
93 crate::peripherals::RTC::enable_peripheral_clk();
94 }
95
91 if lsi { 96 if lsi {
92 #[cfg(rtc_v3u5)] 97 #[cfg(rtc_v3u5)]
93 let csr = crate::pac::RCC.bdcr(); 98 let csr = crate::pac::RCC.bdcr();
diff --git a/embassy-stm32/src/rtc/mod.rs b/embassy-stm32/src/rtc/mod.rs
index 07b4fe1f0..7eafedec4 100644
--- a/embassy-stm32/src/rtc/mod.rs
+++ b/embassy-stm32/src/rtc/mod.rs
@@ -154,8 +154,6 @@ impl Default for RtcCalibrationCyclePeriod {
154 154
155impl Rtc { 155impl Rtc {
156 pub fn new(_rtc: impl Peripheral<P = RTC>, rtc_config: RtcConfig) -> Self { 156 pub fn new(_rtc: impl Peripheral<P = RTC>, rtc_config: RtcConfig) -> Self {
157 RTC::enable_peripheral_clk();
158
159 let mut this = Self { 157 let mut this = Self {
160 #[cfg(feature = "low-power")] 158 #[cfg(feature = "low-power")]
161 stop_time: Mutex::const_new(CriticalSectionRawMutex::new(), Cell::new(None)), 159 stop_time: Mutex::const_new(CriticalSectionRawMutex::new(), Cell::new(None)),