mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-09-27 12:20:37 +00:00
low-power: add basic support for stm32u0
This commit is contained in:
parent
29934237a5
commit
a49289ce7b
@ -80,6 +80,17 @@ foreach_interrupt! {
|
||||
};
|
||||
}
|
||||
|
||||
// only relevant for stm32u0
|
||||
foreach_interrupt! {
|
||||
(RTC, rtc, $block:ident, TAMP, $irq:ident) => {
|
||||
#[interrupt]
|
||||
#[allow(non_snake_case)]
|
||||
unsafe fn $irq() {
|
||||
EXECUTOR.as_mut().unwrap().on_wakeup_irq();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) unsafe fn on_wakeup_irq() {
|
||||
EXECUTOR.as_mut().unwrap().on_wakeup_irq();
|
||||
|
@ -65,7 +65,7 @@ pub(crate) enum WakeupPrescaler {
|
||||
Div16 = 16,
|
||||
}
|
||||
|
||||
#[cfg(any(stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0, stm32u5))]
|
||||
#[cfg(any(stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0, stm32u5, stm32u0))]
|
||||
impl From<WakeupPrescaler> for crate::pac::rtc::vals::Wucksel {
|
||||
fn from(val: WakeupPrescaler) -> Self {
|
||||
use crate::pac::rtc::vals::Wucksel;
|
||||
@ -79,7 +79,7 @@ impl From<WakeupPrescaler> for crate::pac::rtc::vals::Wucksel {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0, stm32u5))]
|
||||
#[cfg(any(stm32f4, stm32l0, stm32g4, stm32l4, stm32l5, stm32wb, stm32h5, stm32g0, stm32u5, stm32u0))]
|
||||
impl From<crate::pac::rtc::vals::Wucksel> for WakeupPrescaler {
|
||||
fn from(val: crate::pac::rtc::vals::Wucksel) -> Self {
|
||||
use crate::pac::rtc::vals::Wucksel;
|
||||
@ -223,7 +223,7 @@ impl Rtc {
|
||||
<RTC as crate::rtc::SealedInstance>::WakeupInterrupt::unpend();
|
||||
unsafe { <RTC as crate::rtc::SealedInstance>::WakeupInterrupt::enable() };
|
||||
|
||||
#[cfg(not(stm32u5))]
|
||||
#[cfg(not(any(stm32u5, stm32u0)))]
|
||||
{
|
||||
use crate::pac::EXTI;
|
||||
EXTI.rtsr(0).modify(|w| w.set_line(RTC::EXTI_WAKEUP_LINE, true));
|
||||
|
@ -285,7 +285,7 @@ trait SealedInstance {
|
||||
const BACKUP_REGISTER_COUNT: usize;
|
||||
|
||||
#[cfg(feature = "low-power")]
|
||||
#[cfg(not(stm32u5))]
|
||||
#[cfg(not(any(stm32u5, stm32u0)))]
|
||||
const EXTI_WAKEUP_LINE: usize;
|
||||
|
||||
#[cfg(feature = "low-power")]
|
||||
|
@ -144,7 +144,7 @@ impl SealedInstance for crate::peripherals::RTC {
|
||||
cfg_if::cfg_if!(
|
||||
if #[cfg(stm32g4)] {
|
||||
type WakeupInterrupt = crate::interrupt::typelevel::RTC_WKUP;
|
||||
} else if #[cfg(any(stm32g0))] {
|
||||
} else if #[cfg(any(stm32g0, stm32u0))] {
|
||||
type WakeupInterrupt = crate::interrupt::typelevel::RTC_TAMP;
|
||||
} else if #[cfg(any(stm32l5, stm32h5, stm32u5))] {
|
||||
type WakeupInterrupt = crate::interrupt::typelevel::RTC;
|
||||
|
Loading…
x
Reference in New Issue
Block a user