stm32/rtc: autocompute prescalers
This commit is contained in:
@ -8,7 +8,7 @@ use crate::rtc::sealed::Instance;
|
||||
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| {
|
||||
w.set_fmt(Fmt::TWENTYFOURHOUR);
|
||||
@ -17,8 +17,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);
|
||||
});
|
||||
|
||||
// TODO: configuration for output pins
|
||||
|
Reference in New Issue
Block a user