Skip to content

Commit

Permalink
better implementation of HardwareSerial::availableForWrite()
Browse files Browse the repository at this point in the history
  • Loading branch information
lyusupov committed Nov 27, 2020
1 parent 3ec0399 commit 1cda4b3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cores/asr650x/Serial/HardwareSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,22 @@ int HardwareSerial::available(void)
//}
return 0;
}

void HardwareSerial::delayByte(void)
{
delayMicroseconds(11000000/SerialBaud);
}


int HardwareSerial::availableForWrite(void)
{
// return uartAvailableForWrite(_uart);
return 0;
if( _uart_num == UART_NUM_0)
{
return (int) (UART_1_TX_BUFFER_SIZE - UART_1_SpiUartGetTxBufferSize());
}
else
{
return (int) (UART_2_TX_BUFFER_SIZE - UART_2_SpiUartGetTxBufferSize());
}
}

int HardwareSerial::peek(void)
Expand Down

0 comments on commit 1cda4b3

Please sign in to comment.