aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/USBCore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cores/arduino/USBCore.cpp')
-rw-r--r--cores/arduino/USBCore.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp
index 9eb7b33..39a9530 100644
--- a/cores/arduino/USBCore.cpp
+++ b/cores/arduino/USBCore.cpp
@@ -289,9 +289,12 @@ int USB_Send(u8 ep, const void* d, int len)
if (n > len)
n = len;
- len -= n;
{
LockEP lock(ep);
+ // Frame may have been released by the SOF interrupt handler
+ if (!ReadWriteAllowed())
+ continue;
+ len -= n;
if (ep & TRANSFER_ZERO)
{
while (n--)
@@ -627,8 +630,6 @@ ISR(USB_GEN_vect)
{
#ifdef CDC_ENABLED
USB_Flush(CDC_TX); // Send a tx frame if found
- if (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