aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorROMemories <[email protected]>2025-05-21 11:36:55 +0200
committerROMemories <[email protected]>2025-05-21 14:19:12 +0200
commitea243761f727fb4fe2e2a55e85d3f0ac80e6387d (patch)
tree3e3a95036cd566813ca56c5f565e40c1bd44f0c1
parent26fb6eb9f65e7bf03302c26727ef7d6d940cf648 (diff)
feat(stm32-g4): provide a `const` constructor on `rcc::Config`
-rw-r--r--embassy-stm32/src/rcc/g4.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/embassy-stm32/src/rcc/g4.rs b/embassy-stm32/src/rcc/g4.rs
index d7d5c7388..e4b216450 100644
--- a/embassy-stm32/src/rcc/g4.rs
+++ b/embassy-stm32/src/rcc/g4.rs
@@ -91,26 +91,33 @@ pub struct Config {
91 pub mux: super::mux::ClockMux, 91 pub mux: super::mux::ClockMux,
92} 92}
93 93
94impl Default for Config { 94impl Config {
95 #[inline] 95 #[inline]
96 fn default() -> Config { 96 pub const fn new() -> Self {
97 Config { 97 Config {
98 hsi: true, 98 hsi: true,
99 hse: None, 99 hse: None,
100 sys: Sysclk::HSI, 100 sys: Sysclk::HSI,
101 hsi48: Some(Default::default()), 101 hsi48: Some(crate::rcc::Hsi48Config::new()),
102 pll: None, 102 pll: None,
103 ahb_pre: AHBPrescaler::DIV1, 103 ahb_pre: AHBPrescaler::DIV1,
104 apb1_pre: APBPrescaler::DIV1, 104 apb1_pre: APBPrescaler::DIV1,
105 apb2_pre: APBPrescaler::DIV1, 105 apb2_pre: APBPrescaler::DIV1,
106 low_power_run: false, 106 low_power_run: false,
107 ls: Default::default(), 107 ls: crate::rcc::LsConfig::new(),
108 boost: false, 108 boost: false,
109 mux: Default::default(), 109 mux: super::mux::ClockMux::default(),
110 } 110 }
111 } 111 }
112} 112}
113 113
114impl Default for Config {
115 #[inline]
116 fn default() -> Config {
117 Self::new()
118 }
119}
120
114#[derive(Default)] 121#[derive(Default)]
115pub struct PllFreq { 122pub struct PllFreq {
116 pub pll_p: Option<Hertz>, 123 pub pll_p: Option<Hertz>,