Skip to content

Commit fd926ed

Browse files
committed
Implement interrupts and noInterrupts
- Using irq_lock and irq_unlock zephyr apis. Signed-off-by: Ayush Singh <[email protected]>
1 parent 3538c54 commit fd926ed

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

cores/arduino/zephyrCommon.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -464,3 +464,18 @@ void disableInterrupt(pin_size_t pinNumber) {
464464
pcb->handlers[BIT(arduino_pins[pinNumber].pin)].enabled = false;
465465
}
466466
}
467+
468+
static unsigned int irq_key = UINT_MAX;
469+
470+
void interrupts(void) {
471+
if (irq_key != UINT_MAX) {
472+
irq_unlock(irq_key);
473+
irq_key = UINT_MAX;
474+
}
475+
}
476+
477+
void noInterrupts(void) {
478+
if (irq_key == UINT_MAX) {
479+
irq_key = irq_lock();
480+
}
481+
}

0 commit comments

Comments
 (0)