embassy-stm32: Simplify time

- Remove unused `MilliSeconds`, `MicroSeconds`, and `NanoSeconds` types
- Remove `Bps`, `KiloHertz`, and `MegaHertz` types that were only used
for converting to `Hertz`
- Replace all instances of `impl Into<Hertz>` with `Hertz`
- Add `hz`, `khz`, and `mhz` methods to `Hertz`, as well as
free function shortcuts
- Remove `U32Ext` extension trait
This commit is contained in:
Grant Miller
2022-07-10 17:36:10 -05:00
parent 9753f76794
commit 5ecbe5c918
34 changed files with 211 additions and 321 deletions

View File

@ -5,13 +5,13 @@
use defmt::*;
use embassy::executor::Spawner;
use embassy_stm32::sdmmc::Sdmmc;
use embassy_stm32::time::U32Ext;
use embassy_stm32::time::mhz;
use embassy_stm32::{interrupt, Config, Peripherals};
use {defmt_rtt as _, panic_probe as _};
fn config() -> Config {
let mut config = Config::default();
config.rcc.sys_ck = Some(200.mhz().into());
config.rcc.sys_ck = Some(mhz(200));
config
}
@ -31,7 +31,7 @@ async fn main(_spawner: Spawner, p: Peripherals) -> ! {
// Should print 400kHz for initialization
info!("Configured clock: {}", sdmmc.clock().0);
unwrap!(sdmmc.init_card(25.mhz()).await);
unwrap!(sdmmc.init_card(mhz(25)).await);
let card = unwrap!(sdmmc.card());