Fix & Revert

This commit is contained in:
Bing Wen 2024-11-27 12:33:32 +08:00
parent 52ab015fac
commit d0340ad297
3 changed files with 4 additions and 1 deletions

View File

@ -126,6 +126,7 @@ pub(crate) unsafe fn init(config: Config) {
Sysclk::HSE => unwrap!(hse),
_ => unreachable!(),
};
rcc_assert!(max::SYSCLK.contains(&sys));
// Calculate the AHB frequency (HCLK), among other things so we can calculate the correct flash read latency.
@ -133,7 +134,7 @@ pub(crate) unsafe fn init(config: Config) {
rcc_assert!(max::HCLK.contains(&hclk));
let (pclk1, pclk1_tim) = super::util::calc_pclk(hclk, config.apb1_pre);
rcc_assert(max::PCLK.contains(&pclk1));
rcc_assert!(max::PCLK.contains(&pclk1));
let latency = match hclk.0 {
..=24_000_000 => Latency::WS0,

View File

@ -238,6 +238,7 @@ pub(crate) unsafe fn init(config: Config) {
let (pclk2, pclk2_tim) = super::util::calc_pclk(hclk, config.apb2_pre);
#[cfg(stm32f0)]
let (pclk2, pclk2_tim) = (pclk1, pclk1_tim);
rcc_assert!(max::HCLK.contains(&hclk));
rcc_assert!(max::PCLK1.contains(&pclk1));
#[cfg(not(stm32f0))]

View File

@ -227,6 +227,7 @@ pub(crate) unsafe fn init(config: Config) {
Sysclk::PLL1_R => unwrap!(pll.pll_r),
_ => unreachable!(),
};
rcc_assert!(max::SYSCLK.contains(&sys));
// Calculate the AHB frequency (HCLK), among other things so we can calculate the correct flash read latency.