diff options
| -rw-r--r-- | embassy-stm32/src/rcc/u5.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/embassy-stm32/src/rcc/u5.rs b/embassy-stm32/src/rcc/u5.rs index 93a327be7..ff70466b9 100644 --- a/embassy-stm32/src/rcc/u5.rs +++ b/embassy-stm32/src/rcc/u5.rs | |||
| @@ -97,14 +97,14 @@ pub struct Config { | |||
| 97 | pub mux: super::mux::ClockMux, | 97 | pub mux: super::mux::ClockMux, |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | impl Default for Config { | 100 | impl Config { |
| 101 | fn default() -> Self { | 101 | pub const fn new() -> Self { |
| 102 | Self { | 102 | Self { |
| 103 | msis: Some(Msirange::RANGE_4MHZ), | 103 | msis: Some(Msirange::RANGE_4MHZ), |
| 104 | msik: Some(Msirange::RANGE_4MHZ), | 104 | msik: Some(Msirange::RANGE_4MHZ), |
| 105 | hse: None, | 105 | hse: None, |
| 106 | hsi: false, | 106 | hsi: false, |
| 107 | hsi48: Some(Default::default()), | 107 | hsi48: Some(crate::rcc::Hsi48Config::new()), |
| 108 | pll1: None, | 108 | pll1: None, |
| 109 | pll2: None, | 109 | pll2: None, |
| 110 | pll3: None, | 110 | pll3: None, |
| @@ -114,12 +114,18 @@ impl Default for Config { | |||
| 114 | apb2_pre: APBPrescaler::DIV1, | 114 | apb2_pre: APBPrescaler::DIV1, |
| 115 | apb3_pre: APBPrescaler::DIV1, | 115 | apb3_pre: APBPrescaler::DIV1, |
| 116 | voltage_range: VoltageScale::RANGE1, | 116 | voltage_range: VoltageScale::RANGE1, |
| 117 | ls: Default::default(), | 117 | ls: crate::rcc::LsConfig::new(), |
| 118 | mux: Default::default(), | 118 | mux: super::mux::ClockMux::default(), |
| 119 | } | 119 | } |
| 120 | } | 120 | } |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | impl Default for Config { | ||
| 124 | fn default() -> Self { | ||
| 125 | Self::new() | ||
| 126 | } | ||
| 127 | } | ||
| 128 | |||
| 123 | pub(crate) unsafe fn init(config: Config) { | 129 | pub(crate) unsafe fn init(config: Config) { |
| 124 | // Set the requested power mode | 130 | // Set the requested power mode |
| 125 | PWR.vosr().modify(|w| w.set_vos(config.voltage_range)); | 131 | PWR.vosr().modify(|w| w.set_vos(config.voltage_range)); |
