-
Notifications
You must be signed in to change notification settings - Fork 60
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
Add PWR API, support for wake-up via EXTI #25
Conversation
So far, there's just one method, to enter sleep mode.
This is useful for restoring the previous clock configuration after waking up from Stop mode, but it might also be useful for other purposes.
Having this trait makes it possible to write sleep functions that are generic over the specific power mode being used.
I just noticed I forgot to enable the PWR peripheral clock. I did not notice earlier because everything worked as expected. This could happen because the main work here is being done by SCB, RCC, and Only Stop mode is affected. I think that Stop mode is actually still entered (because I explicitly saw a slower clock after wake-up before I figured out I need to set |
This should have been done from the beginning, but it slipped through because things basically worked as expected. This was possible because the bulk of the work here is done by SCB, RCC, and of course `wfi`. The PWR peripheral only takes care of some secondary configuration.
Pushed another commit. As best as I can tell, everything should work as expected. Once I've implemented more power modes (should happen in a few weeks), I'll do more testing with some actual current measurement. |
Nice! Thanks so much for the PR. |
Add a PRW API with support for Sleep and Stop modes, as well as a method that goes to sleep and waits for an EXTI interrupt. I also snuck in some clean-up of the
prelude
module, while I was in there.cc @lthiery