Skip to content

Commit 38f7fca

Browse files
committed
Add blocking delay if the TX ring buffer is full
1 parent 98bee29 commit 38f7fca

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cores/arduino/ard_sup/uart/ap3_uart.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,12 @@ size_t Uart::write(const uint8_t *buffer, size_t size)
151151

152152
//Transfer any remaining bytes into ring buffer
153153
for (int x = 0; x < size; x++)
154+
{
155+
//If TX ring buffer is full, begin blocking
156+
while (_tx_buffer.availableForStore() == 0)
157+
delay(1);
154158
_tx_buffer.store_char(buffer[x]);
159+
}
155160

156161
return ui32BytesWritten; //Return number of bytes pushed to UART hardware
157162
}

0 commit comments

Comments
 (0)