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

This commit is contained in:
ROMemories 2025-05-21 11:36:55 +02:00
parent 65a22439d5
commit 79b24bd35d

View File

@ -59,9 +59,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::DIV4,
@ -71,12 +71,19 @@ impl Default for Config {
sys: Sysclk::HSISYS,
ahb_pre: AHBPrescaler::DIV1,
apb1_pre: APBPrescaler::DIV1,
ls: Default::default(),
mux: Default::default(),
ls: crate::rcc::LsConfig::new(),
mux: super::mux::ClockMux::default(),
}
}
}
impl Default for Config {
#[inline]
fn default() -> Config {
Self::new()
}
}
pub(crate) unsafe fn init(config: Config) {
// Turn on the HSI
match config.hsi {