Skip to content

Commit 42dd310

Browse files
committed
Merge pull request #146 from sandeepmistry/serial-availableForWrite
Add Uart::availableForWrite()
2 parents f3a29a7 + 76ca382 commit 42dd310

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

cores/arduino/Uart.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ int Uart::available()
7777
return rxBuffer.available();
7878
}
7979

80+
int Uart::availableForWrite()
81+
{
82+
return (sercom->isDataRegisterEmptyUART() ? 1 : 0);
83+
}
84+
8085
int Uart::peek()
8186
{
8287
return rxBuffer.peek();

cores/arduino/Uart.h

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class Uart : public HardwareSerial
3232
void begin(unsigned long baudrate, uint16_t config);
3333
void end();
3434
int available();
35+
int availableForWrite();
3536
int peek();
3637
int read();
3738
void flush();

0 commit comments

Comments
 (0)