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/).
3838### Fixed
3939
4040- Fix wrong timer frequency calculation and unexpected panics ([ #338 ] )
41+ - Fixed integer saturation in Timer::start, see #342 ([ #356 ] )
4142
4243### Changed
4344
@@ -614,6 +615,7 @@ let clocks = rcc
614615[ defmt ] : https://github.com/knurling-rs/defmt
615616[ filter ] : https://defmt.ferrous-systems.com/filtering.html
616617
618+ [ #356 ] : https://github.com/stm32-rs/stm32f3xx-hal/pull/356
617619[ #352 ] : https://github.com/stm32-rs/stm32f3xx-hal/pull/352
618620[ #351 ] : https://github.com/stm32-rs/stm32f3xx-hal/pull/351
619621[ #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
281281 let timeout: Self :: Time = timeout. into ( ) ;
282282 let clock = TIM :: clock ( & self . clocks ) ;
283283
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 ( ) ;
285286
286- let psc: u32 = ( ticks. saturating_sub ( 1 ) ) / ( 1 << 16 ) ;
287+ let psc = ticks. saturating_sub ( 1 ) / ( 1 << 16 ) ;
287288 self . tim . set_psc ( crate :: unwrap!( u16 :: try_from( psc) . ok( ) ) ) ;
288289
289290 let mut arr = ticks / psc. saturating_add ( 1 ) ;
You can’t perform that action at this time.
0 commit comments