diff options
Diffstat (limited to 'libraries/SoftwareSerial')
-rw-r--r-- | libraries/SoftwareSerial/SoftwareSerial.cpp | 11 | ||||
-rw-r--r-- | libraries/SoftwareSerial/SoftwareSerial.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/libraries/SoftwareSerial/SoftwareSerial.cpp b/libraries/SoftwareSerial/SoftwareSerial.cpp index 8bf56e5..a429f7d 100644 --- a/libraries/SoftwareSerial/SoftwareSerial.cpp +++ b/libraries/SoftwareSerial/SoftwareSerial.cpp @@ -195,6 +195,17 @@ bool SoftwareSerial::listen() return false;
}
+// Stop listening. Returns true if we were actually listening.
+bool SoftwareSerial::stopListening()
+{
+ if (active_object == this)
+ {
+ active_object = NULL;
+ return true;
+ }
+ return false;
+}
+
//
// The receive routine called by the interrupt handler
//
diff --git a/libraries/SoftwareSerial/SoftwareSerial.h b/libraries/SoftwareSerial/SoftwareSerial.h index 31bd229..e0e4746 100644 --- a/libraries/SoftwareSerial/SoftwareSerial.h +++ b/libraries/SoftwareSerial/SoftwareSerial.h @@ -87,6 +87,7 @@ public: bool listen();
void end();
bool isListening() { return this == active_object; }
+ bool stopListening();
bool overflow() { bool ret = _buffer_overflow; _buffer_overflow = false; return ret; }
int peek();
|