Skip to content

Commit

Permalink
Merge #518
Browse files Browse the repository at this point in the history
518: fix PwmHz::get_period r=therealprof a=burrbull

See stm32-rs/stm32f1xx-hal#434

Co-authored-by: Andrey Zgarbul <[email protected]>
  • Loading branch information
bors[bot] and burrbull authored Aug 26, 2022
2 parents 568d37f + a85eb5a commit d0c0aa3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- `PwmHz::get_period`: fix computation of return value, prevent division by zero
- apply #[inline] attribute to bitbanding functions [#517]
- update `stm32f4` to 0.15.1 [#481]
- use `stm32_i2s_v12x` version 0.3, reexport it, and implements requirement for it [#490]
Expand Down
2 changes: 1 addition & 1 deletion src/timer/pwm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ where
let arr = TIM::read_auto_reload();

// Length in ms of an internal clock pulse
clk / (psc * arr)
clk / ((psc + 1) * (arr + 1))
}

pub fn set_period(&mut self, period: Hertz) {
Expand Down

0 comments on commit d0c0aa3

Please sign in to comment.