mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-11 21:10:20 +00:00
Merge branch 'feature/mcpwm_timer_change_freq' into 'master'
feat(mcpwm): support update timer period dynamically Closes IDFGH-11145 See merge request espressif/esp-idf!26419
This commit is contained in:
@@ -249,13 +249,12 @@ static inline void mcpwm_ll_timer_set_clock_prescale(mcpwm_dev_t *mcpwm, int tim
|
||||
* @param peak Peak value
|
||||
* @param symmetric True to set symmetric peak value, False to set asymmetric peak value
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline void mcpwm_ll_timer_set_peak(mcpwm_dev_t *mcpwm, int timer_id, uint32_t peak, bool symmetric)
|
||||
{
|
||||
if (!symmetric) { // in asymmetric mode, period = [0,peak-1]
|
||||
HAL_ASSERT(peak > 0 && peak <= MCPWM_LL_MAX_COUNT_VALUE);
|
||||
HAL_FORCE_MODIFY_U32_REG_FIELD(mcpwm->timer[timer_id].timer_cfg0, timer_period, peak - 1);
|
||||
} else { // in symmetric mode, period = [0,peak-1] + [peak,1]
|
||||
HAL_ASSERT(peak < MCPWM_LL_MAX_COUNT_VALUE);
|
||||
HAL_FORCE_MODIFY_U32_REG_FIELD(mcpwm->timer[timer_id].timer_cfg0, timer_period, peak);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user