diff options
author | Cristian Maglie <c.maglie@bug.st> | 2014-05-24 01:00:04 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2014-05-26 13:38:07 +0200 |
commit | 2fd1c5b42898b8844a4e6ccea1be9f758e956bc7 (patch) | |
tree | fc5e95b73bf90aaf30ce62128d9e1329d546a09c /cores/arduino/USBCore.cpp | |
parent | 1ee86b6bcb94961ffd8422820dc721d1b17434a7 (diff) | |
parent | 5962f155f70a5c67d14280d1b178f5197fb00df4 (diff) |
Merge branch 'usbcdc-improved' into ide-1.5.x
Diffstat (limited to 'cores/arduino/USBCore.cpp')
-rw-r--r-- | cores/arduino/USBCore.cpp | 7 |
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 |