Skip to content
New issue

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

Skip /32 AHB prescaler #228

Merged
merged 3 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)),
jamwaffles marked this conversation as resolved.
Show resolved Hide resolved
pre => sys_clk / (1 << (pre as u8 - 7)),
};

Expand Down