Skip to content

Commit 23e6897

Browse files
authored
Add SerialUSB::ignoreFlowControl() method (#1624)
Fixes #1620
1 parent 70af32e commit 23e6897

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

cores/rp2040/SerialUSB.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ size_t SerialUSB::write(const uint8_t *buf, size_t length) {
130130

131131
static uint64_t last_avail_time;
132132
int written = 0;
133-
if (tud_cdc_connected()) {
133+
if (tud_cdc_connected() || _ignoreFlowControl) {
134134
for (size_t i = 0; i < length;) {
135135
int n = length - i;
136136
int avail = tud_cdc_write_available();
@@ -171,6 +171,9 @@ SerialUSB::operator bool() {
171171
return tud_cdc_connected();
172172
}
173173

174+
void SerialUSB::ignoreFlowControl(bool ignore) {
175+
_ignoreFlowControl = ignore;
176+
}
174177

175178
static bool _dtr = false;
176179
static bool _rts = false;

cores/rp2040/SerialUSB.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,16 @@ class SerialUSB : public HardwareSerial {
4444
using Print::write;
4545
operator bool() override;
4646

47+
void ignoreFlowControl(bool ignore = true);
48+
4749
// ESP8266 compat
4850
void setDebugOutput(bool unused) {
4951
(void) unused;
5052
}
5153

5254
private:
5355
bool _running = false;
56+
bool _ignoreFlowControl = false;
5457
};
5558

5659
extern SerialUSB Serial;

0 commit comments

Comments
 (0)