@@ -246,6 +246,11 @@ impl<TIM: Instance + WithPwm, const C: u8, const COMP: bool> PwmChannel<TIM, C,
246
246
pub fn set_duty ( & mut self , duty : u16 ) {
247
247
TIM :: set_cc_value ( C , duty as u32 )
248
248
}
249
+
250
+ #[ inline]
251
+ pub fn set_complementary_polarity ( & mut self , p : Polarity ) {
252
+ TIM :: set_nchannel_polarity ( C , p) ;
253
+ }
249
254
}
250
255
251
256
impl < TIM : Instance + WithPwm + Advanced , const C : u8 > PwmChannel < TIM , C , true > {
@@ -258,11 +263,6 @@ impl<TIM: Instance + WithPwm + Advanced, const C: u8> PwmChannel<TIM, C, true> {
258
263
pub fn enable_complementary ( & mut self ) {
259
264
TIM :: enable_nchannel ( C , true ) ;
260
265
}
261
-
262
- #[ inline]
263
- pub fn set_complementary_polarity ( & mut self , p : Polarity ) {
264
- TIM :: set_nchannel_polarity ( C , p) ;
265
- }
266
266
}
267
267
268
268
pub struct PwmHz < TIM , P , PINS >
@@ -401,6 +401,10 @@ where
401
401
self . tim . set_auto_reload ( arr) . unwrap ( ) ;
402
402
self . tim . cnt_reset ( ) ;
403
403
}
404
+
405
+ pub fn set_complementary_polarity ( & mut self , channel : Channel , p : Polarity ) {
406
+ TIM :: set_channel_polarity ( PINS :: check_complementary_used ( channel) as u8 , p) ;
407
+ }
404
408
}
405
409
406
410
impl < TIM , P , PINS > PwmHz < TIM , P , PINS >
@@ -415,10 +419,6 @@ where
415
419
pub fn disable_complementary ( & mut self , channel : Channel ) {
416
420
TIM :: enable_nchannel ( PINS :: check_complementary_used ( channel) as u8 , false )
417
421
}
418
-
419
- pub fn set_complementary_polarity ( & mut self , channel : Channel , p : Polarity ) {
420
- TIM :: set_channel_polarity ( PINS :: check_complementary_used ( channel) as u8 , p) ;
421
- }
422
422
}
423
423
424
424
pub struct Pwm < TIM , P , PINS , const FREQ : u32 >
@@ -558,6 +558,10 @@ where
558
558
self . tim . set_auto_reload ( period. ticks ( ) - 1 ) . unwrap ( ) ;
559
559
self . tim . cnt_reset ( ) ;
560
560
}
561
+
562
+ pub fn set_complementary_polarity ( & mut self , channel : Channel , p : Polarity ) {
563
+ TIM :: set_channel_polarity ( PINS :: check_complementary_used ( channel) as u8 , p) ;
564
+ }
561
565
}
562
566
563
567
impl < TIM , P , PINS , const FREQ : u32 > Pwm < TIM , P , PINS , FREQ >
@@ -572,8 +576,4 @@ where
572
576
pub fn disable_complementary ( & mut self , channel : Channel ) {
573
577
TIM :: enable_nchannel ( PINS :: check_complementary_used ( channel) as u8 , false )
574
578
}
575
-
576
- pub fn set_complementary_polarity ( & mut self , channel : Channel , p : Polarity ) {
577
- TIM :: set_channel_polarity ( PINS :: check_complementary_used ( channel) as u8 , p) ;
578
- }
579
579
}
0 commit comments