diff options
author | Zach Eveland <zeveland@blacklabel-development.com> | 2011-12-18 17:52:35 -0500 |
---|---|---|
committer | Zach Eveland <zeveland@blacklabel-development.com> | 2011-12-18 17:52:35 -0500 |
commit | 58fc0d17cc2d7c5dfb4ce268b7e43d35eebac342 (patch) | |
tree | 062e7f2a87d4ae1878d75ed093c9f6a7f846ebc4 /cores/arduino/USBCore.cpp | |
parent | 177641003c53844ad73584553a9d44f2da4648e2 (diff) |
added asynchronous buffering of received CDC characters
This fixes the issue Federico reported where bytes written by host but not read by sketch would cause serial connection to lock up. Ring buffer implementation is based on HardwareSerial.cpp.
Adds public accept() method to CDC.
Diffstat (limited to 'cores/arduino/USBCore.cpp')
-rw-r--r-- | cores/arduino/USBCore.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp index 398bc73..7924078 100644 --- a/cores/arduino/USBCore.cpp +++ b/cores/arduino/USBCore.cpp @@ -599,6 +599,8 @@ ISR(USB_GEN_vect) { #ifdef CDC_ENABLED USB_Flush(CDC_TX); // Send a tx frame if found + while (USB_Available(CDC_RX)) // Handle received bytes (if any) + Serial.accept(); #endif // check whether the one-shot period has elapsed. if so, turn off the LED |