1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-18 07:52:14 +01:00

Add SoftwareSerial::stopListening()

This allows one to explicitly stop a SoftwareSerial instance from
listening, without having to make another one listening.
This commit is contained in:
Matthijs Kooijman 2013-06-04 11:28:30 +02:00
parent db1a4ad139
commit 934393398b
2 changed files with 12 additions and 0 deletions

View File

@ -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
//

View File

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