File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ use rtic_monotonic::Monotonic;
1717///
1818/// Note that the SysTick interrupt must not be disabled longer than half the
1919/// cycle counter overflow period (typically a couple seconds).
20+ ///
21+ /// When the `extend` feature is enabled, the cycle counter width is extended to
22+ /// `u64` by detecting and counting overflows.
2023pub struct DwtSystick < const TIMER_HZ : u32 > {
2124 dwt : DWT ,
2225 systick : SYST ,
@@ -76,7 +79,7 @@ impl<const TIMER_HZ: u32> Monotonic for DwtSystick<TIMER_HZ> {
7679 let now = self . dwt. cyccnt. read( ) ;
7780
7881 // Detect CYCCNT overflow
79- if now. wrapping_sub ( low ) >= 1 << 31 {
82+ if now < low {
8083 high = high. wrapping_add( 1 ) ;
8184 }
8285 self . last = ( ( high as u64 ) << 32 ) | ( now as u64 ) ;
You can’t perform that action at this time.
0 commit comments