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

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

View File

@ -108,8 +108,8 @@ pub struct Config {
pub voltage: VoltageScale,
}
impl Default for Config {
fn default() -> Self {
impl Config {
pub const fn new() -> Self {
Self {
hsi: true,
hse: None,
@ -127,15 +127,21 @@ impl Default for Config {
apb1_pre: APBPrescaler::DIV1,
apb2_pre: APBPrescaler::DIV1,
ls: Default::default(),
ls: crate::rcc::LsConfig::new(),
#[cfg(stm32f2)]
voltage: VoltageScale::Range3,
mux: Default::default(),
mux: super::mux::ClockMux::default(),
}
}
}
impl Default for Config {
fn default() -> Self {
Self::new()
}
}
pub(crate) unsafe fn init(config: Config) {
// set VOS to SCALE1, if use PLL
// TODO: check real clock speed before set VOS