@@ -12,7 +12,7 @@ pub struct Stopwatch<TIM> {
12
12
}
13
13
14
14
macro_rules! stopwatches {
15
- ( $( $TIM: ident: ( $tim: ident, $timXen: ident, $timXrst: ident, $apbenr: ident, $apbrstr: ident, $cnt : ident $ ( , $cnt_h : ident ) * ) , ) +) => {
15
+ ( $( $TIM: ident: ( $tim: ident, $timXen: ident, $timXrst: ident, $apbenr: ident, $apbrstr: ident ) , ) +) => {
16
16
$(
17
17
impl Stopwatch <$TIM> {
18
18
pub fn $tim( tim: $TIM, rcc: & mut Rcc ) -> Self {
@@ -65,12 +65,7 @@ macro_rules! stopwatches {
65
65
}
66
66
67
67
pub fn now( & self ) -> Instant {
68
- let _high = 0 ;
69
- $(
70
- let _high = self . tim. cnt. read( ) . $cnt_h( ) . bits( ) as u32 ;
71
- ) *
72
- let low = self . tim. cnt. read( ) . $cnt( ) . bits( ) as u32 ;
73
- Instant ( low | ( _high << 16 ) )
68
+ Instant ( self . tim. cnt. read( ) . bits( ) )
74
69
}
75
70
76
71
pub fn elapsed( & self , ts: Instant ) -> MicroSecond {
@@ -100,21 +95,21 @@ macro_rules! stopwatches {
100
95
}
101
96
102
97
stopwatches ! {
103
- TIM1 : ( tim1, tim1en, tim1rst, apbenr2, apbrstr2, cnt ) ,
104
- TIM3 : ( tim3, tim3en, tim3rst, apbenr1, apbrstr1, cnt_l , cnt_h ) ,
105
- TIM14 : ( tim14, tim14en, tim14rst, apbenr2, apbrstr2, cnt ) ,
106
- TIM16 : ( tim16, tim16en, tim16rst, apbenr2, apbrstr2, cnt ) ,
107
- TIM17 : ( tim17, tim17en, tim17rst, apbenr2, apbrstr2, cnt ) ,
98
+ TIM1 : ( tim1, tim1en, tim1rst, apbenr2, apbrstr2) ,
99
+ TIM3 : ( tim3, tim3en, tim3rst, apbenr1, apbrstr1) ,
100
+ TIM14 : ( tim14, tim14en, tim14rst, apbenr2, apbrstr2) ,
101
+ TIM16 : ( tim16, tim16en, tim16rst, apbenr2, apbrstr2) ,
102
+ TIM17 : ( tim17, tim17en, tim17rst, apbenr2, apbrstr2) ,
108
103
}
109
104
110
105
#[ cfg( feature = "stm32g0x1" ) ]
111
106
stopwatches ! {
112
- TIM2 : ( tim2, tim2en, tim2rst, apbenr1, apbrstr1, cnt_l , cnt_h ) ,
107
+ TIM2 : ( tim2, tim2en, tim2rst, apbenr1, apbrstr1) ,
113
108
}
114
109
115
110
#[ cfg( any( feature = "stm32g070" , feature = "stm32g071" , feature = "stm32g081" ) ) ]
116
111
stopwatches ! {
117
- TIM6 : ( tim6, tim6en, tim6rst, apbenr1, apbrstr1, cnt ) ,
118
- TIM7 : ( tim7, tim7en, tim7rst, apbenr1, apbrstr1, cnt ) ,
119
- TIM15 : ( tim15, tim15en, tim15rst, apbenr2, apbrstr2, cnt ) ,
112
+ TIM6 : ( tim6, tim6en, tim6rst, apbenr1, apbrstr1) ,
113
+ TIM7 : ( tim7, tim7en, tim7rst, apbenr1, apbrstr1) ,
114
+ TIM15 : ( tim15, tim15en, tim15rst, apbenr2, apbrstr2) ,
120
115
}
0 commit comments