File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ pub struct Stopwatch<TIM> {
12
12
}
13
13
14
14
macro_rules! stopwatches {
15
- ( $( $TIM: ident: $tim: ident, ) +) => {
15
+ ( $( $TIM: ident: $tim: ident, $depth : ident , ) +) => {
16
16
$(
17
17
impl Stopwatch <$TIM> {
18
18
pub fn $tim( tim: $TIM, rcc: & mut Rcc ) -> Self {
@@ -66,7 +66,7 @@ macro_rules! stopwatches {
66
66
67
67
pub fn elapsed( & self , ts: Instant ) -> MicroSecond {
68
68
let now = self . now( ) . ticks( ) ;
69
- let cycles = ( now as u16 ) . wrapping_sub( ts. ticks( ) as u16 ) as u32 ;
69
+ let cycles = ( now as $depth ) . wrapping_sub( ts. ticks( ) as $depth ) as u32 ;
70
70
duration( self . clk, cycles * ( 1 + self . tim. psc. read( ) . bits( ) ) )
71
71
}
72
72
@@ -91,21 +91,21 @@ macro_rules! stopwatches {
91
91
}
92
92
93
93
stopwatches ! {
94
- TIM1 : tim1,
95
- TIM3 : tim3,
96
- TIM14 : tim14,
97
- TIM16 : tim16,
98
- TIM17 : tim17,
94
+ TIM1 : tim1, u16 ,
95
+ TIM3 : tim3, u16 ,
96
+ TIM14 : tim14, u16 ,
97
+ TIM16 : tim16, u16 ,
98
+ TIM17 : tim17, u16 ,
99
99
}
100
100
101
101
#[ cfg( feature = "stm32g0x1" ) ]
102
102
stopwatches ! {
103
- TIM2 : tim2,
103
+ TIM2 : tim2, u32 ,
104
104
}
105
105
106
106
#[ cfg( any( feature = "stm32g070" , feature = "stm32g071" , feature = "stm32g081" ) ) ]
107
107
stopwatches ! {
108
- TIM6 : tim6,
109
- TIM7 : tim7,
110
- TIM15 : tim15,
108
+ TIM6 : tim6, u16 ,
109
+ TIM7 : tim7, u16 ,
110
+ TIM15 : tim15, u16 ,
111
111
}
You can’t perform that action at this time.
0 commit comments