aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2025-07-21 00:54:46 +0200
committerGitHub <[email protected]>2025-07-21 00:54:46 +0200
commitaedf78cf2913aa93b47b017fbef13cb8d240d270 (patch)
treebc3b5389b8bef1c61d2baf2436a832cebb11bb57 /embassy-stm32
parenta7c0985818fba3b20dbd7aff9aa4f49f2399cb05 (diff)
parentd9cd93ca228b7d4d38066d88b50ff06bb7a5297a (diff)
Merge pull request #4418 from leftger/fix/rtc-stm32wba
Added RTC low-power support for STM32WBA
Diffstat (limited to 'embassy-stm32')
-rw-r--r--embassy-stm32/src/rtc/low_power.rs12
-rw-r--r--embassy-stm32/src/rtc/mod.rs2
-rw-r--r--embassy-stm32/src/rtc/v3.rs2
3 files changed, 11 insertions, 5 deletions
diff --git a/embassy-stm32/src/rtc/low_power.rs b/embassy-stm32/src/rtc/low_power.rs
index cd075f3de..78ccd3e6c 100644
--- a/embassy-stm32/src/rtc/low_power.rs
+++ b/embassy-stm32/src/rtc/low_power.rs
@@ -66,7 +66,7 @@ pub(crate) enum WakeupPrescaler {
66} 66}
67 67
68#[cfg(any( 68#[cfg(any(
69 stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0, stm32u5, stm32u0 69 stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0, stm32u5, stm32u0, stm32wba
70))] 70))]
71impl From<WakeupPrescaler> for crate::pac::rtc::vals::Wucksel { 71impl From<WakeupPrescaler> for crate::pac::rtc::vals::Wucksel {
72 fn from(val: WakeupPrescaler) -> Self { 72 fn from(val: WakeupPrescaler) -> Self {
@@ -82,7 +82,7 @@ impl From<WakeupPrescaler> for crate::pac::rtc::vals::Wucksel {
82} 82}
83 83
84#[cfg(any( 84#[cfg(any(
85 stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0, stm32u5, stm32u0 85 stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0, stm32u5, stm32u0, stm32wba
86))] 86))]
87impl From<crate::pac::rtc::vals::Wucksel> for WakeupPrescaler { 87impl From<crate::pac::rtc::vals::Wucksel> for WakeupPrescaler {
88 fn from(val: crate::pac::rtc::vals::Wucksel) -> Self { 88 fn from(val: crate::pac::rtc::vals::Wucksel) -> Self {
@@ -227,7 +227,7 @@ impl Rtc {
227 <RTC as crate::rtc::SealedInstance>::WakeupInterrupt::unpend(); 227 <RTC as crate::rtc::SealedInstance>::WakeupInterrupt::unpend();
228 unsafe { <RTC as crate::rtc::SealedInstance>::WakeupInterrupt::enable() }; 228 unsafe { <RTC as crate::rtc::SealedInstance>::WakeupInterrupt::enable() };
229 229
230 #[cfg(not(any(stm32u5, stm32u0)))] 230 #[cfg(not(any(stm32u5, stm32u0, stm32wba)))]
231 { 231 {
232 use crate::pac::EXTI; 232 use crate::pac::EXTI;
233 EXTI.rtsr(0).modify(|w| w.set_line(RTC::EXTI_WAKEUP_LINE, true)); 233 EXTI.rtsr(0).modify(|w| w.set_line(RTC::EXTI_WAKEUP_LINE, true));
@@ -247,5 +247,11 @@ impl Rtc {
247 RCC.srdamr().modify(|w| w.set_rtcapbamen(true)); 247 RCC.srdamr().modify(|w| w.set_rtcapbamen(true));
248 RCC.apb3smenr().modify(|w| w.set_rtcapbsmen(true)); 248 RCC.apb3smenr().modify(|w| w.set_rtcapbsmen(true));
249 } 249 }
250 #[cfg(stm32wba)]
251 {
252 use crate::pac::RCC;
253 // RCC.srdamr().modify(|w| w.set_rtcapbamen(true));
254 RCC.apb7smenr().modify(|w| w.set_rtcapbsmen(true));
255 }
250 } 256 }
251} 257}
diff --git a/embassy-stm32/src/rtc/mod.rs b/embassy-stm32/src/rtc/mod.rs
index 2c5aaca35..449f3008a 100644
--- a/embassy-stm32/src/rtc/mod.rs
+++ b/embassy-stm32/src/rtc/mod.rs
@@ -296,7 +296,7 @@ trait SealedInstance {
296 const BACKUP_REGISTER_COUNT: usize; 296 const BACKUP_REGISTER_COUNT: usize;
297 297
298 #[cfg(feature = "low-power")] 298 #[cfg(feature = "low-power")]
299 #[cfg(not(any(stm32u5, stm32u0)))] 299 #[cfg(not(any(stm32wba, stm32u5, stm32u0)))]
300 const EXTI_WAKEUP_LINE: usize; 300 const EXTI_WAKEUP_LINE: usize;
301 301
302 #[cfg(feature = "low-power")] 302 #[cfg(feature = "low-power")]
diff --git a/embassy-stm32/src/rtc/v3.rs b/embassy-stm32/src/rtc/v3.rs
index 39aa6c5cb..d0b52049e 100644
--- a/embassy-stm32/src/rtc/v3.rs
+++ b/embassy-stm32/src/rtc/v3.rs
@@ -146,7 +146,7 @@ impl SealedInstance for crate::peripherals::RTC {
146 type WakeupInterrupt = crate::interrupt::typelevel::RTC_WKUP; 146 type WakeupInterrupt = crate::interrupt::typelevel::RTC_WKUP;
147 } else if #[cfg(any(stm32g0, stm32u0))] { 147 } else if #[cfg(any(stm32g0, stm32u0))] {
148 type WakeupInterrupt = crate::interrupt::typelevel::RTC_TAMP; 148 type WakeupInterrupt = crate::interrupt::typelevel::RTC_TAMP;
149 } else if #[cfg(any(stm32l5, stm32h5, stm32u5))] { 149 } else if #[cfg(any(stm32l5, stm32h5, stm32u5, stm32wba))] {
150 type WakeupInterrupt = crate::interrupt::typelevel::RTC; 150 type WakeupInterrupt = crate::interrupt::typelevel::RTC;
151 } 151 }
152 ); 152 );