Skip to content

Conversation

ABOSTM
Copy link
Contributor

@ABOSTM ABOSTM commented Jan 30, 2020

Summary
HardwareTimer: Fix ARR and CCRx computation

  • protect setOverflow against underflow.
  • remove -1 for MICROSEC_COMPARE_FORMAT, HERTZ_COMPARE_FORMAT and TICK_COMPARE_FORMAT.
  • remove -1 in setCount() too
  • Manage special case where ARR = MAX_RELOAD and 100% expected.

Fixes #897

Copy link
Contributor

@matthijskooijman matthijskooijman left a comment

Choose a reason for hiding this comment

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

Left one inline suggestion for improvement, but otherwise looks good!

* protect setOverflow against underflow.
* remove -1 for MICROSEC_COMPARE_FORMAT, HERTZ_COMPARE_FORMAT and TICK_COMPARE_FORMAT.
* remove -1 in setCount() too
* Manage special case where ARR = MAX_RELOAD and 100% expected.

Fixes stm32duino#897
@ABOSTM ABOSTM force-pushed the HARDWARE_TIMER_ARR_CCRx_COMPUTATION branch from 0b38f85 to 29767ba Compare January 30, 2020 14:55
@fpistm fpistm added the fix 🩹 Bug fix label Jan 30, 2020
@fpistm fpistm added this to the 1.9.0 milestone Jan 30, 2020
@fpistm fpistm self-requested a review January 30, 2020 17:32
@fpistm fpistm merged commit 0878b66 into stm32duino:master Jan 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix 🩹 Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Off-by one error in HardwareTimer ticks values?

3 participants