Merge pull request #2562 from embassy-rs/rcc-h7-sdlevel
stm32/rcc: use h7 sdlevel enum from pac.
This commit is contained in:
commit
9664972f53
2 changed files with 8 additions and 23 deletions
|
@ -68,7 +68,7 @@ rand_core = "0.6.3"
|
||||||
sdio-host = "0.5.0"
|
sdio-host = "0.5.0"
|
||||||
critical-section = "1.1"
|
critical-section = "1.1"
|
||||||
#stm32-metapac = { version = "15" }
|
#stm32-metapac = { version = "15" }
|
||||||
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-8ae5bb5fe696a7e61fb41b8b797372aed8103a82" }
|
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-8a3ad0b738292ae40af201d79b28db60fe876e11" }
|
||||||
vcell = "0.1.3"
|
vcell = "0.1.3"
|
||||||
bxcan = "0.7.0"
|
bxcan = "0.7.0"
|
||||||
nb = "1.0.0"
|
nb = "1.0.0"
|
||||||
|
@ -89,7 +89,7 @@ critical-section = { version = "1.1", features = ["std"] }
|
||||||
proc-macro2 = "1.0.36"
|
proc-macro2 = "1.0.36"
|
||||||
quote = "1.0.15"
|
quote = "1.0.15"
|
||||||
#stm32-metapac = { version = "15", default-features = false, features = ["metadata"]}
|
#stm32-metapac = { version = "15", default-features = false, features = ["metadata"]}
|
||||||
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-8ae5bb5fe696a7e61fb41b8b797372aed8103a82", default-features = false, features = ["metadata"]}
|
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-8a3ad0b738292ae40af201d79b28db60fe876e11", default-features = false, features = ["metadata"]}
|
||||||
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|
|
@ -170,22 +170,7 @@ pub enum SupplyConfig {
|
||||||
/// This is only used in certain power supply configurations:
|
/// This is only used in certain power supply configurations:
|
||||||
/// SMPSLDO, SMPSExternalLDO, SMPSExternalLDOBypass.
|
/// SMPSLDO, SMPSExternalLDO, SMPSExternalLDOBypass.
|
||||||
#[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468))]
|
#[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468))]
|
||||||
#[derive(PartialEq)]
|
pub use pac::pwr::vals::Sdlevel as SMPSSupplyVoltage;
|
||||||
pub enum SMPSSupplyVoltage {
|
|
||||||
V1_8,
|
|
||||||
V2_5,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468))]
|
|
||||||
impl SMPSSupplyVoltage {
|
|
||||||
/// Convert SMPSSupplyVoltage to u8 representation.
|
|
||||||
fn to_u8(&self) -> u8 {
|
|
||||||
match self {
|
|
||||||
SMPSSupplyVoltage::V1_8 => 0b01,
|
|
||||||
SMPSSupplyVoltage::V2_5 => 0b10,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Configuration of the core clocks
|
/// Configuration of the core clocks
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
|
@ -279,7 +264,7 @@ pub(crate) unsafe fn init(config: Config) {
|
||||||
match config.supply_config {
|
match config.supply_config {
|
||||||
SupplyConfig::Default => {
|
SupplyConfig::Default => {
|
||||||
PWR.cr3().modify(|w| {
|
PWR.cr3().modify(|w| {
|
||||||
w.set_sdlevel(0b00);
|
w.set_sdlevel(SMPSSupplyVoltage::RESET);
|
||||||
w.set_sdexthp(false);
|
w.set_sdexthp(false);
|
||||||
w.set_sden(true);
|
w.set_sden(true);
|
||||||
w.set_ldoen(true);
|
w.set_ldoen(true);
|
||||||
|
@ -301,11 +286,11 @@ pub(crate) unsafe fn init(config: Config) {
|
||||||
w.set_bypass(false);
|
w.set_bypass(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
SupplyConfig::SMPSLDO(ref smps_supply_voltage)
|
SupplyConfig::SMPSLDO(smps_supply_voltage)
|
||||||
| SupplyConfig::SMPSExternalLDO(ref smps_supply_voltage)
|
| SupplyConfig::SMPSExternalLDO(smps_supply_voltage)
|
||||||
| SupplyConfig::SMPSExternalLDOBypass(ref smps_supply_voltage) => {
|
| SupplyConfig::SMPSExternalLDOBypass(smps_supply_voltage) => {
|
||||||
PWR.cr3().modify(|w| {
|
PWR.cr3().modify(|w| {
|
||||||
w.set_sdlevel(smps_supply_voltage.to_u8());
|
w.set_sdlevel(smps_supply_voltage);
|
||||||
w.set_sdexthp(matches!(
|
w.set_sdexthp(matches!(
|
||||||
config.supply_config,
|
config.supply_config,
|
||||||
SupplyConfig::SMPSExternalLDO(_) | SupplyConfig::SMPSExternalLDOBypass(_)
|
SupplyConfig::SMPSExternalLDO(_) | SupplyConfig::SMPSExternalLDOBypass(_)
|
||||||
|
|
Loading…
Reference in a new issue