-
Notifications
You must be signed in to change notification settings - Fork 377
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 __irq_enabled() function #633
Comments
Why not return a bool? |
@FrankBoesing |
gnu++14 (C++ 14) |
The "atomic" macros can help here, from ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
// Do stuff
} This form guarantees the interrupts get reenabled appropriately. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is better for a function to not simply disable and enable interrupts, so the following pattern is generally better:
To be able to use this pattern, a function __irq_enabled() is necessary. The following can be inserted right into the relevant headers (kinetis.h for Teensy 3, imxrt.h for Teensy 4) next to __enable_irq() and disable_irq():
The text was updated successfully, but these errors were encountered: