feat(stm32-wba): provide a const constructor on rcc::Config

This commit is contained in:
ROMemories 2025-05-21 11:36:55 +02:00
parent da86052586
commit 576241fe2a

View File

@ -37,9 +37,9 @@ pub struct Config {
pub mux: super::mux::ClockMux, pub mux: super::mux::ClockMux,
} }
impl Default for Config { impl Config {
#[inline] #[inline]
fn default() -> Config { pub const fn new() -> Self {
Config { Config {
hse: None, hse: None,
hsi: true, hsi: true,
@ -48,13 +48,20 @@ impl Default for Config {
apb1_pre: APBPrescaler::DIV1, apb1_pre: APBPrescaler::DIV1,
apb2_pre: APBPrescaler::DIV1, apb2_pre: APBPrescaler::DIV1,
apb7_pre: APBPrescaler::DIV1, apb7_pre: APBPrescaler::DIV1,
ls: Default::default(), ls: crate::rcc::LsConfig::new(),
voltage_scale: VoltageScale::RANGE2, voltage_scale: VoltageScale::RANGE2,
mux: Default::default(), mux: super::mux::ClockMux::default(),
} }
} }
} }
impl Default for Config {
#[inline]
fn default() -> Config {
Self::new()
}
}
fn hsi_enable() { fn hsi_enable() {
RCC.cr().modify(|w| w.set_hsion(true)); RCC.cr().modify(|w| w.set_hsion(true));
while !RCC.cr().read().hsirdy() {} while !RCC.cr().read().hsirdy() {}