aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-stm32/src/low_power.rs6
-rw-r--r--embassy-stm32/src/rtc/low_power.rs19
-rw-r--r--embassy-stm32/src/rtc/mod.rs1
-rw-r--r--embassy-stm32/src/rtc/v3.rs2
4 files changed, 20 insertions, 8 deletions
diff --git a/embassy-stm32/src/low_power.rs b/embassy-stm32/src/low_power.rs
index 2be1a42b7..a779b8a09 100644
--- a/embassy-stm32/src/low_power.rs
+++ b/embassy-stm32/src/low_power.rs
@@ -112,10 +112,10 @@ pub enum StopMode {
112 Stop2, 112 Stop2,
113} 113}
114 114
115#[cfg(any(stm32l4, stm32l5))] 115#[cfg(any(stm32l4, stm32l5, stm32u5))]
116use stm32_metapac::pwr::vals::Lpms; 116use stm32_metapac::pwr::vals::Lpms;
117 117
118#[cfg(any(stm32l4, stm32l5))] 118#[cfg(any(stm32l4, stm32l5, stm32u5))]
119impl Into<Lpms> for StopMode { 119impl Into<Lpms> for StopMode {
120 fn into(self) -> Lpms { 120 fn into(self) -> Lpms {
121 match self { 121 match self {
@@ -184,7 +184,7 @@ impl Executor {
184 184
185 #[allow(unused_variables)] 185 #[allow(unused_variables)]
186 fn configure_stop(&mut self, stop_mode: StopMode) { 186 fn configure_stop(&mut self, stop_mode: StopMode) {
187 #[cfg(any(stm32l4, stm32l5))] 187 #[cfg(any(stm32l4, stm32l5, stm32u5))]
188 crate::pac::PWR.cr1().modify(|m| m.set_lpms(stop_mode.into())); 188 crate::pac::PWR.cr1().modify(|m| m.set_lpms(stop_mode.into()));
189 #[cfg(stm32h5)] 189 #[cfg(stm32h5)]
190 crate::pac::PWR.pmcr().modify(|v| { 190 crate::pac::PWR.pmcr().modify(|v| {
diff --git a/embassy-stm32/src/rtc/low_power.rs b/embassy-stm32/src/rtc/low_power.rs
index 875eaa639..bba359f31 100644
--- a/embassy-stm32/src/rtc/low_power.rs
+++ b/embassy-stm32/src/rtc/low_power.rs
@@ -65,7 +65,7 @@ pub(crate) enum WakeupPrescaler {
65 Div16 = 16, 65 Div16 = 16,
66} 66}
67 67
68#[cfg(any(stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0))] 68#[cfg(any(stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0, stm32u5))]
69impl From<WakeupPrescaler> for crate::pac::rtc::vals::Wucksel { 69impl From<WakeupPrescaler> for crate::pac::rtc::vals::Wucksel {
70 fn from(val: WakeupPrescaler) -> Self { 70 fn from(val: WakeupPrescaler) -> Self {
71 use crate::pac::rtc::vals::Wucksel; 71 use crate::pac::rtc::vals::Wucksel;
@@ -79,7 +79,7 @@ impl From<WakeupPrescaler> for crate::pac::rtc::vals::Wucksel {
79 } 79 }
80} 80}
81 81
82#[cfg(any(stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0))] 82#[cfg(any(stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0, stm32u5))]
83impl From<crate::pac::rtc::vals::Wucksel> for WakeupPrescaler { 83impl From<crate::pac::rtc::vals::Wucksel> for WakeupPrescaler {
84 fn from(val: crate::pac::rtc::vals::Wucksel) -> Self { 84 fn from(val: crate::pac::rtc::vals::Wucksel) -> Self {
85 use crate::pac::rtc::vals::Wucksel; 85 use crate::pac::rtc::vals::Wucksel;
@@ -219,12 +219,21 @@ impl Rtc {
219 219
220 pub(crate) fn enable_wakeup_line(&self) { 220 pub(crate) fn enable_wakeup_line(&self) {
221 use crate::interrupt::typelevel::Interrupt; 221 use crate::interrupt::typelevel::Interrupt;
222 use crate::pac::EXTI;
223 222
224 <RTC as crate::rtc::SealedInstance>::WakeupInterrupt::unpend(); 223 <RTC as crate::rtc::SealedInstance>::WakeupInterrupt::unpend();
225 unsafe { <RTC as crate::rtc::SealedInstance>::WakeupInterrupt::enable() }; 224 unsafe { <RTC as crate::rtc::SealedInstance>::WakeupInterrupt::enable() };
226 225
227 EXTI.rtsr(0).modify(|w| w.set_line(RTC::EXTI_WAKEUP_LINE, true)); 226 #[cfg(not(stm32u5))]
228 EXTI.imr(0).modify(|w| w.set_line(RTC::EXTI_WAKEUP_LINE, true)); 227 {
228 use crate::pac::EXTI;
229 EXTI.rtsr(0).modify(|w| w.set_line(RTC::EXTI_WAKEUP_LINE, true));
230 EXTI.imr(0).modify(|w| w.set_line(RTC::EXTI_WAKEUP_LINE, true));
231 }
232 #[cfg(stm32u5)]
233 {
234 use crate::pac::RCC;
235 RCC.srdamr().modify(|w| w.set_rtcapbamen(true));
236 RCC.apb3smenr().modify(|w| w.set_rtcapbsmen(true));
237 }
229 } 238 }
230} 239}
diff --git a/embassy-stm32/src/rtc/mod.rs b/embassy-stm32/src/rtc/mod.rs
index fe57cfe66..3722d11ab 100644
--- a/embassy-stm32/src/rtc/mod.rs
+++ b/embassy-stm32/src/rtc/mod.rs
@@ -285,6 +285,7 @@ trait SealedInstance {
285 const BACKUP_REGISTER_COUNT: usize; 285 const BACKUP_REGISTER_COUNT: usize;
286 286
287 #[cfg(feature = "low-power")] 287 #[cfg(feature = "low-power")]
288 #[cfg(not(stm32u5))]
288 const EXTI_WAKEUP_LINE: usize; 289 const EXTI_WAKEUP_LINE: usize;
289 290
290 #[cfg(feature = "low-power")] 291 #[cfg(feature = "low-power")]
diff --git a/embassy-stm32/src/rtc/v3.rs b/embassy-stm32/src/rtc/v3.rs
index 02fd5272e..12cb10bc7 100644
--- a/embassy-stm32/src/rtc/v3.rs
+++ b/embassy-stm32/src/rtc/v3.rs
@@ -140,6 +140,8 @@ impl SealedInstance for crate::peripherals::RTC {
140 } else if #[cfg(any(stm32l5, stm32h5))] { 140 } else if #[cfg(any(stm32l5, stm32h5))] {
141 const EXTI_WAKEUP_LINE: usize = 17; 141 const EXTI_WAKEUP_LINE: usize = 17;
142 type WakeupInterrupt = crate::interrupt::typelevel::RTC; 142 type WakeupInterrupt = crate::interrupt::typelevel::RTC;
143 } else if #[cfg(stm32u5)] {
144 type WakeupInterrupt = crate::interrupt::typelevel::RTC;
143 } 145 }
144 ); 146 );
145 147