Skip to content

Commit

Permalink
HardwareSerial's flush() method to override the method of the base cl…
Browse files Browse the repository at this point in the history
…ass Print (#2254)

* add flush() method to HardwareSerial

* remove default argument
  • Loading branch information
ilolis authored Jan 22, 2024
1 parent 1863c25 commit 49b8eef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions cores/arduino/HardwareSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,11 @@ int HardwareSerial::availableForWrite(void)
return tail - head - 1;
}

void HardwareSerial::flush()
{
flush(0);
}

void HardwareSerial::flush(uint32_t timeout)
{
// If we have never written a byte, no need to flush. This special
Expand Down
3 changes: 2 additions & 1 deletion cores/arduino/HardwareSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ class HardwareSerial : public Stream {
virtual int peek(void);
virtual int read(void);
int availableForWrite(void);
virtual void flush(uint32_t timeout = 0);
virtual void flush();
void flush(uint32_t timeout);
virtual size_t write(uint8_t);
inline size_t write(unsigned long n)
{
Expand Down

0 comments on commit 49b8eef

Please sign in to comment.