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

STM: off-by-one TIMx reference; other code cleanup and minor fixes #7212

Merged
merged 1 commit into from
Nov 15, 2022

Conversation

dhalbert
Copy link
Collaborator

Fixes #7040.

  • stm_peripherals_timer_get_source_freq() was off by one in its TIMx numbering assumption, causing incorrect lookups of some timer frequencies.
  • In PulseIn.c, timer clock reset was being done with an integer instead of a bitmask. Noticed this while looking for other manifestations of the previous bug.
  • Added some logic to stm_peripherals_timer_get_source_freq() to handle other variants of STM chips. Not tested, but would have been wrong otherwise.
  • Reworked timer assignment code in PWMOut a bit for clarity and to make any returned errors more accurate.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt tannewt merged commit b8a2d3f into adafruit:main Nov 15, 2022
Copy link
Member

@jepler jepler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one note, maybe an added comment would be helpful.

Not sure what's going on with github, I don't have the usual approve/request changes/just comment buttons to select the 'result' of my review.

ports/stm/common-hal/pwmio/PWMOut.c Show resolved Hide resolved
@jepler
Copy link
Member

jepler commented Nov 15, 2022

oh, because the PR had already been merged, that's why.

@dhalbert dhalbert deleted the stm-pwm-fix branch November 15, 2022 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some PWMOut pins on STM32F405 run at half frequency
3 participants