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

Dynamic PwmOutput #355

Open
EZ64cool opened this issue Oct 22, 2022 · 1 comment
Open

Dynamic PwmOutput #355

EZ64cool opened this issue Oct 22, 2022 · 1 comment
Labels
hal-api API design for the different components of avr-hal hal-generic Related to MCU generic parts of avr-hal help wanted Extra attention is needed

Comments

@EZ64cool
Copy link

EZ64cool commented Oct 22, 2022

I'm pretty new to Arduino so this may be something that shouldn't be allowed, but I was trying to downgrade PwmOutput pins to a Dynamic pin type and couldn't seem to find a way to do this.

I think I understand the reasoning of timers are attached to pins, but was curious anyway.

Thanks.

@Rahix
Copy link
Owner

Rahix commented Oct 23, 2022

Hi,

there is nothing against supporting that from the technical side but as you noticed, it isn't implemented at this point. Let's actually use this issue to keep track of this feature.

A few notes:

  • I think the easiest option here would be to add a new DynamicPwm "timer" type which selects the timer at runtime. This is similar to what we're already doing with digital I/O and should thus probably also work well for PWM.
  • I'm not sure if we can make the .downgrade() method work for both digital I/O and PWM. We might need to introduce some more trait-trickery to get this working. But I think from an API standpoint, it would be the best option.

@Rahix Rahix added help wanted Extra attention is needed hal-api API design for the different components of avr-hal hal-generic Related to MCU generic parts of avr-hal labels Oct 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hal-api API design for the different components of avr-hal hal-generic Related to MCU generic parts of avr-hal help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants