Closed mcells closed 1 year ago
This looks great to me, thank you very much!
Did you also test that the changes when using the standard setting still give the standard behaviour?
Thanks! Just tested it again, the default behavior is still everything active high.
SIMPLEFOC_PWM_HIGH/LOWSIDE_ACTIVE_HIGH overrides SIMPLEFOC_PWM_ACTIVE_HIGH only when _configureTimerFrequency is called with the deadtime parameter set (currently only done by 6 pwm). This is the case, even when deadtime is set to 0.
If the defines in hardware_api.h are removed, PIO & Arduino won´t compile, instead of just treating them as false.
Perhaps it would be a good idea to check for these defines in all drivers and throw an error if a driver doesn´t implement setting them to nonstandard values?
Thank you for checking!
Perhaps it would be a good idea to check for these defines in all drivers and throw an error if a driver doesn´t implement setting them to nonstandard values?
Yes, this would be a very good idea! I will try to add it with the next few commits
Thank you very much for your contribution! It's really appreciated. As you can imagine, adding features across all the different MCU architectures we support is a lot of work (making test setups each time!), so it is really a big help when generous people (like you) step in and help us out!
This PR adds support for switching driver polarity when using the MCPWM driver using the SIMPLEFOC_PWM_HIGH/LOWSIDE_ACTIVE_HIGH and SIMPLEFOC_PWM_ACTIVE_HIGH defines.
I have successfully used the 6 pwm inverted lowside modified code for my motor driver and just added the missing cases in. The output of both 6 and 3 pwm modes looks correct to me. I didn´t try the stepper modes, but they should work the same.
Are the proposed changes ok, or have I missed something?