Skip to content

Pwm trait requires real-world time knowledge #226

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

Open
eldruin opened this issue Jun 20, 2020 · 1 comment
Open

Pwm trait requires real-world time knowledge #226

eldruin opened this issue Jun 20, 2020 · 1 comment

Comments

@eldruin
Copy link
Member

eldruin commented Jun 20, 2020

The Pwm trait is cumbersome to implement in a driver like the PCA9685 driver due to the try_set_period and try_get_period methods, which depend on knowledge of the "real-world" frequency on which everything is running.

This can even be an external input and thus subject to external change plus configurable through a prescaler or power configuration and so on.

Even when solving this (e.g. by having the user provide the value directly), in the try_set_period implementation the driver will need to calculate an approximation to a combination of prescaler and/or other configs. This may be possible but I feel this is something that the driver user would rather determine themselves so that the authoritatively provided frequency is followed exactly.

Additionally, choosing a Time type seems difficult because of precision and conversion issues.

@eldruin eldruin mentioned this issue Jun 20, 2020
@PTaylor-us
Copy link

Additionally, choosing a Time type seems difficult because of precision and conversion issues.

I have released (and continue to develop) embedded-time (#211) aimed at allowing use of Time-type values efficiently in embedded systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants