mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
fix(mcpwm): correct the wrong capture prescale
This commit is contained in:
@@ -1635,16 +1635,18 @@ static inline mcpwm_capture_edge_t mcpwm_ll_capture_get_edge(mcpwm_dev_t *mcpwm,
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the prescale of the input capture signal
|
||||
* @brief Set capture input prescale (same-edge ratio)
|
||||
*
|
||||
* @note Hardware field N = 0 means bypass (ratio 1); N >= 1 means same-edge ratio = 2 * N.
|
||||
*
|
||||
* @param mcpwm Peripheral instance address
|
||||
* @param channel Channel ID, index from 0 to 2
|
||||
* @param prescale Prescale value
|
||||
* @param prescale Desired same-edge ratio: 1 (bypass) or even
|
||||
*/
|
||||
static inline void mcpwm_ll_capture_set_prescale(mcpwm_dev_t *mcpwm, int channel, uint32_t prescale)
|
||||
{
|
||||
HAL_ASSERT(prescale > 0);
|
||||
HAL_FORCE_MODIFY_U32_REG_FIELD(mcpwm->cap_chn_cfg[channel], capn_prescale, prescale - 1);
|
||||
HAL_FORCE_MODIFY_U32_REG_FIELD(mcpwm->cap_chn_cfg[channel], capn_prescale, prescale / 2);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////MCPWM ETM Specific////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user