Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Enhanced USBD_Recv
  • Loading branch information
sined23 authored and facchinm committed Jan 24, 2017
commit d4aef4c3a06e3d0b4c57b1ee4e0e9f9b223362fb
9 changes: 3 additions & 6 deletions cores/arduino/USB/USBCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,9 @@ uint32_t USBD_Recv(uint32_t ep, void* d, uint32_t len)
return -1;

LockEP lock(ep);
uint32_t n = UDD_FifoByteCount(ep & 0xF);
len = min(n,len);
n = len;
uint8_t* dst = (uint8_t*)d;
while (n--)
*dst++ = UDD_Recv8(ep & 0xF);
len = min(UDD_FifoByteCount(ep & 0xF),len);
uint8_t* dst = (uint8_t*)d;
UDD_Recv(ep & 0xF, dst, len);
if (len && !UDD_FifoByteCount(ep & 0xF)) // release empty buffer
UDD_ReleaseRX(ep & 0xF);

Expand Down