diff options
author | Sandeep Mistry <s.mistry@arduino.cc> | 2016-04-14 10:06:47 -0400 |
---|---|---|
committer | Sandeep Mistry <s.mistry@arduino.cc> | 2016-04-14 10:06:47 -0400 |
commit | 5e3d08af24b6254cf5308b2a1c19491bcc92c608 (patch) | |
tree | 2b414645405c6c6ab1cdadff6b4c666a04bc0ea0 /cores | |
parent | 5e194bd8efe8dcd2fb6eaa13cec1a2a642c5254a (diff) |
Subtract one from USB_EP_SIZE in USB_SendSpace
This avoids dealing with ZLP’s in USB_Send, because the max packet size
will be EP size - 1.
Diffstat (limited to 'cores')
-rw-r--r-- | cores/arduino/USBCore.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp index 3c7da86..44dce72 100644 --- a/cores/arduino/USBCore.cpp +++ b/cores/arduino/USBCore.cpp @@ -255,7 +255,9 @@ u8 USB_SendSpace(u8 ep) LockEP lock(ep); if (!ReadWriteAllowed()) return 0; - return USB_EP_SIZE - FifoByteCount(); + // subtract 1 from the EP size to never send a full packet, + // this avoids dealing with ZLP's in USB_Send + return USB_EP_SIZE - 1 - FifoByteCount(); } // Blocking Send of data to an endpoint |