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

This commit is contained in:
ROMemories 2025-05-21 11:36:55 +02:00
parent 26fb6eb9f6
commit ea243761f7

View File

@ -91,26 +91,33 @@ 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 {
hsi: true, hsi: true,
hse: None, hse: None,
sys: Sysclk::HSI, sys: Sysclk::HSI,
hsi48: Some(Default::default()), hsi48: Some(crate::rcc::Hsi48Config::new()),
pll: None, pll: None,
ahb_pre: AHBPrescaler::DIV1, ahb_pre: AHBPrescaler::DIV1,
apb1_pre: APBPrescaler::DIV1, apb1_pre: APBPrescaler::DIV1,
apb2_pre: APBPrescaler::DIV1, apb2_pre: APBPrescaler::DIV1,
low_power_run: false, low_power_run: false,
ls: Default::default(), ls: crate::rcc::LsConfig::new(),
boost: false, boost: false,
mux: Default::default(), mux: super::mux::ClockMux::default(),
} }
} }
} }
impl Default for Config {
#[inline]
fn default() -> Config {
Self::new()
}
}
#[derive(Default)] #[derive(Default)]
pub struct PllFreq { pub struct PllFreq {
pub pll_p: Option<Hertz>, pub pll_p: Option<Hertz>,