aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBadr Bouslikhin <[email protected]>2023-12-02 14:45:36 +0100
committerBadr Bouslikhin <[email protected]>2023-12-02 14:45:36 +0100
commit87c0f1525dee9c2762872426076ffa82dc45900b (patch)
tree2aee8a468823859c8891a5034097cbd8db142c3b
parentc97f65ac609221067f7af4deb69d5b7d66d57c7a (diff)
stm32/rcc: enable power supply configurability for rm0455 and rm0468
-rw-r--r--embassy-stm32/src/rcc/h.rs18
1 files changed, 5 insertions, 13 deletions
diff --git a/embassy-stm32/src/rcc/h.rs b/embassy-stm32/src/rcc/h.rs
index 2d3550da6..55543472c 100644
--- a/embassy-stm32/src/rcc/h.rs
+++ b/embassy-stm32/src/rcc/h.rs
@@ -119,7 +119,7 @@ impl From<TimerPrescaler> for Timpre {
119 119
120/// Power supply configuration 120/// Power supply configuration
121/// See RM0433 Rev 4 7.4 121/// See RM0433 Rev 4 7.4
122#[cfg(pwr_h7rm0399)] 122#[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468))]
123pub enum SupplyConfig { 123pub enum SupplyConfig {
124 /// Default power supply configuration. 124 /// Default power supply configuration.
125 /// V CORE Power Domains are supplied from the LDO according to VOS. 125 /// V CORE Power Domains are supplied from the LDO according to VOS.
@@ -162,7 +162,7 @@ pub enum SupplyConfig {
162/// SMPS step-down converter voltage output level. 162/// SMPS step-down converter voltage output level.
163/// This is only used in certain power supply configurations: 163/// This is only used in certain power supply configurations:
164/// SMPSLDO, SMPSExternalLDO, SMPSExternalLDOBypass. 164/// SMPSLDO, SMPSExternalLDO, SMPSExternalLDOBypass.
165#[cfg(pwr_h7rm0399)] 165#[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468))]
166pub enum SMPSSupplyVoltage { 166pub enum SMPSSupplyVoltage {
167 V1_8, 167 V1_8,
168 V2_5, 168 V2_5,
@@ -196,7 +196,7 @@ pub struct Config {
196 pub voltage_scale: VoltageScale, 196 pub voltage_scale: VoltageScale,
197 pub ls: super::LsConfig, 197 pub ls: super::LsConfig,
198 198
199 #[cfg(pwr_h7rm0399)] 199 #[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468))]
200 pub supply_config: SupplyConfig, 200 pub supply_config: SupplyConfig,
201 pub smps_supply_voltage: Option<SMPSSupplyVoltage>, 201 pub smps_supply_voltage: Option<SMPSSupplyVoltage>,
202} 202}
@@ -233,7 +233,7 @@ impl Default for Config {
233 voltage_scale: VoltageScale::Scale0, 233 voltage_scale: VoltageScale::Scale0,
234 ls: Default::default(), 234 ls: Default::default(),
235 235
236 #[cfg(pwr_h7rm0399)] 236 #[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468))]
237 supply_config: SupplyConfig::Default, 237 supply_config: SupplyConfig::Default,
238 smps_supply_voltage: None, 238 smps_supply_voltage: None,
239 } 239 }
@@ -253,15 +253,7 @@ pub(crate) unsafe fn init(config: Config) {
253 w.set_bypass(false); 253 w.set_bypass(false);
254 }); 254 });
255 255
256 #[cfg(any(pwr_h7rm0455, pwr_h7rm0468))] 256 #[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468))]
257 PWR.cr3().modify(|w| {
258 // hardcode "Direct SPMS" for now, this is what works on nucleos with the
259 // default solderbridge configuration.
260 w.set_sden(true);
261 w.set_ldoen(false);
262 });
263
264 #[cfg(pwr_h7rm0399)]
265 { 257 {
266 match config.supply_config { 258 match config.supply_config {
267 SupplyConfig::Default => { 259 SupplyConfig::Default => {