Add Serial.dtr() and Serial.rts() methods (#1779)
* add Serial.dtr() and Serial.rts() methods * added documentation for Serial.dtr() and Serial.rts()
This commit was merged in pull request #1779.
This commit is contained in:
@@ -197,6 +197,14 @@ static void CheckSerialReset() {
|
||||
}
|
||||
}
|
||||
|
||||
bool SerialUSB::dtr() {
|
||||
return _dtr;
|
||||
}
|
||||
|
||||
bool SerialUSB::rts() {
|
||||
return _rts;
|
||||
}
|
||||
|
||||
extern "C" void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) {
|
||||
(void) itf;
|
||||
_dtr = dtr ? true : false;
|
||||
|
||||
@@ -43,6 +43,8 @@ public:
|
||||
virtual size_t write(const uint8_t *p, size_t len) override;
|
||||
using Print::write;
|
||||
operator bool() override;
|
||||
bool dtr();
|
||||
bool rts();
|
||||
|
||||
void ignoreFlowControl(bool ignore = true);
|
||||
|
||||
|
||||
@@ -55,3 +55,13 @@ void Serial.ignoreFlowControl(bool ignore)
|
||||
In some cases, the target application will not assert the DTR virtual line, thus preventing writing operations to succeed.
|
||||
|
||||
For this reason, the SerialUSB::ignoreFlowControl() method disables the connection's state verification, enabling the program to write on the port, even though the data might be lost.
|
||||
|
||||
bool Serial.dtr()
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Returns the current state of the DTR virtual line. A USB CDC host (such as the Arduino serial monitor) typically raises the DTR pin when opening the device, and may lower it when closing the device.
|
||||
|
||||
bool Serial.rts()
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Returns the current state of the RTS virtual line.
|
||||
|
||||
Reference in New Issue
Block a user