From 39b9d95d5287febb798a238c74f52aae0a71d56b Mon Sep 17 00:00:00 2001 From: klassents Date: Sun, 13 Oct 2024 15:22:51 +0700 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B8=D0=BC=D0=B5=D1=80=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SoftwareSerialExample.ino | 14 ++++++-------- libraries/SoftwareSerial/src/SoftwareSerial.cpp | 3 +-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino b/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino index ef55efe..1663767 100644 --- a/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino +++ b/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino @@ -28,10 +28,7 @@ SoftwareSerial mySerial(2, 6); // RX, TX void setup() { // Open serial communications and wait for port to open: Serial.begin(115200); - while (!Serial) { - ; // wait for serial port to connect. Needed for native USB port only - } - + while (!Serial) ; // wait for serial port to connect. Needed for native USB port only Serial.println("Goodnight moon!"); // set the data rate for the SoftwareSerial port @@ -40,10 +37,11 @@ void setup() { } void loop() { // run over and over - if (mySerial.available()) { + while (mySerial.available()) Serial.write(mySerial.read()); - } - if (Serial.available()) { + + while (Serial.available()) mySerial.write(Serial.read()); - } + + delay(50); } diff --git a/libraries/SoftwareSerial/src/SoftwareSerial.cpp b/libraries/SoftwareSerial/src/SoftwareSerial.cpp index 3bee87d..0f312a2 100644 --- a/libraries/SoftwareSerial/src/SoftwareSerial.cpp +++ b/libraries/SoftwareSerial/src/SoftwareSerial.cpp @@ -145,8 +145,7 @@ void SoftwareSerial::handle_interrupt() // .ram_text } } -extern "C" void softSerial_interrupt_handler(void) __attribute__((noinline, section(".ram_text"))); -extern "C" void softSerial_interrupt_handler(void) +extern "C" void __attribute__((noinline, section(".ram_text"))) softSerial_interrupt_handler(void) { SoftwareSerial::handle_interrupt(); }