From c0d752c3b9acb14beaa24202c90193299f92765b Mon Sep 17 00:00:00 2001 From: espressif Date: Fri, 21 Feb 2020 15:15:54 +0800 Subject: [PATCH] mcpwm: fix the issue of wrong period --- components/soc/src/esp32/include/hal/mcpwm_ll.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/soc/src/esp32/include/hal/mcpwm_ll.h b/components/soc/src/esp32/include/hal/mcpwm_ll.h index b99067518..ef4afa9cc 100644 --- a/components/soc/src/esp32/include/hal/mcpwm_ll.h +++ b/components/soc/src/esp32/include/hal/mcpwm_ll.h @@ -156,7 +156,7 @@ static inline void mcpwm_ll_timer_stop(mcpwm_dev_t *mcpwm, int timer) static inline void mcpwm_ll_timer_set_period(mcpwm_dev_t *mcpwm, int timer, uint32_t period) { - mcpwm->timer[timer].period.period = period; + mcpwm->timer[timer].period.period = period - 1; mcpwm->timer[timer].period.upmethod = 0; } @@ -169,7 +169,7 @@ static inline void mcpwm_ll_timer_set_period(mcpwm_dev_t *mcpwm, int timer, uint */ static inline uint32_t mcpwm_ll_timer_get_period(mcpwm_dev_t *mcpwm, int timer) { - return mcpwm->timer[timer].period.period; + return mcpwm->timer[timer].period.period + 1; } /********************* Sync *******************/