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

Improve sleep API #13

Open
hannobraun opened this issue Nov 28, 2017 · 2 comments
Open

Improve sleep API #13

hannobraun opened this issue Nov 28, 2017 · 2 comments

Comments

@hannobraun
Copy link
Member

hannobraun commented Nov 28, 2017

The current sleep API feels a bit icky. Some ideas for improvement:

  • Add prepare method to trait, use associated type for parameters.
  • Provide module-level sleep function for convenience, so the user doesn't need the two-step sleep.
  • Deep power-down mode resets the microcontroller upon wake-up. This means a sleep function based on that mode needs to return ! instead of (). The Sleep trait should have an associated type to define the return type.
  • Think about Clock: Should it be an associated type instead of a type parameter?

Once the API has matured a bit, it can be submitted to embedded-hal.

@hannobraun
Copy link
Member Author

hannobraun commented Nov 28, 2017

Two notes:

  • Before submitting this to embedded-hal, it would make sense to submit a power mode API first, as that's lower-level. See Improve API for switching to low-power modes #3.
  • I'm not sure if this is suitable for embedded-hal at all, as a sleep API is blocking by nature. It might be undesirable to have anything beyond timers and power modes in there.

I think it's best to defer this until a power mode API has been fleshed out and submitted, then think about this issue later on.

@hannobraun
Copy link
Member Author

I'm removing the upstream label. I aleady expressed doubts on whether this should be submitted to embedded-hal, and in addition, embedded-hal has gained a sleep API in the meantime.

If we come up with something worthwhile, we can think about submitting it to embedded-hal later. For now, this issue is only about improving the sleep API in this crate.

@hannobraun hannobraun changed the title Improve sleep API and submit to embedded-hal Improve sleep API Feb 16, 2018
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