1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-19 13:54:23 +01:00

Correct an issue where write could send data out of order.

This commit is contained in:
Collin Kidder 2014-12-31 08:42:26 -05:00
parent eff20deb27
commit 76280e8778

View File

@ -141,7 +141,7 @@ void UARTClass::flush( void )
size_t UARTClass::write( const uint8_t uc_data )
{
if ((_pUart->UART_SR & UART_SR_TXRDY) != UART_SR_TXRDY) //is the hardware currently busy?
if (((_pUart->UART_SR & UART_SR_TXRDY) != UART_SR_TXRDY) | (_tx_buffer->_iTail != _tx_buffer->_iHead)) //is the hardware currently busy?
{
//if busy we buffer
unsigned int l = (_tx_buffer->_iHead + 1) % SERIAL_BUFFER_SIZE;