diff --git a/cores/arduino/Uart.cpp b/cores/arduino/Uart.cpp index 7a718e2c1..13e0ebaac 100644 --- a/cores/arduino/Uart.cpp +++ b/cores/arduino/Uart.cpp @@ -77,6 +77,11 @@ int Uart::available() return rxBuffer.available(); } +int Uart::availableForWrite() +{ + return (sercom->isDataRegisterEmptyUART() ? 1 : 0); +} + int Uart::peek() { return rxBuffer.peek(); diff --git a/cores/arduino/Uart.h b/cores/arduino/Uart.h index 7115da740..02d30bd45 100644 --- a/cores/arduino/Uart.h +++ b/cores/arduino/Uart.h @@ -32,6 +32,7 @@ class Uart : public HardwareSerial void begin(unsigned long baudrate, uint16_t config); void end(); int available(); + int availableForWrite(); int peek(); int read(); void flush();