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

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

View File

@ -97,9 +97,9 @@ pub struct Config {
pub mux: super::mux::ClockMux,
}
impl Default for Config {
impl Config {
#[inline]
fn default() -> Config {
pub const fn new() -> Self {
Config {
hsi: Some(Hsi {
sys_div: HsiSysDiv::DIV1,
@ -107,18 +107,25 @@ impl Default for Config {
hse: None,
sys: Sysclk::HSI,
#[cfg(crs)]
hsi48: Some(Default::default()),
hsi48: Some(crate::rcc::Hsi48Config::new()),
pll: None,
ahb_pre: AHBPrescaler::DIV1,
apb1_pre: APBPrescaler::DIV1,
low_power_run: false,
ls: Default::default(),
ls: crate::rcc::LsConfig::new(),
voltage_range: VoltageRange::RANGE1,
mux: Default::default(),
mux: super::mux::ClockMux::default(),
}
}
}
impl Default for Config {
#[inline]
fn default() -> Config {
Self::new()
}
}
#[derive(Default)]
pub struct PllFreq {
pub pll_p: Option<Hertz>,