-
Notifications
You must be signed in to change notification settings - Fork 628
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
rp2040 SetDutyCycle
is not implemented for pwm
#2784
Comments
Yeah, I'm super confused how to actually use PWM since we don't have a |
Just ran into this as well trying to use an RGB LED module... It looks like according to the example that the
|
Yeah, it's weird. The docs have this to say about
It also says at the top:
This was super confusing to me, as it seems from the latter comment that |
Yeah I would have expected an implementation more like the NRF & STM32 impls... I can't seem to get the example for RP to work regardless (Pico W) 🤷 Have a look at the datasheet section 4.5 for more PWM details which help explain a bit of the above... but there is no straightforward conversion from MicroPython examples to this. For example, I don't see how to set the channel frequency... The |
current status is the API is low-level, you pass in the values that are directly configured in the hardware. The datasheet explains the meaning of those values. I agree it's not the most intuitive thing, if someone wants to work on adding a higher-level API where you set the frequency and duty cycle and it does the calculations for you, a pull request would be welcome. |
Thanks for the quick confirmation 🙏 |
@mattiekat @crabdancing have a peek at #2855 -- it's a start anyway.. |
Found a bit of a rough edge when trying to use a motor controller library and found that
embedded_hal::pwm::SetDutyCycle
is not implemented for any of the pwm types.Looking at the
rp2040-hal
crate I see it was implemented forrp2040_hal::pwm::Channel
maybe I am misunderstanding and this should be wrapped instead?The text was updated successfully, but these errors were encountered: