aboutsummaryrefslogtreecommitdiff
path: root/libraries/SoftwareSerial
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2013-06-04 10:58:56 +0200
committerMatthijs Kooijman <matthijs@stdin.nl>2015-01-26 17:03:24 +0100
commit9b291b876868c84d05da2deeb47b03d5e6dd2c2f (patch)
tree957f3f795d2bf6faa931d225e9a2c4778b2dbfce /libraries/SoftwareSerial
parent4d3ccb411801214d713bb93c1297c074c14e9ab4 (diff)
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.
Diffstat (limited to 'libraries/SoftwareSerial')
-rw-r--r--libraries/SoftwareSerial/SoftwareSerial.cpp3
1 files changed, 3 insertions, 0 deletions
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;