Merge pull request from Ralim/low-power-g0

Extend RTC low power mode for STM32G0
This commit is contained in:
Dario Nieuwenhuis 2024-01-02 13:56:33 +00:00 committed by GitHub
commit 7d037df126
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions
embassy-stm32/src/rtc

View file

@ -43,7 +43,7 @@ pub(crate) enum WakeupPrescaler {
Div16 = 16,
}
#[cfg(any(stm32wb, stm32f4, stm32l0, stm32g4, stm32l5))]
#[cfg(any(stm32wb, stm32f4, stm32l0, stm32g4, stm32l5, stm32g0))]
impl From<WakeupPrescaler> for crate::pac::rtc::vals::Wucksel {
fn from(val: WakeupPrescaler) -> Self {
use crate::pac::rtc::vals::Wucksel;
@ -57,7 +57,7 @@ impl From<WakeupPrescaler> for crate::pac::rtc::vals::Wucksel {
}
}
#[cfg(any(stm32wb, stm32f4, stm32l0, stm32g4, stm32l5))]
#[cfg(any(stm32wb, stm32f4, stm32l0, stm32g4, stm32l5, stm32g0))]
impl From<crate::pac::rtc::vals::Wucksel> for WakeupPrescaler {
fn from(val: crate::pac::rtc::vals::Wucksel) -> Self {
use crate::pac::rtc::vals::Wucksel;
@ -423,7 +423,11 @@ impl Rtc {
#[cfg(any(rtc_v3, rtc_v3u5, rtc_v3l5))]
regs.scr().write(|w| w.set_cwutf(Calrf::CLEAR));
#[cfg(not(stm32l5))]
#[cfg(all(stm32g0))]
crate::pac::EXTI
.rpr(0)
.modify(|w| w.set_line(RTC::EXTI_WAKEUP_LINE, true));
#[cfg(all(not(stm32g0), not(stm32l5)))]
crate::pac::EXTI
.pr(0)
.modify(|w| w.set_line(RTC::EXTI_WAKEUP_LINE, true));

View file

@ -132,6 +132,12 @@ impl sealed::Instance for crate::peripherals::RTC {
#[cfg(all(feature = "low-power", stm32g4))]
const EXTI_WAKEUP_LINE: usize = 20;
#[cfg(all(feature = "low-power", stm32g0))]
const EXTI_WAKEUP_LINE: usize = 19;
#[cfg(all(feature = "low-power", stm32g0))]
type WakeupInterrupt = crate::interrupt::typelevel::RTC_TAMP;
#[cfg(all(feature = "low-power", stm32g4))]
type WakeupInterrupt = crate::interrupt::typelevel::RTC_WKUP;