aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/hrtim
diff options
context:
space:
mode:
authorDavid Lawrence <[email protected]>2024-12-06 11:07:38 -0500
committerDavid Lawrence <[email protected]>2024-12-06 21:58:18 -0500
commit0bec981882d5dda657a54f46afd3cfac054cd00f (patch)
treee40a92915ad6836c7107ba0ba2852825463644a8 /embassy-stm32/src/hrtim
parent48d00bd74c04588f1918b40b3b0e736910628286 (diff)
STM32: bump to latest stm32-metapac
HRTIM driver is updated per https://github.com/embassy-rs/stm32-data/pull/544
Diffstat (limited to 'embassy-stm32/src/hrtim')
-rw-r--r--embassy-stm32/src/hrtim/mod.rs22
1 files changed, 4 insertions, 18 deletions
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,