You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2019/09/10 02:44:08 UTC
[GitHub] [mynewt-core] kasjer commented on a change in pull request #1980:
stm32 hal_timer small fixes
kasjer commented on a change in pull request #1980: stm32 hal_timer small fixes
URL: https://github.com/apache/mynewt-core/pull/1980#discussion_r322531505
##########
File path: hw/mcu/stm/stm32_common/src/hal_timer.c
##########
@@ -94,9 +94,8 @@ stm32_tmr_cbs(struct stm32_hal_tmr *tmr)
}
ht = TAILQ_FIRST(&tmr->sht_timers);
if (ht) {
- tmr->sht_regs->CCR1 = ht->expiry;
+ tmr->sht_regs->CCR1 = ht->expiry & 0xFFFFU;
Review comment:
This is needed for timers that are 32 bits, because of what is in line 511
```init.Period = 0xffff;```
All timer regardless if they are 32 or 16 bits are limited by this line. Then for 32 bits counters writing CCR1 value from expiry without masking will result in values grater then 0xFFFF and compare will never find those values. So this is needed.
It would be nice to use 32 bits timers at their full scale, but then code would need to program 16 and 32 bit register differently.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services