-
-
Notifications
You must be signed in to change notification settings - Fork 349
[WIP] Refactor/i hardware pwm #2956
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
base: develop
Are you sure you want to change the base?
Conversation
…This uses the esp32 ledc hpoint setting to stagger the starting point of pwm channels evenly across the pwm period to improve EMI of multi-channel high current PWM applications
PR Summary
|
regarding those ci failures: for the esp32 builds on MacOS, it looks like maybe instead of trying to include arch/esp32/Core/HardwarePWM.h, it tries to include from arch/host? not sure why that would be, but that file currently doesn't exist. Might be an issue with the build environment on Mac? |
My thoughts on the code as it stands:
Given that you are currently focused on the Esp32 capability, I think it would be better to create a separate library first. There are a number of advantages to this:
Once the library is stable and works as you like, we then have something concrete to consider migrating into the main Sming codebase. The |
after the discussion in #2955, I started thinking a bit more about how I could implement a richer HardwarePWM interface without breaking compatibility and while maintaining the core API in place, too.
My goal was to:
I took the suggestion of extending the C header at
pwm.h
to provide the configuration option structures necessary at HardwarePWM instantiation. I'm not perfectly happy with that as it creates quite a bit of opportunity to mess up memory - and no good way to test for correct parameters. But I guess that's what we get for using C.I have also moved the pre-existing
HardwarePWM
class to an interface only implementationIHardwarePWM
that all hardware specific classes now inherit from. This allows me to extend the interface in the the child classes while maintaining a coherent set of base functions for any older code to work with. Code that wants to use the extended functionality will have to be platform specific.This PR currently only implements the Hardware specific classes for Esp32 and Esp8266, CI failures for Host and RP2040 are expected.
The main goal is to get feedback.