Skip to content

Commit 76280e8

Browse files
committed
Correct an issue where write could send data out of order.
1 parent eff20de commit 76280e8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hardware/arduino/sam/cores/arduino/UARTClass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ void UARTClass::flush( void )
141141

142142
size_t UARTClass::write( const uint8_t uc_data )
143143
{
144-
if ((_pUart->UART_SR & UART_SR_TXRDY) != UART_SR_TXRDY) //is the hardware currently busy?
144+
if (((_pUart->UART_SR & UART_SR_TXRDY) != UART_SR_TXRDY) | (_tx_buffer->_iTail != _tx_buffer->_iHead)) //is the hardware currently busy?
145145
{
146146
//if busy we buffer
147147
unsigned int l = (_tx_buffer->_iHead + 1) % SERIAL_BUFFER_SIZE;

0 commit comments

Comments
 (0)