aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxoviat <[email protected]>2023-07-02 22:00:50 -0500
committerxoviat <[email protected]>2023-07-02 22:00:50 -0500
commit0c49e6747c02e03fc6517969105cfdf20239fc64 (patch)
treef7562de45ec12ca2afb5f5bc632e9b50c0526d69
parent2e6b813225450828ebeb9908048675db0e843330 (diff)
wip
-rw-r--r--embassy-stm32/src/pwm/advanced_pwm.rs31
1 files changed, 12 insertions, 19 deletions
diff --git a/embassy-stm32/src/pwm/advanced_pwm.rs b/embassy-stm32/src/pwm/advanced_pwm.rs
index 07d8708dc..9e40c5bf2 100644
--- a/embassy-stm32/src/pwm/advanced_pwm.rs
+++ b/embassy-stm32/src/pwm/advanced_pwm.rs
@@ -195,7 +195,7 @@ pub struct BridgeConverter<T: HighResolutionCaptureCompare16bitInstance, C: Adva
195 195
196impl<T: HighResolutionCaptureCompare16bitInstance, C: AdvancedChannel<T>> BridgeConverter<T, C> { 196impl<T: HighResolutionCaptureCompare16bitInstance, C: AdvancedChannel<T>> BridgeConverter<T, C> {
197 pub fn new(_channel: C, frequency: Hertz) -> Self { 197 pub fn new(_channel: C, frequency: Hertz) -> Self {
198 use crate::pac::hrtim::vals::{Activeeffect, Cont, Inactiveeffect}; 198 use crate::pac::hrtim::vals::{Activeeffect, Inactiveeffect};
199 199
200 T::set_channel_frequency(C::raw(), frequency); 200 T::set_channel_frequency(C::raw(), frequency);
201 201
@@ -203,8 +203,7 @@ impl<T: HighResolutionCaptureCompare16bitInstance, C: AdvancedChannel<T>> Bridge
203 T::regs().tim(C::raw()).cr().modify(|w| { 203 T::regs().tim(C::raw()).cr().modify(|w| {
204 w.set_preen(true); 204 w.set_preen(true);
205 w.set_repu(true); 205 w.set_repu(true);
206 206 w.set_cont(true);
207 w.set_cont(Cont::CONTINUOUS);
208 }); 207 });
209 208
210 // Enable timer outputs 209 // Enable timer outputs
@@ -260,26 +259,22 @@ impl<T: HighResolutionCaptureCompare16bitInstance, C: AdvancedChannel<T>> Bridge
260 } 259 }
261 260
262 pub fn enable_burst_mode(&mut self) { 261 pub fn enable_burst_mode(&mut self) {
263 use crate::pac::hrtim::vals::{Idlem, Idles};
264
265 T::regs().tim(C::raw()).outr().modify(|w| { 262 T::regs().tim(C::raw()).outr().modify(|w| {
266 w.set_idlem(0, Idlem::SETIDLE); 263 // Enable Burst Mode
267 w.set_idlem(1, Idlem::SETIDLE); 264 w.set_idlem(0, true);
265 w.set_idlem(1, true);
268 266
269 w.set_idles(0, Idles::INACTIVE); 267 // Set output to active during the burst
270 w.set_idles(1, Idles::INACTIVE); 268 w.set_idles(0, true);
269 w.set_idles(1, true);
271 }) 270 })
272 } 271 }
273 272
274 pub fn disable_burst_mode(&mut self) { 273 pub fn disable_burst_mode(&mut self) {
275 use crate::pac::hrtim::vals::{Idlem, Idles};
276
277 T::regs().tim(C::raw()).outr().modify(|w| { 274 T::regs().tim(C::raw()).outr().modify(|w| {
278 w.set_idlem(0, Idlem::NOEFFECT); 275 // Disable Burst Mode
279 w.set_idlem(1, Idlem::NOEFFECT); 276 w.set_idlem(0, false);
280 277 w.set_idlem(1, false);
281 w.set_idles(0, Idles::INACTIVE);
282 w.set_idles(1, Idles::INACTIVE);
283 }) 278 })
284 } 279 }
285 280
@@ -345,8 +340,6 @@ pub struct ResonantConverter<T: HighResolutionCaptureCompare16bitInstance, C: Ad
345 340
346impl<T: HighResolutionCaptureCompare16bitInstance, C: AdvancedChannel<T>> ResonantConverter<T, C> { 341impl<T: HighResolutionCaptureCompare16bitInstance, C: AdvancedChannel<T>> ResonantConverter<T, C> {
347 pub fn new(_channel: C, min_frequency: Hertz, max_frequency: Hertz) -> Self { 342 pub fn new(_channel: C, min_frequency: Hertz, max_frequency: Hertz) -> Self {
348 use crate::pac::hrtim::vals::Cont;
349
350 T::set_channel_frequency(C::raw(), min_frequency); 343 T::set_channel_frequency(C::raw(), min_frequency);
351 344
352 // Always enable preload 345 // Always enable preload
@@ -354,7 +347,7 @@ impl<T: HighResolutionCaptureCompare16bitInstance, C: AdvancedChannel<T>> Resona
354 w.set_preen(true); 347 w.set_preen(true);
355 w.set_repu(true); 348 w.set_repu(true);
356 349
357 w.set_cont(Cont::CONTINUOUS); 350 w.set_cont(true);
358 w.set_half(true); 351 w.set_half(true);
359 }); 352 });
360 353