Skip to content

Commit 3283a93

Browse files
CDC/Uart: fix the event handler to provide an early out if no data is read
1 parent 127be3c commit 3283a93

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

cores/stm32l4/CDC.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,10 @@ void CDC::EventCallback(uint32_t events)
403403
if (empty && _receiveCallback) {
404404
(*_receiveCallback)(count);
405405
}
406+
407+
if (!rx_size) {
408+
break;
409+
}
406410
}
407411
}
408412

cores/stm32l4/Uart.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,10 @@ void Uart::EventCallback(uint32_t events)
393393
if (empty && _receiveCallback) {
394394
(*_receiveCallback)(count);
395395
}
396+
397+
if (!rx_size) {
398+
break;
399+
}
396400
}
397401
}
398402

0 commit comments

Comments
 (0)