mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-10-02 14:44:32 +00:00
feat(stm32-h): provide a const
constructor on rcc::Config
This commit is contained in:
parent
ea243761f7
commit
48b36adafd
@ -218,13 +218,13 @@ pub struct Config {
|
|||||||
pub mux: super::mux::ClockMux,
|
pub mux: super::mux::ClockMux,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Config {
|
impl Config {
|
||||||
fn default() -> Self {
|
pub const fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
hsi: Some(HSIPrescaler::DIV1),
|
hsi: Some(HSIPrescaler::DIV1),
|
||||||
hse: None,
|
hse: None,
|
||||||
csi: false,
|
csi: false,
|
||||||
hsi48: Some(Default::default()),
|
hsi48: Some(crate::rcc::Hsi48Config::new()),
|
||||||
sys: Sysclk::HSI,
|
sys: Sysclk::HSI,
|
||||||
pll1: None,
|
pll1: None,
|
||||||
pll2: None,
|
pll2: None,
|
||||||
@ -248,16 +248,22 @@ impl Default for Config {
|
|||||||
voltage_scale: VoltageScale::Scale0,
|
voltage_scale: VoltageScale::Scale0,
|
||||||
#[cfg(rcc_h7rs)]
|
#[cfg(rcc_h7rs)]
|
||||||
voltage_scale: VoltageScale::HIGH,
|
voltage_scale: VoltageScale::HIGH,
|
||||||
ls: Default::default(),
|
ls: crate::rcc::LsConfig::new(),
|
||||||
|
|
||||||
#[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468, pwr_h7rs))]
|
#[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468, pwr_h7rs))]
|
||||||
supply_config: SupplyConfig::LDO,
|
supply_config: SupplyConfig::LDO,
|
||||||
|
|
||||||
mux: Default::default(),
|
mux: super::mux::ClockMux::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for Config {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) unsafe fn init(config: Config) {
|
pub(crate) unsafe fn init(config: Config) {
|
||||||
#[cfg(any(stm32h7))]
|
#[cfg(any(stm32h7))]
|
||||||
let pwr_reg = PWR.cr3();
|
let pwr_reg = PWR.cr3();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user