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(); }