From 21a86531955facbdba5583b5218e20f1ca6dc23e Mon Sep 17 00:00:00 2001 From: xoviat Date: Sat, 1 Jul 2023 17:32:16 -0500 Subject: [PATCH] hrtim: minor cleanup --- embassy-stm32/Cargo.toml | 2 +- embassy-stm32/src/pwm/advanced_pwm.rs | 28 ++++++++++++++------------- examples/stm32f334/.cargo/config.toml | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml index 3d9ee8261..551c09698 100644 --- a/embassy-stm32/Cargo.toml +++ b/embassy-stm32/Cargo.toml @@ -57,7 +57,7 @@ sdio-host = "0.5.0" embedded-sdmmc = { git = "https://github.com/embassy-rs/embedded-sdmmc-rs", rev = "a4f293d3a6f72158385f79c98634cb8a14d0d2fc", optional = true } critical-section = "1.1" atomic-polyfill = "1.0.1" -stm32-metapac = "10" +stm32-metapac = "12" vcell = "0.1.3" bxcan = "0.7.0" nb = "1.0.0" diff --git a/embassy-stm32/src/pwm/advanced_pwm.rs b/embassy-stm32/src/pwm/advanced_pwm.rs index 7e595421c..65f4e7ca7 100644 --- a/embassy-stm32/src/pwm/advanced_pwm.rs +++ b/embassy-stm32/src/pwm/advanced_pwm.rs @@ -187,8 +187,12 @@ impl> Bridge T::regs().tim(C::raw()).cr().modify(|w| { w.set_preen(true); - // TODO: fix metapac - w.set_cont(Cont(1)); + w.set_cont(Cont::CONTINUOUS); + }); + + T::regs().oenr().modify(|w| { + w.set_t1oen(C::raw(), true); + w.set_t2oen(C::raw(), true); }); // Set output 1 to active on a period event @@ -234,24 +238,23 @@ impl> Bridge // TODO: fix metapac T::regs().tim(C::raw()).outr().modify(|w| { - w.set_idlem(0, Idlem(1)); - w.set_idlem(1, Idlem(1)); + w.set_idlem(0, Idlem::SETIDLE); + w.set_idlem(1, Idlem::SETIDLE); - w.set_idles(0, Idles(1)); - w.set_idles(1, Idles(1)); + w.set_idles(0, Idles::INACTIVE); + w.set_idles(1, Idles::INACTIVE); }) } pub fn disable_burst_mode(&mut self) { use crate::pac::hrtim::vals::{Idlem, Idles}; - // TODO: fix metapac T::regs().tim(C::raw()).outr().modify(|w| { - w.set_idlem(0, Idlem(0)); - w.set_idlem(1, Idlem(0)); + w.set_idlem(0, Idlem::NOEFFECT); + w.set_idlem(1, Idlem::NOEFFECT); - w.set_idles(0, Idles(0)); - w.set_idles(1, Idles(0)); + w.set_idles(0, Idles::INACTIVE); + w.set_idles(1, Idles::INACTIVE); }) } @@ -303,8 +306,7 @@ impl> Resona T::regs().tim(C::raw()).cr().modify(|w| { w.set_preen(true); - // TODO: fix metapac - w.set_cont(Cont(1)); + w.set_cont(Cont::CONTINUOUS); w.set_half(true); }); diff --git a/examples/stm32f334/.cargo/config.toml b/examples/stm32f334/.cargo/config.toml index 7f3fda529..caf947be6 100644 --- a/examples/stm32f334/.cargo/config.toml +++ b/examples/stm32f334/.cargo/config.toml @@ -1,6 +1,6 @@ [target.'cfg(all(target_arch = "arm", target_os = "none"))'] # replace STM32F429ZITx with your chip as listed in `probe-rs-cli chip list` -runner = "probe-rs-cli run --chip STM32F303ZETx" +runner = "probe-run --chip STM32F334R8" [build] target = "thumbv7em-none-eabihf"