diff options
| -rw-r--r-- | embassy-stm32/Cargo.toml | 4 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/h.rs | 27 |
2 files changed, 8 insertions, 23 deletions
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml index 24af17327..cc76408f3 100644 --- a/embassy-stm32/Cargo.toml +++ b/embassy-stm32/Cargo.toml | |||
| @@ -68,7 +68,7 @@ rand_core = "0.6.3" | |||
| 68 | sdio-host = "0.5.0" | 68 | sdio-host = "0.5.0" |
| 69 | critical-section = "1.1" | 69 | critical-section = "1.1" |
| 70 | #stm32-metapac = { version = "15" } | 70 | #stm32-metapac = { version = "15" } |
| 71 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-8ae5bb5fe696a7e61fb41b8b797372aed8103a82" } | 71 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-8a3ad0b738292ae40af201d79b28db60fe876e11" } |
| 72 | vcell = "0.1.3" | 72 | vcell = "0.1.3" |
| 73 | bxcan = "0.7.0" | 73 | bxcan = "0.7.0" |
| 74 | nb = "1.0.0" | 74 | nb = "1.0.0" |
| @@ -89,7 +89,7 @@ critical-section = { version = "1.1", features = ["std"] } | |||
| 89 | proc-macro2 = "1.0.36" | 89 | proc-macro2 = "1.0.36" |
| 90 | quote = "1.0.15" | 90 | quote = "1.0.15" |
| 91 | #stm32-metapac = { version = "15", default-features = false, features = ["metadata"]} | 91 | #stm32-metapac = { version = "15", default-features = false, features = ["metadata"]} |
| 92 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-8ae5bb5fe696a7e61fb41b8b797372aed8103a82", default-features = false, features = ["metadata"]} | 92 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-8a3ad0b738292ae40af201d79b28db60fe876e11", default-features = false, features = ["metadata"]} |
| 93 | 93 | ||
| 94 | 94 | ||
| 95 | [features] | 95 | [features] |
diff --git a/embassy-stm32/src/rcc/h.rs b/embassy-stm32/src/rcc/h.rs index 474c44115..c2a71eaf1 100644 --- a/embassy-stm32/src/rcc/h.rs +++ b/embassy-stm32/src/rcc/h.rs | |||
| @@ -170,22 +170,7 @@ pub enum SupplyConfig { | |||
| 170 | /// This is only used in certain power supply configurations: | 170 | /// This is only used in certain power supply configurations: |
| 171 | /// SMPSLDO, SMPSExternalLDO, SMPSExternalLDOBypass. | 171 | /// SMPSLDO, SMPSExternalLDO, SMPSExternalLDOBypass. |
| 172 | #[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468))] | 172 | #[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468))] |
| 173 | #[derive(PartialEq)] | 173 | pub use pac::pwr::vals::Sdlevel as SMPSSupplyVoltage; |
| 174 | pub enum SMPSSupplyVoltage { | ||
| 175 | V1_8, | ||
| 176 | V2_5, | ||
| 177 | } | ||
| 178 | |||
| 179 | #[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468))] | ||
| 180 | impl SMPSSupplyVoltage { | ||
| 181 | /// Convert SMPSSupplyVoltage to u8 representation. | ||
| 182 | fn to_u8(&self) -> u8 { | ||
| 183 | match self { | ||
| 184 | SMPSSupplyVoltage::V1_8 => 0b01, | ||
| 185 | SMPSSupplyVoltage::V2_5 => 0b10, | ||
| 186 | } | ||
| 187 | } | ||
| 188 | } | ||
| 189 | 174 | ||
| 190 | /// Configuration of the core clocks | 175 | /// Configuration of the core clocks |
| 191 | #[non_exhaustive] | 176 | #[non_exhaustive] |
| @@ -279,7 +264,7 @@ pub(crate) unsafe fn init(config: Config) { | |||
| 279 | match config.supply_config { | 264 | match config.supply_config { |
| 280 | SupplyConfig::Default => { | 265 | SupplyConfig::Default => { |
| 281 | PWR.cr3().modify(|w| { | 266 | PWR.cr3().modify(|w| { |
| 282 | w.set_sdlevel(0b00); | 267 | w.set_sdlevel(SMPSSupplyVoltage::RESET); |
| 283 | w.set_sdexthp(false); | 268 | w.set_sdexthp(false); |
| 284 | w.set_sden(true); | 269 | w.set_sden(true); |
| 285 | w.set_ldoen(true); | 270 | w.set_ldoen(true); |
| @@ -301,11 +286,11 @@ pub(crate) unsafe fn init(config: Config) { | |||
| 301 | w.set_bypass(false); | 286 | w.set_bypass(false); |
| 302 | }); | 287 | }); |
| 303 | } | 288 | } |
| 304 | SupplyConfig::SMPSLDO(ref smps_supply_voltage) | 289 | SupplyConfig::SMPSLDO(smps_supply_voltage) |
| 305 | | SupplyConfig::SMPSExternalLDO(ref smps_supply_voltage) | 290 | | SupplyConfig::SMPSExternalLDO(smps_supply_voltage) |
| 306 | | SupplyConfig::SMPSExternalLDOBypass(ref smps_supply_voltage) => { | 291 | | SupplyConfig::SMPSExternalLDOBypass(smps_supply_voltage) => { |
| 307 | PWR.cr3().modify(|w| { | 292 | PWR.cr3().modify(|w| { |
| 308 | w.set_sdlevel(smps_supply_voltage.to_u8()); | 293 | w.set_sdlevel(smps_supply_voltage); |
| 309 | w.set_sdexthp(matches!( | 294 | w.set_sdexthp(matches!( |
| 310 | config.supply_config, | 295 | config.supply_config, |
| 311 | SupplyConfig::SMPSExternalLDO(_) | SupplyConfig::SMPSExternalLDOBypass(_) | 296 | SupplyConfig::SMPSExternalLDO(_) | SupplyConfig::SMPSExternalLDOBypass(_) |
