mcpwm: fix bldc example force output level inverted

set_force_level can only set the generator level before the deadtime module.
if the deadtime module enables the inverter, then the real output level is inverted accordingly
This commit is contained in:
morris
2023-05-10 19:17:21 +08:00
parent 6a7f730c77
commit 5680d28b0e
3 changed files with 102 additions and 38 deletions
@@ -59,6 +59,7 @@ esp_err_t mcpwm_del_generator(mcpwm_gen_handle_t gen);
* @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