We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d848264 commit 72ea3cfCopy full SHA for 72ea3cf
cores/arduino/USB/CDC.cpp
@@ -298,6 +298,8 @@ Serial_::operator bool()
298
}
299
300
int32_t Serial_::readBreak() {
301
+ uint8_t enableInterrupts = (__get_PRIMASK() == 0);
302
+
303
// disable interrupts,
304
// to avoid clearing a breakValue that might occur
305
// while processing the current break value
@@ -307,8 +309,10 @@ int32_t Serial_::readBreak() {
307
309
308
310
breakValue = -1;
311
- // re-enable the interrupts
- interrupts();
312
+ if (enableInterrupts) {
313
+ // re-enable the interrupts
314
+ interrupts();
315
+ }
316
317
return ret;
318
0 commit comments