diff options
author | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2022-08-17 14:44:18 +0200 |
---|---|---|
committer | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2022-08-17 14:44:18 +0200 |
commit | 72cd015c1ad107003e56ffcec3441b43066e4bda (patch) | |
tree | 1c36b092d473dbca2742e7d0e7fd259360e6b9bf /embassy-stm32 | |
parent | 13b1ca1eb65ddf969526fd71841145ad9a0502f8 (diff) | |
download | embassy-72cd015c1ad107003e56ffcec3441b43066e4bda.zip |
stm32/sdmmc: remove cast no longer allowed on latest nightly due to nonexhaustive enum.
Diffstat (limited to 'embassy-stm32')
-rw-r--r-- | embassy-stm32/src/sdmmc/mod.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/embassy-stm32/src/sdmmc/mod.rs b/embassy-stm32/src/sdmmc/mod.rs index 1de4b2aa..3ad31ec8 100644 --- a/embassy-stm32/src/sdmmc/mod.rs +++ b/embassy-stm32/src/sdmmc/mod.rs @@ -999,10 +999,17 @@ impl SdmmcInner { fn clkcr_set_clkdiv(&self, freq: u32, width: BusWidth, ker_ck: Hertz, clock: &mut Hertz) -> Result<(), Error> { let regs = self.0; + let width_u32 = match width { + BusWidth::One => 1u32, + BusWidth::Four => 4u32, + BusWidth::Eight => 8u32, + _ => panic!("Invalid Bus Width"), + }; + let (clkdiv, new_clock) = clk_div(ker_ck, freq)?; // Enforce AHB and SDMMC_CK clock relation. See RM0433 Rev 7 // Section 55.5.8 - let sdmmc_bus_bandwidth = new_clock.0 * (width as u32); + let sdmmc_bus_bandwidth = new_clock.0 * width_u32; assert!(ker_ck.0 > 3 * sdmmc_bus_bandwidth / 32); *clock = new_clock; |