aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-stm32/Cargo.toml4
-rw-r--r--embassy-stm32/src/hrtim/mod.rs22
-rw-r--r--examples/stm32f334/src/bin/pwm.rs4
3 files changed, 8 insertions, 22 deletions
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml
index 607e90739..8b4e7c929 100644
--- a/embassy-stm32/Cargo.toml
+++ b/embassy-stm32/Cargo.toml
@@ -72,7 +72,7 @@ rand_core = "0.6.3"
72sdio-host = "0.5.0" 72sdio-host = "0.5.0"
73critical-section = "1.1" 73critical-section = "1.1"
74#stm32-metapac = { version = "15" } 74#stm32-metapac = { version = "15" }
75stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-ab0ec4c19f81854189bab8215544ccd1256e1045" } 75stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-ddb0e7abab14bf3e1399875767b8834442382988" }
76 76
77vcell = "0.1.3" 77vcell = "0.1.3"
78nb = "1.0.0" 78nb = "1.0.0"
@@ -101,7 +101,7 @@ proc-macro2 = "1.0.36"
101quote = "1.0.15" 101quote = "1.0.15"
102 102
103#stm32-metapac = { version = "15", default-features = false, features = ["metadata"]} 103#stm32-metapac = { version = "15", default-features = false, features = ["metadata"]}
104stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-ab0ec4c19f81854189bab8215544ccd1256e1045", default-features = false, features = ["metadata"] } 104stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-ddb0e7abab14bf3e1399875767b8834442382988", default-features = false, features = ["metadata"] }
105 105
106[features] 106[features]
107default = ["rt"] 107default = ["rt"]
diff --git a/embassy-stm32/src/hrtim/mod.rs b/embassy-stm32/src/hrtim/mod.rs
index 13343fc2a..d9b7c16fb 100644
--- a/embassy-stm32/src/hrtim/mod.rs
+++ b/embassy-stm32/src/hrtim/mod.rs
@@ -236,8 +236,6 @@ pub struct BridgeConverter<T: Instance, C: AdvancedChannel<T>> {
236impl<T: Instance, C: AdvancedChannel<T>> BridgeConverter<T, C> { 236impl<T: Instance, C: AdvancedChannel<T>> BridgeConverter<T, C> {
237 /// Create a new HRTIM bridge converter driver. 237 /// Create a new HRTIM bridge converter driver.
238 pub fn new(_channel: C, frequency: Hertz) -> Self { 238 pub fn new(_channel: C, frequency: Hertz) -> Self {
239 use crate::pac::hrtim::vals::{Activeeffect, Inactiveeffect};
240
241 T::set_channel_frequency(C::raw(), frequency); 239 T::set_channel_frequency(C::raw(), frequency);
242 240
243 // Always enable preload 241 // Always enable preload
@@ -258,28 +256,16 @@ impl<T: Instance, C: AdvancedChannel<T>> BridgeConverter<T, C> {
258 // Therefore, software-implemented dead time must be used when setting the duty cycles 256 // Therefore, software-implemented dead time must be used when setting the duty cycles
259 257
260 // Set output 1 to active on a period event 258 // Set output 1 to active on a period event
261 T::regs() 259 T::regs().tim(C::raw()).setr(0).modify(|w| w.set_per(true));
262 .tim(C::raw())
263 .setr(0)
264 .modify(|w| w.set_per(Activeeffect::SETACTIVE));
265 260
266 // Set output 1 to inactive on a compare 1 event 261 // Set output 1 to inactive on a compare 1 event
267 T::regs() 262 T::regs().tim(C::raw()).rstr(0).modify(|w| w.set_cmp(0, true));
268 .tim(C::raw())
269 .rstr(0)
270 .modify(|w| w.set_cmp(0, Inactiveeffect::SETINACTIVE));
271 263
272 // Set output 2 to active on a compare 2 event 264 // Set output 2 to active on a compare 2 event
273 T::regs() 265 T::regs().tim(C::raw()).setr(1).modify(|w| w.set_cmp(1, true));
274 .tim(C::raw())
275 .setr(1)
276 .modify(|w| w.set_cmp(1, Activeeffect::SETACTIVE));
277 266
278 // Set output 2 to inactive on a compare 3 event 267 // Set output 2 to inactive on a compare 3 event
279 T::regs() 268 T::regs().tim(C::raw()).rstr(1).modify(|w| w.set_cmp(2, true));
280 .tim(C::raw())
281 .rstr(1)
282 .modify(|w| w.set_cmp(2, Inactiveeffect::SETINACTIVE));
283 269
284 Self { 270 Self {
285 timer: PhantomData, 271 timer: PhantomData,
diff --git a/examples/stm32f334/src/bin/pwm.rs b/examples/stm32f334/src/bin/pwm.rs
index e6d1a6c02..2b0686121 100644
--- a/examples/stm32f334/src/bin/pwm.rs
+++ b/examples/stm32f334/src/bin/pwm.rs
@@ -57,14 +57,14 @@ async fn main(_spawner: Spawner) {
57 // embassy_stm32::pac::HRTIM1 57 // embassy_stm32::pac::HRTIM1
58 // .tim(0) 58 // .tim(0)
59 // .setr(0) 59 // .setr(0)
60 // .modify(|w| w.set_sst(Activeeffect::SETACTIVE)); 60 // .modify(|w| w.set_sst(true));
61 // 61 //
62 // Timer::after_millis(500).await; 62 // Timer::after_millis(500).await;
63 // 63 //
64 // embassy_stm32::pac::HRTIM1 64 // embassy_stm32::pac::HRTIM1
65 // .tim(0) 65 // .tim(0)
66 // .rstr(0) 66 // .rstr(0)
67 // .modify(|w| w.set_srt(Inactiveeffect::SETINACTIVE)); 67 // .modify(|w| w.set_srt(true));
68 68
69 let max_duty = buck_converter.get_max_compare_value(); 69 let max_duty = buck_converter.get_max_compare_value();
70 70