From 9b291b876868c84d05da2deeb47b03d5e6dd2c2f Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 4 Jun 2013 10:58:56 +0200 Subject: Let SoftwareSerial::listen() fail on invalid rx baud rates In this case, SoftwareSerial::begin will not have enabled the interrupts, so better not allow the SoftwareSerial instance to enter the listening state either. --- libraries/SoftwareSerial/SoftwareSerial.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libraries/SoftwareSerial') diff --git a/libraries/SoftwareSerial/SoftwareSerial.cpp b/libraries/SoftwareSerial/SoftwareSerial.cpp index 8476deb..605c788 100644 --- a/libraries/SoftwareSerial/SoftwareSerial.cpp +++ b/libraries/SoftwareSerial/SoftwareSerial.cpp @@ -178,6 +178,9 @@ inline void SoftwareSerial::tunedDelay(uint16_t delay) { // one and returns true if it replaces another bool SoftwareSerial::listen() { + if (!_rx_delay_stopbit) + return false; + if (active_object != this) { _buffer_overflow = false; -- cgit v1.2.3-18-g5258