Function esp_idf_sys::mcpwm_timer_set_period
source ยท pub unsafe extern "C" fn mcpwm_timer_set_period(
timer: mcpwm_timer_handle_t,
period_ticks: u32,
) -> esp_err_t
Expand description
@brief Set a new period for MCPWM timer
@note If mcpwm_timer_config_t::update_period_on_empty
and mcpwm_timer_config_t::update_period_on_sync
are not set,
the new period will take effect immediately.
Otherwise, the new period will take effect when timer counts to zero or on sync event.
@note You may need to use mcpwm_comparator_set_compare_value
to set a new compare value for MCPWM comparator
in order to keep the same PWM duty cycle.
@param[in] timer MCPWM timer handle, allocated by mcpwm_new_timer
@param[in] period_ticks New period in count ticks
@return
- ESP_OK: Set new period for MCPWM timer successfully
- ESP_ERR_INVALID_ARG: Set new period for MCPWM timer failed because of invalid argument
- ESP_FAIL: Set new period for MCPWM timer failed because of other error