mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-20 14:54:31 +01:00
Added >64 byte USB_RecvControl() support
This commit is contained in:
parent
0b97e57b2c
commit
6367168925
@ -425,13 +425,24 @@ static bool USB_SendStringDescriptor(const u8*string_P, u8 string_len, uint8_t f
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Does not timeout or cross fifo boundaries
|
// Does not timeout or cross fifo boundaries
|
||||||
// Will only work for transfers <= 64 bytes
|
|
||||||
// TODO
|
|
||||||
int USB_RecvControl(void* d, int len)
|
int USB_RecvControl(void* d, int len)
|
||||||
{
|
{
|
||||||
WaitOUT();
|
auto length = len;
|
||||||
Recv((u8*)d,len);
|
while(length)
|
||||||
ClearOUT();
|
{
|
||||||
|
// Dont receive more than the USB Control EP has to offer
|
||||||
|
// Use fixed 64 because control EP always have 64 bytes even on 16u2.
|
||||||
|
auto recvLength = length;
|
||||||
|
if(recvLength > 64){
|
||||||
|
recvLength = 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write data to fit to the end (not the beginning) of the array
|
||||||
|
WaitOUT();
|
||||||
|
Recv((u8*)d + len - length, recvLength);
|
||||||
|
ClearOUT();
|
||||||
|
length -= recvLength;
|
||||||
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user