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 261c375 commit 610a937Copy full SHA for 610a937
cores/arduino/USB/CDC.cpp
@@ -166,7 +166,9 @@ void Serial_::accept(void)
166
uint8_t buffer[CDC_SERIAL_BUFFER_SIZE];
167
uint32_t len = usb.recv(CDC_ENDPOINT_OUT, &buffer, CDC_SERIAL_BUFFER_SIZE);
168
169
- noInterrupts();
+ uint8_t enableInterrupts = ((__get_PRIMASK() & 0x1) == 0);
170
+ __disable_irq();
171
+
172
ring_buffer *ringBuffer = &cdc_rx_buffer;
173
uint32_t i = ringBuffer->head;
174
@@ -183,7 +185,9 @@ void Serial_::accept(void)
183
185
ringBuffer->full = true;
184
186
}
187
ringBuffer->head = i;
- interrupts();
188
+ if (enableInterrupts) {
189
+ __enable_irq();
190
+ }
191
192
193
int Serial_::available(void)
0 commit comments