@@ -188,10 +188,10 @@ pub(super) mod private {
188188}
189189
190190macro_rules! timers {
191- ( $( $TIM: ident: ( $tim: ident, $cnt: ident $( , $cnt_h: ident) * ) , ) +) => {
191+ ( $( $TIM: ident: $width : ty , ( $tim: ident, $cnt: ident $( , $cnt_h: ident) * ) , ) +) => {
192192 $(
193193 impl private:: TimerCommon for $TIM {
194- type Width = u16 ; // TODO: Are there any with 32 bits?
194+ type Width = $width ;
195195
196196 fn init( & mut self , rcc: & mut Rcc ) {
197197 $TIM:: enable( rcc) ;
@@ -273,7 +273,7 @@ macro_rules! timers {
273273 fn set_freq_settings( & mut self , freq_settings: TimerFrequencySettings ) {
274274 unsafe {
275275 self . psc( ) . write( |w| w. psc( ) . bits( freq_settings. psc as u16 ) ) ;
276- self . arr( ) . write( |w| w. arr( ) . bits( ( freq_settings. arr as u16 ) . into ( ) ) ) ;
276+ self . arr( ) . write( |w| w. arr( ) . bits( freq_settings. arr as $width ) ) ;
277277 }
278278 }
279279
@@ -443,21 +443,21 @@ timers_external_clocks! {
443443}
444444
445445timers ! {
446- TIM1 : ( tim1, cnt) ,
447- TIM3 : ( tim3, cnt) ,
448- TIM14 : ( tim14, cnt) ,
449- TIM16 : ( tim16, cnt) ,
450- TIM17 : ( tim17, cnt) ,
446+ TIM1 : u16 , ( tim1, cnt) ,
447+ TIM3 : u16 , ( tim3, cnt) ,
448+ TIM14 : u16 , ( tim14, cnt) ,
449+ TIM16 : u16 , ( tim16, cnt) ,
450+ TIM17 : u16 , ( tim17, cnt) ,
451451}
452452
453453#[ cfg( feature = "stm32g0x1" ) ]
454454timers ! {
455- TIM2 : ( tim2, cnt) ,
455+ TIM2 : u32 , ( tim2, cnt) ,
456456}
457457
458458#[ cfg( any( feature = "stm32g070" , feature = "stm32g071" , feature = "stm32g081" ) ) ]
459459timers ! {
460- TIM6 : ( tim6, cnt) ,
461- TIM7 : ( tim7, cnt) ,
462- TIM15 : ( tim15, cnt) ,
460+ TIM6 : u16 , ( tim6, cnt) ,
461+ TIM7 : u16 , ( tim7, cnt) ,
462+ TIM15 : u16 , ( tim15, cnt) ,
463463}
0 commit comments