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.
This commit is contained in:
Sandeep Mistry 2016-04-14 10:06:47 -04:00
parent c99ab12446
commit 817d700a75
1 changed files with 3 additions and 1 deletions

View File

@ -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