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 {
685685 if c < Self :: CH_NUMBER {
686686 match p {
687687 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+ } ) ;
690692 }
691693 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+ } ) ;
694698 }
695699 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+ } ) ;
698704 }
699705 }
700706
You can’t perform that action at this time.
0 commit comments