HAL_AVR: catch atomic nesting errors

This commit is contained in:
Andrew Tridgell 2012-12-13 09:03:42 +11:00
parent e57834d763
commit 1342a82ba7

View File

@ -199,6 +199,10 @@ void AVRScheduler::begin_atomic() {
}
void AVRScheduler::end_atomic() {
if (_nested_atomic_ctr == 0) {
hal.uartA->println_P(PSTR("ATOMIC NESTING ERROR"));
return;
}
_nested_atomic_ctr--;
if (_nested_atomic_ctr == 0) {
sei();