stm32/rcc: set rtc clock on f4

This commit is contained in:
xoviat 2023-08-21 17:50:18 -05:00
parent f723982bec
commit 8c12453544
2 changed files with 8 additions and 1 deletions

View File

@ -473,6 +473,11 @@ pub(crate) unsafe fn init(config: Config) {
Rtc::set_clock_source(clock_source); Rtc::set_clock_source(clock_source);
}); });
let rtc = match config.rtc {
Some(RtcClockSource::LSI) => Some(LSI_FREQ),
_ => None,
};
set_freqs(Clocks { set_freqs(Clocks {
sys: Hertz(sysclk), sys: Hertz(sysclk),
apb1: Hertz(pclk1), apb1: Hertz(pclk1),
@ -492,6 +497,8 @@ pub(crate) unsafe fn init(config: Config) {
#[cfg(any(stm32f427, stm32f429, stm32f437, stm32f439, stm32f446, stm32f469, stm32f479))] #[cfg(any(stm32f427, stm32f429, stm32f437, stm32f439, stm32f446, stm32f469, stm32f479))]
pllsai: None, pllsai: None,
rtc: rtc,
}); });
} }

View File

@ -74,7 +74,7 @@ pub struct Clocks {
#[cfg(any(rcc_h5, rcc_h50, rcc_h7, rcc_h7ab))] #[cfg(any(rcc_h5, rcc_h50, rcc_h7, rcc_h7ab))]
pub adc: Option<Hertz>, pub adc: Option<Hertz>,
#[cfg(rcc_wb)] #[cfg(any(rcc_wb, rcc_f4))]
/// Set only if the lsi or lse is configured /// Set only if the lsi or lse is configured
pub rtc: Option<Hertz>, pub rtc: Option<Hertz>,
} }