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:
parent
7366268025
commit
3f02bcb49f
|
@ -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
|
||||
//
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue