File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
38
38
### Fixed
39
39
40
40
- Fix wrong timer frequency calculation and unexpected panics ([ #338 ] )
41
+ - Fixed integer saturation in Timer::start, see #342 ([ #356 ] )
41
42
42
43
### Changed
43
44
@@ -614,6 +615,7 @@ let clocks = rcc
614
615
[ defmt ] : https://github.com/knurling-rs/defmt
615
616
[ filter ] : https://defmt.ferrous-systems.com/filtering.html
616
617
618
+ [ #356 ] : https://github.com/stm32-rs/stm32f3xx-hal/pull/356
617
619
[ #352 ] : https://github.com/stm32-rs/stm32f3xx-hal/pull/352
618
620
[ #351 ] : https://github.com/stm32-rs/stm32f3xx-hal/pull/351
619
621
[ #350 ] : https://github.com/stm32-rs/stm32f3xx-hal/pull/350
Original file line number Diff line number Diff line change @@ -281,9 +281,10 @@ where
281
281
let timeout: Self :: Time = timeout. into ( ) ;
282
282
let clock = TIM :: clock ( & self . clocks ) ;
283
283
284
- let ticks = clock. integer ( ) . saturating_mul ( timeout. integer ( ) ) * * timeout. scaling_factor ( ) ;
284
+ let ticks = u64:: from ( clock. integer ( ) ) . saturating_mul ( u64:: from ( timeout. integer ( ) ) )
285
+ * * timeout. scaling_factor ( ) ;
285
286
286
- let psc: u32 = ( ticks. saturating_sub ( 1 ) ) / ( 1 << 16 ) ;
287
+ let psc = ticks. saturating_sub ( 1 ) / ( 1 << 16 ) ;
287
288
self . tim . set_psc ( crate :: unwrap!( u16 :: try_from( psc) . ok( ) ) ) ;
288
289
289
290
let mut arr = ticks / psc. saturating_add ( 1 ) ;
You can’t perform that action at this time.
0 commit comments