nrfcxx
0.1.0
C++-17 Framework for Nordic nRF5 Devices
|
RAII class to block a peripheral interrupt. More...
#include <nrfcxx/core.hpp>
Public Member Functions | |
nvic_BlockIRQ (IRQn_Type irqn) | |
nvic_BlockIRQ (int irqn) | |
Variant required to work around lack of IRQn_Type when declaring nrfcxx::peripheral. | |
nvic_BlockIRQ (const nvic_BlockIRQ &)=delete | |
nvic_BlockIRQ & | operator= (const nvic_BlockIRQ &)=delete |
nvic_BlockIRQ (nvic_BlockIRQ &&)=delete | |
nvic_BlockIRQ & | operator= (nvic_BlockIRQ &)=delete |
RAII class to block a peripheral interrupt.
The NVIC configuration for the specified IRQ is recorded and the interrupt disabled when the instance is constructed. When the instance is destructed the interrupt is enabled if it was enabled when constructed.
This allows safe manipulation of state that is shared between the application and the interrupt handler, assuming that instances of this class are created (for a specific IRQ) only when not invoked from within (recursively) the corresponding handler.
Note that if the code invoked from within the blocked region calls functions that independently block the same interrupt, the interrupt will not be prematurely re-enabled.