From ea8b2c2f14ed463e4ceab8ee93ac336c09c6f66e Mon Sep 17 00:00:00 2001 From: dimi Date: Thu, 13 Jul 2023 13:50:54 +0200 Subject: [PATCH] reset timer interrupt in Counter::start --- CHANGELOG.md | 5 +++++ src/timer/counter.rs | 2 ++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 026e4732..fd4d8e50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). [#671]: https://github.com/stm32-rs/stm32f4xx-hal/pull/671 +### Fixed +- reset timer interrupt in `Counter::start` [#670] + +[#670]: https://github.com/stm32-rs/stm32f4xx-hal/pull/670 + ## [v0.17.0] - 2023-07-11 ### Changed diff --git a/src/timer/counter.rs b/src/timer/counter.rs index c41dbec3..6a63c344 100644 --- a/src/timer/counter.rs +++ b/src/timer/counter.rs @@ -34,6 +34,7 @@ impl CounterHz { self.tim.disable_counter(); // reset counter self.tim.reset_counter(); + self.tim.clear_interrupt_flag(Event::Update); let (psc, arr) = compute_arr_presc(timeout.raw(), self.clk.raw()); self.tim.set_prescaler(psc); @@ -109,6 +110,7 @@ impl Counter { self.tim.disable_counter(); // reset counter self.tim.reset_counter(); + self.tim.clear_interrupt_flag(Event::Update); self.tim.set_auto_reload(timeout.ticks() - 1)?;