Function esp_idf_svc::hal::sys::mcpwm_generator_set_force_level
source · pub unsafe extern "C" fn mcpwm_generator_set_force_level(
gen: *mut mcpwm_gen_t,
level: i32,
hold_on: bool,
) -> i32
Expand description
@brief Set force level for MCPWM generator
@note The force level will be applied to the generator immediately, regardless any other events that would change the generator’s behaviour.
@note If the hold_on
is true, the force level will retain forever, until user removes the force level by setting the force level to -1
.
@note If the hold_on
is false, the force level can be overridden by the next event action.
@note The force level set by this function can be inverted by GPIO matrix or dead-time module. So the level set here doesn’t equal to the final output level.
@param[in] gen MCPWM generator handle, allocated by mcpwm_new_generator()
@param[in] level GPIO level to be applied to MCPWM generator, specially, -1 means to remove the force level
@param[in] hold_on Whether the forced PWM level should retain (i.e. will remain unchanged until manually remove the force level)
@return
- ESP_OK: Set force level for MCPWM generator successfully
- ESP_ERR_INVALID_ARG: Set force level for MCPWM generator failed because of invalid argument
- ESP_FAIL: Set force level for MCPWM generator failed because of other error