-
Notifications
You must be signed in to change notification settings - Fork 154
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
Delay should sleep the CPU #506
Comments
SysTick can not be an option because user can use it, and overriding duration and systick registers may bring unexpected results to user's program |
That's not possible because the |
Oh, i see |
It's not really needed to replace the default handler, because you can avoid actually calling it by disabling interrupts. (WFI still works.)
|
So this is neat, but I think I'd maybe rather see a more fully-featured SysTick driver in cortex-m - one that handles roll-over using an exception handler. It could maybe also have an optional user-supplied handler which can be plugged in (some If the user has a custom systick interrupt handler, I trust them to know that the systick delay is a busy-wait and that they should do something better using the interrupt they have already setup. |
Rather than busy-wait the CPU, the delay implementation should set the systick to generate an interrupt on overflow, and sleep with a
wfi
. This would reduce power consumption.You might need to put it behind a flag because you'd have to replace DefaultHandler_ for systick with something that didn't loop forever...
The text was updated successfully, but these errors were encountered: