aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-hal-internal/src/peripheral.rs11
-rw-r--r--embassy-stm32/src/dma/bdma.rs6
-rw-r--r--embassy-stm32/src/dma/dma.rs8
-rw-r--r--embassy-stm32/src/dma/dmamux.rs2
-rw-r--r--embassy-stm32/src/dma/gpdma.rs2
-rw-r--r--embassy-stm32/src/timer/mod.rs64
6 files changed, 43 insertions, 50 deletions
diff --git a/embassy-hal-internal/src/peripheral.rs b/embassy-hal-internal/src/peripheral.rs
index 16d49edfb..f03f41507 100644
--- a/embassy-hal-internal/src/peripheral.rs
+++ b/embassy-hal-internal/src/peripheral.rs
@@ -1,5 +1,5 @@
1use core::marker::PhantomData; 1use core::marker::PhantomData;
2use core::ops::{Deref, DerefMut}; 2use core::ops::Deref;
3 3
4/// An exclusive reference to a peripheral. 4/// An exclusive reference to a peripheral.
5/// 5///
@@ -86,13 +86,6 @@ impl<'a, T> Deref for PeripheralRef<'a, T> {
86 } 86 }
87} 87}
88 88
89impl<'a, T> DerefMut for PeripheralRef<'a, T> {
90 #[inline]
91 fn deref_mut(&mut self) -> &mut Self::Target {
92 &mut self.inner
93 }
94}
95
96/// Trait for any type that can be used as a peripheral of type `P`. 89/// Trait for any type that can be used as a peripheral of type `P`.
97/// 90///
98/// This is used in driver constructors, to allow passing either owned peripherals (e.g. `TWISPI0`), 91/// This is used in driver constructors, to allow passing either owned peripherals (e.g. `TWISPI0`),
@@ -162,7 +155,7 @@ pub trait Peripheral: Sized {
162 } 155 }
163} 156}
164 157
165impl<'b, T: DerefMut> Peripheral for T 158impl<'b, T: Deref> Peripheral for T
166where 159where
167 T::Target: Peripheral, 160 T::Target: Peripheral,
168{ 161{
diff --git a/embassy-stm32/src/dma/bdma.rs b/embassy-stm32/src/dma/bdma.rs
index 077cfdcd9..994bdb1e6 100644
--- a/embassy-stm32/src/dma/bdma.rs
+++ b/embassy-stm32/src/dma/bdma.rs
@@ -299,7 +299,7 @@ impl<'a, C: Channel> Transfer<'a, C> {
299 STATE.complete_count[this.channel.index()].store(0, Ordering::Release); 299 STATE.complete_count[this.channel.index()].store(0, Ordering::Release);
300 300
301 #[cfg(dmamux)] 301 #[cfg(dmamux)]
302 super::dmamux::configure_dmamux(&mut *this.channel, _request); 302 super::dmamux::configure_dmamux(&*this.channel, _request);
303 303
304 ch.par().write_value(peri_addr as u32); 304 ch.par().write_value(peri_addr as u32);
305 ch.mar().write_value(mem_addr as u32); 305 ch.mar().write_value(mem_addr as u32);
@@ -483,7 +483,7 @@ impl<'a, C: Channel, W: Word> ReadableRingBuffer<'a, C, W> {
483 this.clear_irqs(); 483 this.clear_irqs();
484 484
485 #[cfg(dmamux)] 485 #[cfg(dmamux)]
486 super::dmamux::configure_dmamux(&mut *this.channel, _request); 486 super::dmamux::configure_dmamux(&*this.channel, _request);
487 487
488 let ch = dma.ch(channel_number); 488 let ch = dma.ch(channel_number);
489 ch.par().write_value(peri_addr as u32); 489 ch.par().write_value(peri_addr as u32);
@@ -641,7 +641,7 @@ impl<'a, C: Channel, W: Word> WritableRingBuffer<'a, C, W> {
641 this.clear_irqs(); 641 this.clear_irqs();
642 642
643 #[cfg(dmamux)] 643 #[cfg(dmamux)]
644 super::dmamux::configure_dmamux(&mut *this.channel, _request); 644 super::dmamux::configure_dmamux(&*this.channel, _request);
645 645
646 let ch = dma.ch(channel_number); 646 let ch = dma.ch(channel_number);
647 ch.par().write_value(peri_addr as u32); 647 ch.par().write_value(peri_addr as u32);
diff --git a/embassy-stm32/src/dma/dma.rs b/embassy-stm32/src/dma/dma.rs
index ef9bb3d78..e762b1bde 100644
--- a/embassy-stm32/src/dma/dma.rs
+++ b/embassy-stm32/src/dma/dma.rs
@@ -366,7 +366,7 @@ impl<'a, C: Channel> Transfer<'a, C> {
366 this.clear_irqs(); 366 this.clear_irqs();
367 367
368 #[cfg(dmamux)] 368 #[cfg(dmamux)]
369 super::dmamux::configure_dmamux(&mut *this.channel, _request); 369 super::dmamux::configure_dmamux(&*this.channel, _request);
370 370
371 ch.par().write_value(peri_addr as u32); 371 ch.par().write_value(peri_addr as u32);
372 ch.m0ar().write_value(mem_addr as u32); 372 ch.m0ar().write_value(mem_addr as u32);
@@ -522,7 +522,7 @@ impl<'a, C: Channel, W: Word> DoubleBuffered<'a, C, W> {
522 this.clear_irqs(); 522 this.clear_irqs();
523 523
524 #[cfg(dmamux)] 524 #[cfg(dmamux)]
525 super::dmamux::configure_dmamux(&mut *this.channel, _request); 525 super::dmamux::configure_dmamux(&*this.channel, _request);
526 526
527 let ch = dma.st(channel_number); 527 let ch = dma.st(channel_number);
528 ch.par().write_value(peri_addr as u32); 528 ch.par().write_value(peri_addr as u32);
@@ -726,7 +726,7 @@ impl<'a, C: Channel, W: Word> ReadableRingBuffer<'a, C, W> {
726 this.clear_irqs(); 726 this.clear_irqs();
727 727
728 #[cfg(dmamux)] 728 #[cfg(dmamux)]
729 super::dmamux::configure_dmamux(&mut *this.channel, _request); 729 super::dmamux::configure_dmamux(&*this.channel, _request);
730 730
731 let ch = dma.st(channel_number); 731 let ch = dma.st(channel_number);
732 ch.par().write_value(peri_addr as u32); 732 ch.par().write_value(peri_addr as u32);
@@ -901,7 +901,7 @@ impl<'a, C: Channel, W: Word> WritableRingBuffer<'a, C, W> {
901 this.clear_irqs(); 901 this.clear_irqs();
902 902
903 #[cfg(dmamux)] 903 #[cfg(dmamux)]
904 super::dmamux::configure_dmamux(&mut *this.channel, _request); 904 super::dmamux::configure_dmamux(&*this.channel, _request);
905 905
906 let ch = dma.st(channel_number); 906 let ch = dma.st(channel_number);
907 ch.par().write_value(peri_addr as u32); 907 ch.par().write_value(peri_addr as u32);
diff --git a/embassy-stm32/src/dma/dmamux.rs b/embassy-stm32/src/dma/dmamux.rs
index 9cd494724..ac6f44107 100644
--- a/embassy-stm32/src/dma/dmamux.rs
+++ b/embassy-stm32/src/dma/dmamux.rs
@@ -2,7 +2,7 @@
2 2
3use crate::{pac, peripherals}; 3use crate::{pac, peripherals};
4 4
5pub(crate) fn configure_dmamux<M: MuxChannel>(channel: &mut M, request: u8) { 5pub(crate) fn configure_dmamux<M: MuxChannel>(channel: &M, request: u8) {
6 let ch_mux_regs = channel.mux_regs().ccr(channel.mux_num()); 6 let ch_mux_regs = channel.mux_regs().ccr(channel.mux_num());
7 ch_mux_regs.write(|reg| { 7 ch_mux_regs.write(|reg| {
8 reg.set_nbreq(0); 8 reg.set_nbreq(0);
diff --git a/embassy-stm32/src/dma/gpdma.rs b/embassy-stm32/src/dma/gpdma.rs
index 34b2426b9..337e7b309 100644
--- a/embassy-stm32/src/dma/gpdma.rs
+++ b/embassy-stm32/src/dma/gpdma.rs
@@ -259,7 +259,7 @@ impl<'a, C: Channel> Transfer<'a, C> {
259 let this = Self { channel }; 259 let this = Self { channel };
260 260
261 #[cfg(dmamux)] 261 #[cfg(dmamux)]
262 super::dmamux::configure_dmamux(&mut *this.channel, request); 262 super::dmamux::configure_dmamux(&*this.channel, request);
263 263
264 ch.cr().write(|w| w.set_reset(true)); 264 ch.cr().write(|w| w.set_reset(true));
265 ch.fcr().write(|w| w.0 = 0xFFFF_FFFF); // clear all irqs 265 ch.fcr().write(|w| w.0 = 0xFFFF_FFFF); // clear all irqs
diff --git a/embassy-stm32/src/timer/mod.rs b/embassy-stm32/src/timer/mod.rs
index 9480d6972..9397da2a1 100644
--- a/embassy-stm32/src/timer/mod.rs
+++ b/embassy-stm32/src/timer/mod.rs
@@ -65,17 +65,17 @@ pub(crate) mod sealed {
65 fn regs_core() -> crate::pac::timer::TimCore; 65 fn regs_core() -> crate::pac::timer::TimCore;
66 66
67 /// Start the timer. 67 /// Start the timer.
68 fn start(&mut self) { 68 fn start(&self) {
69 Self::regs_core().cr1().modify(|r| r.set_cen(true)); 69 Self::regs_core().cr1().modify(|r| r.set_cen(true));
70 } 70 }
71 71
72 /// Stop the timer. 72 /// Stop the timer.
73 fn stop(&mut self) { 73 fn stop(&self) {
74 Self::regs_core().cr1().modify(|r| r.set_cen(false)); 74 Self::regs_core().cr1().modify(|r| r.set_cen(false));
75 } 75 }
76 76
77 /// Reset the counter value to 0 77 /// Reset the counter value to 0
78 fn reset(&mut self) { 78 fn reset(&self) {
79 Self::regs_core().cnt().write(|r| r.set_cnt(0)); 79 Self::regs_core().cnt().write(|r| r.set_cnt(0));
80 } 80 }
81 81
@@ -85,7 +85,7 @@ pub(crate) mod sealed {
85 /// the timer counter will wrap around at the same frequency as is being set. 85 /// the timer counter will wrap around at the same frequency as is being set.
86 /// In center-aligned mode (which not all timers support), the wrap-around frequency is effectively halved 86 /// In center-aligned mode (which not all timers support), the wrap-around frequency is effectively halved
87 /// because it needs to count up and down. 87 /// because it needs to count up and down.
88 fn set_frequency(&mut self, frequency: Hertz) { 88 fn set_frequency(&self, frequency: Hertz) {
89 let f = frequency.0; 89 let f = frequency.0;
90 let timer_f = Self::frequency().0; 90 let timer_f = Self::frequency().0;
91 assert!(f > 0); 91 assert!(f > 0);
@@ -108,7 +108,7 @@ pub(crate) mod sealed {
108 /// Clear update interrupt. 108 /// Clear update interrupt.
109 /// 109 ///
110 /// Returns whether the update interrupt flag was set. 110 /// Returns whether the update interrupt flag was set.
111 fn clear_update_interrupt(&mut self) -> bool { 111 fn clear_update_interrupt(&self) -> bool {
112 let regs = Self::regs_core(); 112 let regs = Self::regs_core();
113 let sr = regs.sr().read(); 113 let sr = regs.sr().read();
114 if sr.uif() { 114 if sr.uif() {
@@ -122,12 +122,12 @@ pub(crate) mod sealed {
122 } 122 }
123 123
124 /// Enable/disable the update interrupt. 124 /// Enable/disable the update interrupt.
125 fn enable_update_interrupt(&mut self, enable: bool) { 125 fn enable_update_interrupt(&self, enable: bool) {
126 Self::regs_core().dier().modify(|r| r.set_uie(enable)); 126 Self::regs_core().dier().modify(|r| r.set_uie(enable));
127 } 127 }
128 128
129 /// Enable/disable autoreload preload. 129 /// Enable/disable autoreload preload.
130 fn set_autoreload_preload(&mut self, enable: bool) { 130 fn set_autoreload_preload(&self, enable: bool) {
131 Self::regs_core().cr1().modify(|r| r.set_arpe(enable)); 131 Self::regs_core().cr1().modify(|r| r.set_arpe(enable));
132 } 132 }
133 133
@@ -154,7 +154,7 @@ pub(crate) mod sealed {
154 fn regs_basic_no_cr2() -> crate::pac::timer::TimBasicNoCr2; 154 fn regs_basic_no_cr2() -> crate::pac::timer::TimBasicNoCr2;
155 155
156 /// Enable/disable the update dma. 156 /// Enable/disable the update dma.
157 fn enable_update_dma(&mut self, enable: bool) { 157 fn enable_update_dma(&self, enable: bool) {
158 Self::regs_basic_no_cr2().dier().modify(|r| r.set_ude(enable)); 158 Self::regs_basic_no_cr2().dier().modify(|r| r.set_ude(enable));
159 } 159 }
160 160
@@ -186,7 +186,7 @@ pub(crate) mod sealed {
186 fn regs_1ch() -> crate::pac::timer::Tim1ch; 186 fn regs_1ch() -> crate::pac::timer::Tim1ch;
187 187
188 /// Set clock divider. 188 /// Set clock divider.
189 fn set_clock_division(&mut self, ckd: vals::Ckd) { 189 fn set_clock_division(&self, ckd: vals::Ckd) {
190 Self::regs_1ch().cr1().modify(|r| r.set_ckd(ckd)); 190 Self::regs_1ch().cr1().modify(|r| r.set_ckd(ckd));
191 } 191 }
192 192
@@ -218,7 +218,7 @@ pub(crate) mod sealed {
218 fn regs_gp16() -> crate::pac::timer::TimGp16; 218 fn regs_gp16() -> crate::pac::timer::TimGp16;
219 219
220 /// Set counting mode. 220 /// Set counting mode.
221 fn set_counting_mode(&mut self, mode: CountingMode) { 221 fn set_counting_mode(&self, mode: CountingMode) {
222 let (cms, dir) = mode.into(); 222 let (cms, dir) = mode.into();
223 223
224 let timer_enabled = Self::regs_core().cr1().read().cen(); 224 let timer_enabled = Self::regs_core().cr1().read().cen();
@@ -237,7 +237,7 @@ pub(crate) mod sealed {
237 } 237 }
238 238
239 /// Set input capture filter. 239 /// Set input capture filter.
240 fn set_input_capture_filter(&mut self, channel: Channel, icf: vals::FilterValue) { 240 fn set_input_capture_filter(&self, channel: Channel, icf: vals::FilterValue) {
241 let raw_channel = channel.index(); 241 let raw_channel = channel.index();
242 Self::regs_gp16() 242 Self::regs_gp16()
243 .ccmr_input(raw_channel / 2) 243 .ccmr_input(raw_channel / 2)
@@ -245,17 +245,17 @@ pub(crate) mod sealed {
245 } 245 }
246 246
247 /// Clear input interrupt. 247 /// Clear input interrupt.
248 fn clear_input_interrupt(&mut self, channel: Channel) { 248 fn clear_input_interrupt(&self, channel: Channel) {
249 Self::regs_gp16().sr().modify(|r| r.set_ccif(channel.index(), false)); 249 Self::regs_gp16().sr().modify(|r| r.set_ccif(channel.index(), false));
250 } 250 }
251 251
252 /// Enable input interrupt. 252 /// Enable input interrupt.
253 fn enable_input_interrupt(&mut self, channel: Channel, enable: bool) { 253 fn enable_input_interrupt(&self, channel: Channel, enable: bool) {
254 Self::regs_gp16().dier().modify(|r| r.set_ccie(channel.index(), enable)); 254 Self::regs_gp16().dier().modify(|r| r.set_ccie(channel.index(), enable));
255 } 255 }
256 256
257 /// Set input capture prescaler. 257 /// Set input capture prescaler.
258 fn set_input_capture_prescaler(&mut self, channel: Channel, factor: u8) { 258 fn set_input_capture_prescaler(&self, channel: Channel, factor: u8) {
259 let raw_channel = channel.index(); 259 let raw_channel = channel.index();
260 Self::regs_gp16() 260 Self::regs_gp16()
261 .ccmr_input(raw_channel / 2) 261 .ccmr_input(raw_channel / 2)
@@ -263,7 +263,7 @@ pub(crate) mod sealed {
263 } 263 }
264 264
265 /// Set input TI selection. 265 /// Set input TI selection.
266 fn set_input_ti_selection(&mut self, channel: Channel, tisel: InputTISelection) { 266 fn set_input_ti_selection(&self, channel: Channel, tisel: InputTISelection) {
267 let raw_channel = channel.index(); 267 let raw_channel = channel.index();
268 Self::regs_gp16() 268 Self::regs_gp16()
269 .ccmr_input(raw_channel / 2) 269 .ccmr_input(raw_channel / 2)
@@ -271,7 +271,7 @@ pub(crate) mod sealed {
271 } 271 }
272 272
273 /// Set input capture mode. 273 /// Set input capture mode.
274 fn set_input_capture_mode(&mut self, channel: Channel, mode: InputCaptureMode) { 274 fn set_input_capture_mode(&self, channel: Channel, mode: InputCaptureMode) {
275 Self::regs_gp16().ccer().modify(|r| match mode { 275 Self::regs_gp16().ccer().modify(|r| match mode {
276 InputCaptureMode::Rising => { 276 InputCaptureMode::Rising => {
277 r.set_ccnp(channel.index(), false); 277 r.set_ccnp(channel.index(), false);
@@ -289,7 +289,7 @@ pub(crate) mod sealed {
289 } 289 }
290 290
291 /// Set output compare mode. 291 /// Set output compare mode.
292 fn set_output_compare_mode(&mut self, channel: Channel, mode: OutputCompareMode) { 292 fn set_output_compare_mode(&self, channel: Channel, mode: OutputCompareMode) {
293 let raw_channel: usize = channel.index(); 293 let raw_channel: usize = channel.index();
294 Self::regs_gp16() 294 Self::regs_gp16()
295 .ccmr_output(raw_channel / 2) 295 .ccmr_output(raw_channel / 2)
@@ -297,14 +297,14 @@ pub(crate) mod sealed {
297 } 297 }
298 298
299 /// Set output polarity. 299 /// Set output polarity.
300 fn set_output_polarity(&mut self, channel: Channel, polarity: OutputPolarity) { 300 fn set_output_polarity(&self, channel: Channel, polarity: OutputPolarity) {
301 Self::regs_gp16() 301 Self::regs_gp16()
302 .ccer() 302 .ccer()
303 .modify(|w| w.set_ccp(channel.index(), polarity.into())); 303 .modify(|w| w.set_ccp(channel.index(), polarity.into()));
304 } 304 }
305 305
306 /// Enable/disable a channel. 306 /// Enable/disable a channel.
307 fn enable_channel(&mut self, channel: Channel, enable: bool) { 307 fn enable_channel(&self, channel: Channel, enable: bool) {
308 Self::regs_gp16().ccer().modify(|w| w.set_cce(channel.index(), enable)); 308 Self::regs_gp16().ccer().modify(|w| w.set_cce(channel.index(), enable));
309 } 309 }
310 310
@@ -314,12 +314,12 @@ pub(crate) mod sealed {
314 } 314 }
315 315
316 /// Set compare value for a channel. 316 /// Set compare value for a channel.
317 fn set_compare_value(&mut self, channel: Channel, value: u16) { 317 fn set_compare_value(&self, channel: Channel, value: u16) {
318 Self::regs_gp16().ccr(channel.index()).modify(|w| w.set_ccr(value)); 318 Self::regs_gp16().ccr(channel.index()).modify(|w| w.set_ccr(value));
319 } 319 }
320 320
321 /// Get capture value for a channel. 321 /// Get capture value for a channel.
322 fn get_capture_value(&mut self, channel: Channel) -> u16 { 322 fn get_capture_value(&self, channel: Channel) -> u16 {
323 Self::regs_gp16().ccr(channel.index()).read().ccr() 323 Self::regs_gp16().ccr(channel.index()).read().ccr()
324 } 324 }
325 325
@@ -329,7 +329,7 @@ pub(crate) mod sealed {
329 } 329 }
330 330
331 /// Set output compare preload. 331 /// Set output compare preload.
332 fn set_output_compare_preload(&mut self, channel: Channel, preload: bool) { 332 fn set_output_compare_preload(&self, channel: Channel, preload: bool) {
333 let channel_index = channel.index(); 333 let channel_index = channel.index();
334 Self::regs_gp16() 334 Self::regs_gp16()
335 .ccmr_output(channel_index / 2) 335 .ccmr_output(channel_index / 2)
@@ -342,7 +342,7 @@ pub(crate) mod sealed {
342 } 342 }
343 343
344 /// Set capture compare DMA selection 344 /// Set capture compare DMA selection
345 fn set_cc_dma_selection(&mut self, ccds: super::vals::Ccds) { 345 fn set_cc_dma_selection(&self, ccds: super::vals::Ccds) {
346 Self::regs_gp16().cr2().modify(|w| w.set_ccds(ccds)) 346 Self::regs_gp16().cr2().modify(|w| w.set_ccds(ccds))
347 } 347 }
348 348
@@ -352,7 +352,7 @@ pub(crate) mod sealed {
352 } 352 }
353 353
354 /// Set capture compare DMA enable state 354 /// Set capture compare DMA enable state
355 fn set_cc_dma_enable_state(&mut self, channel: Channel, ccde: bool) { 355 fn set_cc_dma_enable_state(&self, channel: Channel, ccde: bool) {
356 Self::regs_gp16().dier().modify(|w| w.set_ccde(channel.index(), ccde)) 356 Self::regs_gp16().dier().modify(|w| w.set_ccde(channel.index(), ccde))
357 } 357 }
358 } 358 }
@@ -369,7 +369,7 @@ pub(crate) mod sealed {
369 fn regs_gp32() -> crate::pac::timer::TimGp32; 369 fn regs_gp32() -> crate::pac::timer::TimGp32;
370 370
371 /// Set timer frequency. 371 /// Set timer frequency.
372 fn set_frequency(&mut self, frequency: Hertz) { 372 fn set_frequency(&self, frequency: Hertz) {
373 let f = frequency.0; 373 let f = frequency.0;
374 assert!(f > 0); 374 assert!(f > 0);
375 let timer_f = Self::frequency().0; 375 let timer_f = Self::frequency().0;
@@ -398,12 +398,12 @@ pub(crate) mod sealed {
398 } 398 }
399 399
400 /// Set comapre value for a channel. 400 /// Set comapre value for a channel.
401 fn set_compare_value(&mut self, channel: Channel, value: u32) { 401 fn set_compare_value(&self, channel: Channel, value: u32) {
402 Self::regs_gp32().ccr(channel.index()).modify(|w| w.set_ccr(value)); 402 Self::regs_gp32().ccr(channel.index()).modify(|w| w.set_ccr(value));
403 } 403 }
404 404
405 /// Get capture value for a channel. 405 /// Get capture value for a channel.
406 fn get_capture_value(&mut self, channel: Channel) -> u32 { 406 fn get_capture_value(&self, channel: Channel) -> u32 {
407 Self::regs_gp32().ccr(channel.index()).read().ccr() 407 Self::regs_gp32().ccr(channel.index()).read().ccr()
408 } 408 }
409 409
@@ -430,17 +430,17 @@ pub(crate) mod sealed {
430 fn regs_1ch_cmp() -> crate::pac::timer::Tim1chCmp; 430 fn regs_1ch_cmp() -> crate::pac::timer::Tim1chCmp;
431 431
432 /// Set clock divider for the dead time. 432 /// Set clock divider for the dead time.
433 fn set_dead_time_clock_division(&mut self, value: vals::Ckd) { 433 fn set_dead_time_clock_division(&self, value: vals::Ckd) {
434 Self::regs_1ch_cmp().cr1().modify(|w| w.set_ckd(value)); 434 Self::regs_1ch_cmp().cr1().modify(|w| w.set_ckd(value));
435 } 435 }
436 436
437 /// Set dead time, as a fraction of the max duty value. 437 /// Set dead time, as a fraction of the max duty value.
438 fn set_dead_time_value(&mut self, value: u8) { 438 fn set_dead_time_value(&self, value: u8) {
439 Self::regs_1ch_cmp().bdtr().modify(|w| w.set_dtg(value)); 439 Self::regs_1ch_cmp().bdtr().modify(|w| w.set_dtg(value));
440 } 440 }
441 441
442 /// Enable timer outputs. 442 /// Enable timer outputs.
443 fn enable_outputs(&mut self) { 443 fn enable_outputs(&self) {
444 Self::regs_1ch_cmp().bdtr().modify(|w| w.set_moe(true)); 444 Self::regs_1ch_cmp().bdtr().modify(|w| w.set_moe(true));
445 } 445 }
446 } 446 }
@@ -468,14 +468,14 @@ pub(crate) mod sealed {
468 fn regs_advanced() -> crate::pac::timer::TimAdv; 468 fn regs_advanced() -> crate::pac::timer::TimAdv;
469 469
470 /// Set complementary output polarity. 470 /// Set complementary output polarity.
471 fn set_complementary_output_polarity(&mut self, channel: Channel, polarity: OutputPolarity) { 471 fn set_complementary_output_polarity(&self, channel: Channel, polarity: OutputPolarity) {
472 Self::regs_advanced() 472 Self::regs_advanced()
473 .ccer() 473 .ccer()
474 .modify(|w| w.set_ccnp(channel.index(), polarity.into())); 474 .modify(|w| w.set_ccnp(channel.index(), polarity.into()));
475 } 475 }
476 476
477 /// Enable/disable a complementary channel. 477 /// Enable/disable a complementary channel.
478 fn enable_complementary_channel(&mut self, channel: Channel, enable: bool) { 478 fn enable_complementary_channel(&self, channel: Channel, enable: bool) {
479 Self::regs_advanced() 479 Self::regs_advanced()
480 .ccer() 480 .ccer()
481 .modify(|w| w.set_ccne(channel.index(), enable)); 481 .modify(|w| w.set_ccne(channel.index(), enable));