diff --git a/cores/arduino/Uart.cpp b/cores/arduino/Uart.cpp index 7a718e2c1a54483f19d7bff5cd5b0d15f42dd317..13e0ebaacb395f119ed0fc8b619bdc9c9f2e54b8 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 7115da7401aba00b3045917dc17e252d0064d4e9..02d30bd45094831e69fb2ec1280825796114c604 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();