Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP_HAL_ESP32: RCOutput: add support for brushed PWM mode #28865

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tpwrules
Copy link
Contributor

@tpwrules tpwrules commented Dec 15, 2024

This is needed to fly the Stampfly. It's a significant re-engineering from the in-master state and the brushed hack that was used previously (though I've now rebased my stampfly branch to include this for those who want to try).

I tried to match the (somewhat vague) semantics of the ChibiOS HAL with regards to groups and frequencies, and I tested that the PWM output in "normal" mode still doesn't work the same way on the Stampfly, but someone needs to test it more thoroughly.

Enabling/disabling the timer would apply the setting to whole groups of
channels. Fix to poke the comparator so that the setting only applies to
the particular channel.

Conveniently, though not necessarily intentionally, this avoids
truncating the output pulse and causing unexpected reactions from
servos. This also preserves the old behavior.
Avoid over-running the pending PWM and safe value PWM arrays in case
future chip revisions come out with more channels.
Each of the six available timers now handles two consecutive PWM output
channels. This also implements support for changing the group PWM
frequency in a similar manner to the ChibiOS HAL.
Also adds some infrastructure for changing PWM group mode, though this
is likely the complete set that can be supported with the ESP32 PWM
peripheral.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant