rcc: more cleanup
This commit is contained in:
@@ -268,7 +268,7 @@ pub(crate) mod sealed {
|
||||
crate::pac::RTC
|
||||
}
|
||||
|
||||
fn enable_peripheral_clk() {}
|
||||
fn enable_peripheral_clk();
|
||||
|
||||
/// Read content of the backup register.
|
||||
///
|
||||
|
@@ -270,9 +270,18 @@ impl sealed::Instance for crate::peripherals::RTC {
|
||||
}
|
||||
#[cfg(any(rtc_v2f2))]
|
||||
{
|
||||
// enable peripheral clock for communication
|
||||
crate::pac::RCC.apb1enr().modify(|w| w.set_pwren(true));
|
||||
|
||||
// read to allow the pwr clock to enable
|
||||
crate::pac::PWR.cr().read();
|
||||
}
|
||||
|
||||
#[cfg(any(rtc_v2f0))]
|
||||
{
|
||||
// enable peripheral clock for communication
|
||||
crate::pac::RCC.apb1enr().modify(|w| w.set_pwren(true));
|
||||
}
|
||||
}
|
||||
|
||||
fn read_backup_register(rtc: &Rtc, register: usize) -> Option<u32> {
|
||||
|
@@ -128,6 +128,23 @@ impl super::Rtc {
|
||||
impl sealed::Instance for crate::peripherals::RTC {
|
||||
const BACKUP_REGISTER_COUNT: usize = 32;
|
||||
|
||||
fn enable_peripheral_clk() {
|
||||
#[cfg(any(rcc_wle, rcc_wl5, rcc_g4))]
|
||||
{
|
||||
// enable peripheral clock for communication
|
||||
crate::pac::RCC.apb1enr1().modify(|w| w.set_rtcapben(true));
|
||||
}
|
||||
|
||||
#[cfg(rcc_g0)]
|
||||
{
|
||||
// enable peripheral clock for communication
|
||||
crate::pac::RCC.apbenr1().modify(|w| w.set_rtcapben(true));
|
||||
}
|
||||
|
||||
// read to allow the pwr clock to enable
|
||||
crate::pac::PWR.cr1().read();
|
||||
}
|
||||
|
||||
fn read_backup_register(_rtc: &Rtc, register: usize) -> Option<u32> {
|
||||
#[allow(clippy::if_same_then_else)]
|
||||
if register < Self::BACKUP_REGISTER_COUNT {
|
||||
|
Reference in New Issue
Block a user