Feature: Added non-blocking serial break/unbreak functions

Current serial implementation has a send_break() command which
sends a break command on the UART for a fixed amount of time.

Added functions to allow users to send a break in a non-blocking
fashion, as well as for a user-specified amount of time.
pull/8671/head
Michael Ray 2018-11-07 10:42:17 -06:00
parent 96191e22b2
commit b7559e315c
2 changed files with 24 additions and 0 deletions

View File

@ -118,6 +118,20 @@ int SerialBase::_base_putc(int c)
return c;
}
void SerialBase::set_break()
{
lock();
serial_break_set(&_serial);
unlock();
}
void SerialBase::clear_break()
{
lock();
serial_break_clear(&_serial);
unlock();
}
void SerialBase::send_break()
{
lock();

View File

@ -137,6 +137,16 @@ public:
attach(callback(obj, method), type);
}
/** Generate a break condition on the serial line
* NOTE: Clear break needs to run at least one frame after set_break is called
*/
void set_break();
/** Clear a break condition on the serial line
* NOTE: Should be run at least one frame after set_break is called
*/
void clear_break();
/** Generate a break condition on the serial line
*/
void send_break();