stm32/rtc: autocompute prescalers

This commit is contained in:
xoviat
2023-08-29 19:41:03 -05:00
parent fdb2c4946a
commit 989c98f316
5 changed files with 41 additions and 50 deletions

View File

@ -154,7 +154,7 @@ impl super::Rtc {
/// Applies the RTC config
/// It this changes the RTC clock source the time will be reset
pub(super) fn configure(&mut self, rtc_config: RtcConfig) {
pub(super) fn configure(&mut self, async_psc: u8, sync_psc: u16) {
self.write(true, |rtc| {
rtc.cr().modify(|w| {
#[cfg(rtc_v2f2)]
@ -166,8 +166,8 @@ impl super::Rtc {
});
rtc.prer().modify(|w| {
w.set_prediv_s(rtc_config.sync_prescaler);
w.set_prediv_a(rtc_config.async_prescaler);
w.set_prediv_s(sync_psc);
w.set_prediv_a(async_psc);
});
});
}