Skip to content

Commit

Permalink
Merge pull request #670 from dimpolo/clear_counter_interrupt
Browse files Browse the repository at this point in the history
reset timer interrupt in Counter::start
  • Loading branch information
burrbull authored Jul 13, 2023
2 parents ffd55ce + ea8b2c2 commit ea1826f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/timer/counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ impl<TIM: Instance> CounterHz<TIM> {
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);
Expand Down Expand Up @@ -109,6 +110,7 @@ impl<TIM: Instance, const FREQ: u32> Counter<TIM, FREQ> {
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)?;

Expand Down

0 comments on commit ea1826f

Please sign in to comment.