summaryrefslogtreecommitdiff
path: root/examples/stm32f4/src/bin
diff options
context:
space:
mode:
authorGrant Miller <GrantM11235@gmail.com>2022-07-10 17:36:10 -0500
committerGrant Miller <GrantM11235@gmail.com>2022-07-10 21:46:45 -0500
commit5ecbe5c9181d2392540a3273f21d53c01474d341 (patch)
treea3d6b547795b38c3b4fd3fcff29f225ccb230ef8 /examples/stm32f4/src/bin
parent9753f767946d79c5987c166e513150aca98ec042 (diff)
downloadembassy-5ecbe5c9181d2392540a3273f21d53c01474d341.zip
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
Diffstat (limited to 'examples/stm32f4/src/bin')
-rw-r--r--examples/stm32f4/src/bin/pwm.rs4
-rw-r--r--examples/stm32f4/src/bin/sdmmc.rs6
2 files changed, 5 insertions, 5 deletions
diff --git a/examples/stm32f4/src/bin/pwm.rs b/examples/stm32f4/src/bin/pwm.rs
index cd20c68b..c99f3cc2 100644
--- a/examples/stm32f4/src/bin/pwm.rs
+++ b/examples/stm32f4/src/bin/pwm.rs
@@ -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.TIM1, p.PE9, 10000.hz());
+ let mut pwm = SimplePwm::new_1ch(p.TIM1, p.PE9, khz(10));
let max = pwm.get_max_duty();
pwm.enable(Channel::Ch1);
diff --git a/examples/stm32f4/src/bin/sdmmc.rs b/examples/stm32f4/src/bin/sdmmc.rs
index b08d26f4..66567026 100644
--- a/examples/stm32f4/src/bin/sdmmc.rs
+++ b/examples/stm32f4/src/bin/sdmmc.rs
@@ -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(48.mhz().into());
+ config.rcc.sys_ck = Some(mhz(48));
config
}
@@ -32,7 +32,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());