low-power: add support for stop for stm32u0
This commit is contained in:
parent
a49289ce7b
commit
1fbb419f72
@ -70,6 +70,7 @@ use crate::rtc::Rtc;
|
|||||||
|
|
||||||
static mut EXECUTOR: Option<Executor> = None;
|
static mut EXECUTOR: Option<Executor> = None;
|
||||||
|
|
||||||
|
#[cfg(not(stm32u0))]
|
||||||
foreach_interrupt! {
|
foreach_interrupt! {
|
||||||
(RTC, rtc, $block:ident, WKUP, $irq:ident) => {
|
(RTC, rtc, $block:ident, WKUP, $irq:ident) => {
|
||||||
#[interrupt]
|
#[interrupt]
|
||||||
@ -80,7 +81,7 @@ foreach_interrupt! {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// only relevant for stm32u0
|
#[cfg(stm32u0)]
|
||||||
foreach_interrupt! {
|
foreach_interrupt! {
|
||||||
(RTC, rtc, $block:ident, TAMP, $irq:ident) => {
|
(RTC, rtc, $block:ident, TAMP, $irq:ident) => {
|
||||||
#[interrupt]
|
#[interrupt]
|
||||||
@ -123,10 +124,10 @@ pub enum StopMode {
|
|||||||
Stop2,
|
Stop2,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(stm32l4, stm32l5, stm32u5))]
|
#[cfg(any(stm32l4, stm32l5, stm32u5, stm32u0))]
|
||||||
use stm32_metapac::pwr::vals::Lpms;
|
use stm32_metapac::pwr::vals::Lpms;
|
||||||
|
|
||||||
#[cfg(any(stm32l4, stm32l5, stm32u5))]
|
#[cfg(any(stm32l4, stm32l5, stm32u5, stm32u0))]
|
||||||
impl Into<Lpms> for StopMode {
|
impl Into<Lpms> for StopMode {
|
||||||
fn into(self) -> Lpms {
|
fn into(self) -> Lpms {
|
||||||
match self {
|
match self {
|
||||||
@ -197,7 +198,7 @@ impl Executor {
|
|||||||
|
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
fn configure_stop(&mut self, stop_mode: StopMode) {
|
fn configure_stop(&mut self, stop_mode: StopMode) {
|
||||||
#[cfg(any(stm32l4, stm32l5, stm32u5))]
|
#[cfg(any(stm32l4, stm32l5, stm32u5, stm32u0))]
|
||||||
crate::pac::PWR.cr1().modify(|m| m.set_lpms(stop_mode.into()));
|
crate::pac::PWR.cr1().modify(|m| m.set_lpms(stop_mode.into()));
|
||||||
#[cfg(stm32h5)]
|
#[cfg(stm32h5)]
|
||||||
crate::pac::PWR.pmcr().modify(|v| {
|
crate::pac::PWR.pmcr().modify(|v| {
|
||||||
|
|||||||
@ -65,7 +65,9 @@ pub(crate) enum WakeupPrescaler {
|
|||||||
Div16 = 16,
|
Div16 = 16,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0, stm32u5, stm32u0))]
|
#[cfg(any(
|
||||||
|
stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0, stm32u5, stm32u0
|
||||||
|
))]
|
||||||
impl From<WakeupPrescaler> for crate::pac::rtc::vals::Wucksel {
|
impl From<WakeupPrescaler> for crate::pac::rtc::vals::Wucksel {
|
||||||
fn from(val: WakeupPrescaler) -> Self {
|
fn from(val: WakeupPrescaler) -> Self {
|
||||||
use crate::pac::rtc::vals::Wucksel;
|
use crate::pac::rtc::vals::Wucksel;
|
||||||
@ -79,7 +81,9 @@ impl From<WakeupPrescaler> for crate::pac::rtc::vals::Wucksel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0, stm32u5, stm32u0))]
|
#[cfg(any(
|
||||||
|
stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0, stm32u5, stm32u0
|
||||||
|
))]
|
||||||
impl From<crate::pac::rtc::vals::Wucksel> for WakeupPrescaler {
|
impl From<crate::pac::rtc::vals::Wucksel> for WakeupPrescaler {
|
||||||
fn from(val: crate::pac::rtc::vals::Wucksel) -> Self {
|
fn from(val: crate::pac::rtc::vals::Wucksel) -> Self {
|
||||||
use crate::pac::rtc::vals::Wucksel;
|
use crate::pac::rtc::vals::Wucksel;
|
||||||
|
|||||||
@ -139,7 +139,7 @@ impl SealedInstance for crate::peripherals::RTC {
|
|||||||
const EXTI_WAKEUP_LINE: usize = 17;
|
const EXTI_WAKEUP_LINE: usize = 17;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
#[cfg(feature = "low-power")]
|
#[cfg(feature = "low-power")]
|
||||||
cfg_if::cfg_if!(
|
cfg_if::cfg_if!(
|
||||||
if #[cfg(stm32g4)] {
|
if #[cfg(stm32g4)] {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user