timer_group: correct timer_ll_set_divider

This commit is contained in:
morris
2021-02-01 14:17:10 +08:00
parent be30289364
commit 5a520cacf1
10 changed files with 41 additions and 74 deletions

View File

@@ -43,11 +43,9 @@ _Static_assert(TIMER_INTR_WDT == TIMG_WDT_INT_CLR, "Add mapping to LL interrupt
*/
static inline void timer_ll_set_divider(timg_dev_t *hw, timer_idx_t timer_num, uint32_t divider)
{
// refer to TRM 18.2.1
if (divider == 65536) {
assert(divider >= 2 && divider <= 65536);
if (divider >= 65536) {
divider = 0;
} else if (divider == 1) {
divider = 2;
}
int timer_en = hw->hw_timer[timer_num].config.enable;
hw->hw_timer[timer_num].config.enable = 0;