stm32-rs / stm32l0xx-hal

A hardware abstraction layer (HAL) for the STM32L0 series microcontrollers written in Rust
BSD Zero Clause License
96 stars 60 forks source link

Skip /32 AHB prescaler #228

Closed knoellle closed 1 year ago

knoellle commented 1 year ago

Fixes #225

There is no /32 AHB prescaler, but the old calculation code assumed there was, causing all calculated clock frequencies with an AHB prescaler > 16 to be off by a factor of 2.

Note that this only affects the frequencies stored in the Clocks struct, not the ones actually applied to the AHB frequency. Page 194 of the reference manual shows mapping of register bits to prescaler factors. As far as I can see, those are implemented correctly.

jamwaffles commented 1 year ago

This is good to go aside from:

on top of that could you also please add a changelog entry under the Fixed section?

If you missed it :)

knoellle commented 1 year ago

Added a changelog entry. However, at least on the preview in my fork, the PR link doesn't seem to work. Is that because this PR was created after the fork? All the other links seem to correctly reference PRs in the upstream repository. Will that fix itself once the change is merged?

Also, in the (now obsolete) workflow run, the clippy check failed. Do you want me to fix that in this PR even though it's not a related change?

jamwaffles commented 1 year ago

You need to add a line at the bottom of the file like this, then the link should work.

jamwaffles commented 1 year ago

Also, in the (now obsolete) workflow run, the clippy check failed. Do you want me to fix that in this PR even though it's not a related change?

Yeah that's fine, thanks for bringing it up :)

knoellle commented 1 year ago

I'm confused... why did the clippy check succeed this time? 👀 Rustup reportedly installed the same versions in both runs.

Edit: Ah, apparently this was already fixed here and I hadn't rebased yet.

knoellle commented 1 year ago

Fixed the changelog link, feel free to merge when you're happy.

jamwaffles commented 1 year ago

Thanks!