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

Submit clock API to embedded-hal #4

Open
hannobraun opened this issue Nov 27, 2017 · 0 comments
Open

Submit clock API to embedded-hal #4

hannobraun opened this issue Nov 27, 2017 · 0 comments

Comments

@hannobraun
Copy link
Member

hannobraun commented Nov 27, 2017

The clock API could potentially be completely platform-independent and live in embedded-hal. Before that can happen, we should review and improve the design.

Here are a few improvements I can think of:

  • Frequency should have an associated type Freq. Frequency::hz would return Self::Freq instead of u32.
  • There should be an additional trait, Clock, that defines an associated type, Ticks. This type would be used for value in the Ticks struct, as u32 is not appropriate for all platforms.

Maybe it would be a good idea to add some more use cases before the clock API is submitted. The current clocks are pretty simple, as they have a constant frequency. Some ideas for additional use cases:

  • The external WKT clock, as that's fed into the microcontroller via a pin.
  • The UART clock, as that needs to deal with configurable frequencies.
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

1 participant