File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ fn main() -> ! {
31
31
#[ cfg( feature = "stm32g0x0" ) ]
32
32
let mut stopwatch = dp. TIM3 . stopwatch ( & mut rcc) ;
33
33
34
- stopwatch. set_prescaler ( 1 ) ;
34
+ stopwatch. set_prescaler ( 0 ) ;
35
35
36
36
let elapsed_us = stopwatch. trace ( || {
37
37
delay. delay ( 100 . us ( ) ) ;
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ macro_rules! stopwatches {
71
71
pub fn elapsed( & self , ts: Instant ) -> MicroSecond {
72
72
let now = self . now( ) . 0 ;
73
73
let cycles = now. wrapping_sub( ts. 0 ) ;
74
- self . clk. duration( cycles << self . tim. psc. read( ) . bits( ) )
74
+ self . clk. duration( cycles * ( 1 + self . tim. psc. read( ) . bits( ) ) )
75
75
}
76
76
77
77
pub fn trace<F >( & self , mut closure: F ) -> MicroSecond
@@ -81,7 +81,7 @@ macro_rules! stopwatches {
81
81
let started = self . now( ) . 0 ;
82
82
closure( ) ;
83
83
let now = self . now( ) . 0 ;
84
- self . clk. duration( now. wrapping_sub( started) << self . tim. psc. read( ) . bits( ) )
84
+ self . clk. duration( now. wrapping_sub( started) * ( 1 + self . tim. psc. read( ) . bits( ) ) )
85
85
}
86
86
}
87
87
You can’t perform that action at this time.
0 commit comments