Added new EEPROM and FLASH buffer versions of the Endpoint and Pipe stream functions...
[pub/USBasp.git] / LUFA / Drivers / USB / LowLevel / Template / Template_Endpoint_Control_R.c
1 uint8_t TEMPLATE_FUNC_NAME (void* Buffer, uint16_t Length)
2 {
3 uint8_t* DataStream = (uint8_t*)(Buffer + TEMPLATE_BUFFER_OFFSET(Length));
4
5 while (Length)
6 {
7 if (Endpoint_IsOUTReceived())
8 {
9 while (Length && Endpoint_BytesInEndpoint())
10 {
11 TEMPLATE_TRANSFER_BYTE(DataStream);
12 Length--;
13 }
14
15 Endpoint_ClearOUT();
16 }
17 }
18
19 while (!(Endpoint_IsINReady()));
20
21 return ENDPOINT_RWCSTREAM_NoError;
22 }
23
24
25 #undef TEMPLATE_BUFFER_OFFSET
26 #undef TEMPLATE_FUNC_NAME
27 #undef TEMPLATE_TRANSFER_BYTE