We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following code snippets should be equivalent in result, but they are not:
let mut timer = Timer::new(cx.device.TIM2, clocks, &mut rcc.apb1); timer.enable_interrupt(Event::Update); timer.start(1.milliseconds());
let mut timer = Timer::new(cx.device.TIM2, clocks, &mut rcc.apb1); timer.enable_interrupt(Event::Update); timer.start(1000.microseconds());
This happens due to the integer saturation in following line:
stm32f3xx-hal/src/timer.rs
Line 280 in 8933e11
Yes, the simplest answer would be "don't do that!", but this also happens with legitimate examples like 100.microseconds().
100.microseconds()
Perhaps one of the following fixes can be applied:
ticks
let ticks = ((clock.integer() * *timeout.scaling_factor()) as u32).saturating_mul(timeout.integer());
The text was updated successfully, but these errors were encountered:
Extend ticks calculation in timer start from u32 to u64 (#356)
4e1a257
Supersedes #343 Fixes #342 Co-authored-by: Anton Patrushev <apatrushev@gmail.com>
Successfully merging a pull request may close this issue.
The following code snippets should be equivalent in result, but they are not:
This happens due to the integer saturation in following line:
stm32f3xx-hal/src/timer.rs
Line 280 in 8933e11
Yes, the simplest answer would be "don't do that!", but this also happens with legitimate examples like
100.microseconds()
.Perhaps one of the following fixes can be applied:
ticks
can be extended to u64 (more precise result)The text was updated successfully, but these errors were encountered: