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

@ -10,16 +10,16 @@ use defmt::*;
use embassy::executor::Executor;
use embassy::util::Forever;
use embassy_stm32::peripherals::{DMA1_CH3, DMA1_CH4, SPI3};
use embassy_stm32::time::U32Ext;
use embassy_stm32::time::mhz;
use embassy_stm32::{spi, Config};
use heapless::String;
use {defmt_rtt as _, panic_probe as _};
pub fn config() -> Config {
let mut config = Config::default();
config.rcc.sys_ck = Some(400.mhz().into());
config.rcc.hclk = Some(200.mhz().into());
config.rcc.pll1.q_ck = Some(100.mhz().into());
config.rcc.sys_ck = Some(mhz(400));
config.rcc.hclk = Some(mhz(200));
config.rcc.pll1.q_ck = Some(mhz(100));
config
}
@ -50,7 +50,7 @@ fn main() -> ! {
p.PB4,
p.DMA1_CH3,
p.DMA1_CH4,
1.mhz(),
mhz(1),
spi::Config::default(),
);