@@ -211,13 +211,7 @@ macro_rules! hal {
211
211
212
212
// Define the direction of the channel (input/output)
213
213
// and the used input
214
- // 01: CC1 channel is configured as input, IC1 is mapped on TI1.
215
- // 10: CC1 channel is configured as input, IC1 is mapped on TI2.
216
- tim. ccmr1_output. modify( |_, w| unsafe { w. cc1s( ) . bits( 0b01 ) } ) ;
217
-
218
- // 01: CC2 channel is configured as input, IC2 is mapped on TI2
219
- // 10: CC2 channel is configured as input, IC2 is mapped on TI1
220
- tim. ccmr1_output. modify( |_, w| unsafe { w. cc2s( ) . bits( 0b10 ) } ) ;
214
+ tim. ccmr1_input( ) . modify( |_, w| w. cc1s( ) . ti1( ) . cc2s( ) . ti1( ) ) ;
221
215
222
216
tim. dier. write( |w| w. cc1ie( ) . set_bit( ) ) ;
223
217
@@ -236,25 +230,25 @@ macro_rules! hal {
236
230
let max_freq = if freq > 5 { freq/5 } else { 1 } ;
237
231
let ( arr, presc) = compute_arr_presc( max_freq, $TIMX:: get_clk( & clocks) . 0 ) ;
238
232
tim. arr. write( |w| w. arr( ) . bits( arr) ) ;
239
- tim. psc. write( |w| unsafe { w. psc( ) . bits( presc) } ) ;
233
+ tim. psc. write( |w| w. psc( ) . bits( presc) ) ;
240
234
241
235
} ,
242
236
DutyCycle ( f) => {
243
237
let freq = f. into( ) . 0 ;
244
238
let max_freq = if freq > 2 { freq/2 + freq/4 + freq/8 } else { 1 } ;
245
239
let ( arr, presc) = compute_arr_presc( max_freq, $TIMX:: get_clk( & clocks) . 0 ) ;
246
240
tim. arr. write( |w| w. arr( ) . bits( arr) ) ;
247
- tim. psc. write( |w| unsafe { w. psc( ) . bits( presc) } ) ;
241
+ tim. psc. write( |w| w. psc( ) . bits( presc) ) ;
248
242
} ,
249
243
RawFrequency ( f) => {
250
244
let freq = f. into( ) . 0 ;
251
245
let ( arr, presc) = compute_arr_presc( freq, $TIMX:: get_clk( & clocks) . 0 ) ;
252
246
tim. arr. write( |w| w. arr( ) . bits( arr) ) ;
253
- tim. psc. write( |w| unsafe { w. psc( ) . bits( presc) } ) ;
247
+ tim. psc. write( |w| w. psc( ) . bits( presc) ) ;
254
248
}
255
249
RawValues { arr, presc} => {
256
250
tim. arr. write( |w| w. arr( ) . bits( arr) ) ;
257
- tim. psc. write( |w| unsafe { w. psc( ) . bits( presc) } ) ;
251
+ tim. psc. write( |w| w. psc( ) . bits( presc) ) ;
258
252
259
253
}
260
254
}
0 commit comments