We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cea1d20 commit e4f7bf5Copy full SHA for e4f7bf5
cores/arduino/USB/CDC.cpp
@@ -351,6 +351,17 @@ bool Serial_::rts() {
351
return _usbLineInfo.lineState & 0x2;
352
}
353
354
+int Serial_::availableForStore(void) {
355
+ ring_buffer *buffer = &cdc_rx_buffer;
356
+
357
+ if (buffer->full)
358
+ return 0;
359
+ else if (buffer->head >= buffer->tail)
360
+ return CDC_SERIAL_BUFFER_SIZE - 1 - buffer->head + buffer->tail;
361
+ else
362
+ return buffer->tail - buffer->head - 1;
363
+}
364
365
Serial_ SerialUSB(USBDevice);
366
367
#endif
cores/arduino/USB/USBAPI.h
@@ -168,6 +168,8 @@ class Serial_ : public Stream
168
};
169
170
private:
171
+ int availableForStore(void);
172
173
USBDeviceClass &usb;
174
RingBuffer *_cdc_rx_buffer;
175
0 commit comments