Is there a way of telling if sei()
/interrupts()
or cli()
/noInterrupts()
was last called?
I need this to be able to enable interrupts, execute some code and set interrupts disable interrupts if they where disabled.
Here is some sample code:
void function_requiring_interrupts(void) {
bool interruptsEnabled = getInterrupsState(); // what function / variable here?
interrupts();
// Code requiring interrups are enabled
if(!interruptsEnabled) {
noInterrupts();
}
}