Skip to content

Commit 610d4a8

Browse files
sandeepmistrycmaglie
authored andcommitted
Also check if TX buffer is empty before writing to data to UART reg directly
1 parent 12b3774 commit 610d4a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cores/arduino/Uart.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ int Uart::read()
107107

108108
size_t Uart::write(const uint8_t data)
109109
{
110-
if (sercom->isDataRegisterEmptyUART()) {
110+
if (sercom->isDataRegisterEmptyUART() && txBuffer.available() == 0) {
111111
sercom->writeDataUART(data);
112112
} else {
113113
while(txBuffer.isFull()); // spin lock until a spot opens up in the buffer

0 commit comments

Comments
 (0)