synth/arm/lock.h
2022-05-16 20:59:17 -07:00

19 lines
284 B
C

#pragma once
#include "aum1_cm1.h"
struct InterruptLock {
bool was_locked;
InterruptLock()
: was_locked(__get_PRIMASK() != 0) {
__disable_irq();
}
~InterruptLock() {
if (!was_locked) {
__enable_irq();
}
}
};