Skip to content

Commit

Permalink
Skip /32 AHB prescaler (#228)
Browse files Browse the repository at this point in the history
* Skip /32 AHB prescaler

* Add changelog entry

* Fix PR link in changelog
  • Loading branch information
knoellle authored Apr 5, 2023
1 parent 0930a37 commit 8de7c8d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ forget to update the links at the bottom of the changelog as well.-->

### Fixes

- Correct calculation of AHB prescaler for factors > 16 ([#228])

### Documentation

## [v0.10.0] - 2022-08-15
Expand Down Expand Up @@ -188,6 +190,7 @@ _Not yet tracked in this changelog._
<!-- Links to pull requests and issues. -->

[#226]: https://github.com/stm32-rs/stm32l0xx-hal/pull/226
[#228]: https://github.com/stm32-rs/stm32l0xx-hal/pull/228
[#224]: https://github.com/stm32-rs/stm32l0xx-hal/pull/224
[#221]: https://github.com/stm32-rs/stm32l0xx-hal/pull/221
[#220]: https://github.com/stm32-rs/stm32l0xx-hal/pull/218
Expand Down
2 changes: 2 additions & 0 deletions src/rcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,8 @@ impl RccExt for RCC {

let ahb_freq = match cfgr.ahb_pre {
AHBPrescaler::NotDivided => sys_clk,
// skip /32
pre if pre as u8 & 0b0100 > 0 => sys_clk / (1 << (pre as u8 - 6)),
pre => sys_clk / (1 << (pre as u8 - 7)),
};

Expand Down

0 comments on commit 8de7c8d

Please sign in to comment.