File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -685,16 +685,22 @@ macro_rules! hal {
685
685
if c < Self :: CH_NUMBER {
686
686
match p {
687
687
CapturePolarity :: ActiveLow => {
688
- unsafe { bb:: write( tim. ccer( ) , c* 4 + 3 , false ) ; }
689
- unsafe { bb:: write( tim. ccer( ) , c* 4 + 1 , true ) ; }
688
+ tim. ccer( ) . modify( |_, w| {
689
+ w. ccnp( c) . clear_bit( ) ;
690
+ w. ccp( c) . set_bit( )
691
+ } ) ;
690
692
}
691
693
CapturePolarity :: ActiveHigh => {
692
- unsafe { bb:: write( tim. ccer( ) , c* 4 + 3 , false ) ; }
693
- unsafe { bb:: write( tim. ccer( ) , c* 4 + 1 , false ) ; }
694
+ tim. ccer( ) . modify( |_, w| {
695
+ w. ccnp( c) . clear_bit( ) ;
696
+ w. ccp( c) . clear_bit( )
697
+ } ) ;
694
698
}
695
699
CapturePolarity :: ActiveBoth => {
696
- unsafe { bb:: write( tim. ccer( ) , c* 4 + 3 , true ) ; }
697
- unsafe { bb:: write( tim. ccer( ) , c* 4 + 1 , true ) ; }
700
+ tim. ccer( ) . modify( |_, w| {
701
+ w. ccnp( c) . set_bit( ) ;
702
+ w. ccp( c) . set_bit( )
703
+ } ) ;
698
704
}
699
705
}
700
706
You can’t perform that action at this time.
0 commit comments