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

@ -7,7 +7,7 @@ use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy_stm32::pwm::simple_pwm::SimplePwm;
use embassy_stm32::pwm::Channel;
use embassy_stm32::time::U32Ext;
use embassy_stm32::time::khz;
use embassy_stm32::Peripherals;
use {defmt_rtt as _, panic_probe as _};
@ -15,7 +15,7 @@ use {defmt_rtt as _, panic_probe as _};
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
let mut pwm = SimplePwm::new_1ch(p.TIM2, p.PA5, 10000.hz());
let mut pwm = SimplePwm::new_1ch(p.TIM2, p.PA5, khz(10));
let max = pwm.get_max_duty();
pwm.enable(Channel::Ch1);