diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-07-11 02:51:06 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-07-11 02:51:06 +0000 |
| commit | 2adee4af3878cb0e8027752c9d29a6ce236f4ab3 (patch) | |
| tree | e6f2700ab17bcb62d0195debade2df44c54b03b4 /examples/stm32f4 | |
| parent | 99f4fd33b493f11ec3202eb98fc3ae9e18b9d589 (diff) | |
| parent | 5ecbe5c9181d2392540a3273f21d53c01474d341 (diff) | |
Merge #858
858: embassy-stm32: Simplify time r=Dirbaio a=GrantM11235
- 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
Co-authored-by: Grant Miller <[email protected]>
Diffstat (limited to 'examples/stm32f4')
| -rw-r--r-- | examples/stm32f4/src/bin/pwm.rs | 4 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/sdmmc.rs | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/examples/stm32f4/src/bin/pwm.rs b/examples/stm32f4/src/bin/pwm.rs index cd20c68bb..c99f3cc26 100644 --- a/examples/stm32f4/src/bin/pwm.rs +++ b/examples/stm32f4/src/bin/pwm.rs | |||
| @@ -7,7 +7,7 @@ use embassy::executor::Spawner; | |||
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy::time::{Duration, Timer}; |
| 8 | use embassy_stm32::pwm::simple_pwm::SimplePwm; | 8 | use embassy_stm32::pwm::simple_pwm::SimplePwm; |
| 9 | use embassy_stm32::pwm::Channel; | 9 | use embassy_stm32::pwm::Channel; |
| 10 | use embassy_stm32::time::U32Ext; | 10 | use embassy_stm32::time::khz; |
| 11 | use embassy_stm32::Peripherals; | 11 | use embassy_stm32::Peripherals; |
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
| @@ -15,7 +15,7 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 15 | async fn main(_spawner: Spawner, p: Peripherals) { | 15 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 16 | info!("Hello World!"); | 16 | info!("Hello World!"); |
| 17 | 17 | ||
| 18 | let mut pwm = SimplePwm::new_1ch(p.TIM1, p.PE9, 10000.hz()); | 18 | let mut pwm = SimplePwm::new_1ch(p.TIM1, p.PE9, khz(10)); |
| 19 | let max = pwm.get_max_duty(); | 19 | let max = pwm.get_max_duty(); |
| 20 | pwm.enable(Channel::Ch1); | 20 | pwm.enable(Channel::Ch1); |
| 21 | 21 | ||
diff --git a/examples/stm32f4/src/bin/sdmmc.rs b/examples/stm32f4/src/bin/sdmmc.rs index b08d26f49..665670261 100644 --- a/examples/stm32f4/src/bin/sdmmc.rs +++ b/examples/stm32f4/src/bin/sdmmc.rs | |||
| @@ -5,13 +5,13 @@ | |||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy::executor::Spawner; | 6 | use embassy::executor::Spawner; |
| 7 | use embassy_stm32::sdmmc::Sdmmc; | 7 | use embassy_stm32::sdmmc::Sdmmc; |
| 8 | use embassy_stm32::time::U32Ext; | 8 | use embassy_stm32::time::mhz; |
| 9 | use embassy_stm32::{interrupt, Config, Peripherals}; | 9 | use embassy_stm32::{interrupt, Config, Peripherals}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | fn config() -> Config { | 12 | fn config() -> Config { |
| 13 | let mut config = Config::default(); | 13 | let mut config = Config::default(); |
| 14 | config.rcc.sys_ck = Some(48.mhz().into()); | 14 | config.rcc.sys_ck = Some(mhz(48)); |
| 15 | config | 15 | config |
| 16 | } | 16 | } |
| 17 | 17 | ||
| @@ -32,7 +32,7 @@ async fn main(_spawner: Spawner, p: Peripherals) -> ! { | |||
| 32 | // Should print 400kHz for initialization | 32 | // Should print 400kHz for initialization |
| 33 | info!("Configured clock: {}", sdmmc.clock().0); | 33 | info!("Configured clock: {}", sdmmc.clock().0); |
| 34 | 34 | ||
| 35 | unwrap!(sdmmc.init_card(25.mhz()).await); | 35 | unwrap!(sdmmc.init_card(mhz(25)).await); |
| 36 | 36 | ||
| 37 | let card = unwrap!(sdmmc.card()); | 37 | let card = unwrap!(sdmmc.card()); |
| 38 | 38 | ||
