Merge pull request #3213 from embedded-rust-iml/stm32l4-low-power
Implement low-power feature for STM32L4 MCUs
This commit is contained in:
commit
55c01818cf
@ -109,10 +109,10 @@ pub enum StopMode {
|
|||||||
Stop2,
|
Stop2,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(stm32l5)]
|
#[cfg(any(stm32l4, stm32l5))]
|
||||||
use stm32_metapac::pwr::vals::Lpms;
|
use stm32_metapac::pwr::vals::Lpms;
|
||||||
|
|
||||||
#[cfg(stm32l5)]
|
#[cfg(any(stm32l4, stm32l5))]
|
||||||
impl Into<Lpms> for StopMode {
|
impl Into<Lpms> for StopMode {
|
||||||
fn into(self) -> Lpms {
|
fn into(self) -> Lpms {
|
||||||
match self {
|
match self {
|
||||||
@ -181,7 +181,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(stm32l5)]
|
#[cfg(any(stm32l4, stm32l5))]
|
||||||
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,7 @@ pub(crate) enum WakeupPrescaler {
|
|||||||
Div16 = 16,
|
Div16 = 16,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(stm32f4, stm32l0, stm32g4, stm32l5, stm32wb, stm32h5, stm32g0))]
|
#[cfg(any(stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0))]
|
||||||
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 +79,7 @@ impl From<WakeupPrescaler> for crate::pac::rtc::vals::Wucksel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(stm32f4, stm32l0, stm32g4, stm32l5, stm32wb, stm32h5, stm32g0))]
|
#[cfg(any(stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0))]
|
||||||
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;
|
||||||
|
|||||||
@ -131,10 +131,13 @@ impl SealedInstance for crate::peripherals::RTC {
|
|||||||
#[cfg(all(feature = "low-power", stm32f4))]
|
#[cfg(all(feature = "low-power", stm32f4))]
|
||||||
const EXTI_WAKEUP_LINE: usize = 22;
|
const EXTI_WAKEUP_LINE: usize = 22;
|
||||||
|
|
||||||
|
#[cfg(all(feature = "low-power", stm32l4))]
|
||||||
|
const EXTI_WAKEUP_LINE: usize = 20;
|
||||||
|
|
||||||
#[cfg(all(feature = "low-power", stm32l0))]
|
#[cfg(all(feature = "low-power", stm32l0))]
|
||||||
const EXTI_WAKEUP_LINE: usize = 20;
|
const EXTI_WAKEUP_LINE: usize = 20;
|
||||||
|
|
||||||
#[cfg(all(feature = "low-power", stm32f4))]
|
#[cfg(all(feature = "low-power", any(stm32f4, stm32l4)))]
|
||||||
type WakeupInterrupt = crate::interrupt::typelevel::RTC_WKUP;
|
type WakeupInterrupt = crate::interrupt::typelevel::RTC_WKUP;
|
||||||
|
|
||||||
#[cfg(all(feature = "low-power", stm32l0))]
|
#[cfg(all(feature = "low-power", stm32l0))]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user