Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 817d700

Browse files
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.
1 parent c99ab12 commit 817d700

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎hardware/arduino/avr/cores/arduino/USBCore.cpp‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,9 @@ u8 USB_SendSpace(u8 ep)
255255
LockEP lock(ep);
256256
if (!ReadWriteAllowed())
257257
return 0;
258-
return USB_EP_SIZE - FifoByteCount();
258+
// subtract 1 from the EP size to never send a full packet,
259+
// this avoids dealing with ZLP's in USB_Send
260+
return USB_EP_SIZE - 1 - FifoByteCount();
259261
}
260262

261263
// Blocking Send of data to an endpoint

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /