From e7d5f51de3f04ce066612e193c59e1caf2ec80f1 Mon Sep 17 00:00:00 2001 From: Ilias Lolis Date: Fri, 19 Jan 2024 19:00:20 +0200 Subject: [PATCH 1/2] add flush() method to HardwareSerial --- cores/arduino/HardwareSerial.cpp | 7 ++++++- cores/arduino/HardwareSerial.h | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cores/arduino/HardwareSerial.cpp b/cores/arduino/HardwareSerial.cpp index ff9ca2d2a5..dbb31f1eb8 100644 --- a/cores/arduino/HardwareSerial.cpp +++ b/cores/arduino/HardwareSerial.cpp @@ -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 @@ -642,7 +647,7 @@ void HardwareSerial::enableHalfDuplexRx(void) if (isHalfDuplex()) { // In half-duplex mode we have to wait for all TX characters to // be transmitted before we can receive data. - flush(); + flush(0); if (!_rx_enabled) { _rx_enabled = true; uart_enable_rx(&_serial); diff --git a/cores/arduino/HardwareSerial.h b/cores/arduino/HardwareSerial.h index b0089bab19..1806ba5675 100644 --- a/cores/arduino/HardwareSerial.h +++ b/cores/arduino/HardwareSerial.h @@ -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 = 0); virtual size_t write(uint8_t); inline size_t write(unsigned long n) { From 0ca4f75771ba95d4d6f54d0e2da59e02b7b6dbbb Mon Sep 17 00:00:00 2001 From: Ilias Lolis Date: Mon, 22 Jan 2024 00:44:30 +0200 Subject: [PATCH 2/2] remove default argument --- cores/arduino/HardwareSerial.cpp | 2 +- cores/arduino/HardwareSerial.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cores/arduino/HardwareSerial.cpp b/cores/arduino/HardwareSerial.cpp index dbb31f1eb8..146cfa234e 100644 --- a/cores/arduino/HardwareSerial.cpp +++ b/cores/arduino/HardwareSerial.cpp @@ -647,7 +647,7 @@ void HardwareSerial::enableHalfDuplexRx(void) if (isHalfDuplex()) { // In half-duplex mode we have to wait for all TX characters to // be transmitted before we can receive data. - flush(0); + flush(); if (!_rx_enabled) { _rx_enabled = true; uart_enable_rx(&_serial); diff --git a/cores/arduino/HardwareSerial.h b/cores/arduino/HardwareSerial.h index 1806ba5675..bfd94620ba 100644 --- a/cores/arduino/HardwareSerial.h +++ b/cores/arduino/HardwareSerial.h @@ -126,7 +126,7 @@ class HardwareSerial : public Stream { virtual int read(void); int availableForWrite(void); virtual void flush(); - void flush(uint32_t timeout = 0); + void flush(uint32_t timeout); virtual size_t write(uint8_t); inline size_t write(unsigned long n) { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy