@@ -75,6 +75,9 @@ pins_impl!(
7575 ( P2 ) , ( PinC2 ) , ( C2 ) ;
7676 ( P3 ) , ( PinC3 ) , ( C3 ) ;
7777 ( P4 ) , ( PinC4 ) , ( C4 ) ;
78+ ( P1N ) , ( PinC1N ) , ( C1N ) ;
79+ ( P2N ) , ( PinC2N ) , ( C2N ) ;
80+ ( P3N ) , ( PinC3N ) , ( C3N ) ;
7881) ;
7982
8083impl < TIM , P1 : PinC1 < TIM > , P2 : PinC1 < TIM > > PinC1 < TIM > for ( P1 , P2 ) { }
@@ -803,7 +806,7 @@ macro_rules! pwm_1_channel_with_complementary_outputs {
803806 rcc. regs. $apbrstr. modify( |_, w| w. $timXrst( ) . set_bit( ) ) ;
804807 rcc. regs. $apbrstr. modify( |_, w| w. $timXrst( ) . clear_bit( ) ) ;
805808
806- if PINS :: C1 {
809+ if PINS :: C1 || PINS :: C1N {
807810 tim. ccmr1_output( ) . modify( |_, w| w. oc1pe( ) . set_bit( ) . oc1m( ) . bits( 6 ) ) ;
808811 }
809812
@@ -868,6 +871,35 @@ macro_rules! pwm_1_channel_with_complementary_outputs {
868871 unsafe { ( * $TIMX:: ptr( ) ) . ccr1. write( |w| w. ccr( ) . bits( duty. into( ) ) ) }
869872 }
870873 }
874+
875+ impl hal:: PwmPin for PwmChannels <$TIMX, C1N > {
876+ type Duty = u16 ;
877+
878+ //NOTE(unsafe) atomic write with no side effects
879+ fn disable( & mut self ) {
880+ unsafe { ( * ( $TIMX:: ptr( ) ) ) . ccer. modify( |_, w| w. cc1ne( ) . clear_bit( ) ) } ;
881+ }
882+
883+ //NOTE(unsafe) atomic write with no side effects
884+ fn enable( & mut self ) {
885+ unsafe { ( * ( $TIMX:: ptr( ) ) ) . ccer. modify( |_, w| w. cc1ne( ) . set_bit( ) ) } ;
886+ }
887+
888+ //NOTE(unsafe) atomic read with no side effects
889+ fn get_duty( & self ) -> u16 {
890+ unsafe { ( * $TIMX:: ptr( ) ) . ccr1. read( ) . ccr( ) . bits( ) as u16 }
891+ }
892+
893+ //NOTE(unsafe) atomic read with no side effects
894+ fn get_max_duty( & self ) -> u16 {
895+ unsafe { ( * $TIMX:: ptr( ) ) . arr. read( ) . arr( ) . bits( ) as u16 }
896+ }
897+
898+ //NOTE(unsafe) atomic write with no side effects
899+ fn set_duty( & mut self , duty: u16 ) {
900+ unsafe { ( * $TIMX:: ptr( ) ) . ccr1. write( |w| w. ccr( ) . bits( duty. into( ) ) ) }
901+ }
902+ }
871903 ) +
872904 } ;
873905}
0 commit comments