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

Implement PWM Trait #166

Closed
jounathaen opened this issue Jan 14, 2020 · 4 comments
Closed

Implement PWM Trait #166

jounathaen opened this issue Jan 14, 2020 · 4 comments

Comments

@jounathaen
Copy link
Contributor

For me as a stupid novice it looks like this crate does not implement the Pwm trait from the embedded-hal.
https://docs.rs/embedded-hal/0.2.3/embedded_hal/trait.Pwm.html

However, it seems to me, as if only the set_period and get_period functions are missing.

What a pity that these are the functions I need right now 😔

@TheZoq2
Copy link
Member

TheZoq2 commented Jan 15, 2020

Yep, you are correct in that assessment. If I recall correctly, the reason that is the case is that the period is shared among all channels, so period changes would affect more than just a single pin.

Off the top of my head, I'm not sure what the best way to add the functionality would be, but if you're interested I'd gladly try to point you in the right direction for where to look to fix this.

@justacec
Copy link
Contributor

I was having a similar issue as the OP. After some discussions with @TheZoq2, I have put forward PR #176 and have requested code review. (This was both more fun and frustrating than I thought it would be :) )

@tib888
Copy link

tib888 commented Apr 11, 2020

Yep, you are correct in that assessment. If I recall correctly, the reason that is the case is that the period is shared among all channels, so period changes would affect more than just a single pin.

Off the top of my head, I'm not sure what the best way to add the functionality would be, but if you're interested I'd gladly try to point you in the right direction for where to look to fix this.

I have just checked the embedded_hal version = "0.2.3", and it seems perfectly fine: there is no period setter in the PwmPin. The only difference is that every function name starts with a try_, and try return a result. so it could be implemented based on the current implementation...

@TheZoq2
Copy link
Member

TheZoq2 commented Oct 5, 2020

I think this is fixed now, feel free to re-open if I'm missremembering

@TheZoq2 TheZoq2 closed this as completed Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants