diff options
Diffstat (limited to 'LUFA/Drivers/USB/HighLevel/Template')
4 files changed, 23 insertions, 22 deletions
diff --git a/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_R.c b/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_R.c index c8bfaeb70..5cc11d7fe 100644 --- a/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_R.c +++ b/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_R.c @@ -2,10 +2,10 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer, uint16_t Length) { uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); - + if (!(Length)) Endpoint_ClearOUT(); - + while (Length) { uint8_t USB_DeviceState_LCL = USB_DeviceState; @@ -16,7 +16,7 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer, return ENDPOINT_RWCSTREAM_BusSuspended; else if (Endpoint_IsSETUPReceived()) return ENDPOINT_RWCSTREAM_HostAborted; - + if (Endpoint_IsOUTReceived()) { while (Length && Endpoint_BytesInEndpoint()) @@ -24,11 +24,11 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer, TEMPLATE_TRANSFER_BYTE(DataStream); Length--; } - + Endpoint_ClearOUT(); - } + } } - + while (!(Endpoint_IsINReady())) { uint8_t USB_DeviceState_LCL = USB_DeviceState; @@ -38,11 +38,11 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer, else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) return ENDPOINT_RWCSTREAM_BusSuspended; } - + return ENDPOINT_RWCSTREAM_NoError; } #undef TEMPLATE_BUFFER_OFFSET #undef TEMPLATE_FUNC_NAME -#undef TEMPLATE_TRANSFER_BYTE
\ No newline at end of file +#undef TEMPLATE_TRANSFER_BYTE diff --git a/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_W.c b/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_W.c index 0ae7febc4..16fe3999b 100644 --- a/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_W.c +++ b/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_W.c @@ -3,7 +3,7 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer, { uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); bool LastPacketFull = false; - + if (Length > USB_ControlRequest.wLength) Length = USB_ControlRequest.wLength; else if (!(Length)) @@ -12,7 +12,7 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer, while (Length || LastPacketFull) { uint8_t USB_DeviceState_LCL = USB_DeviceState; - + if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) return ENDPOINT_RWCSTREAM_DeviceDisconnected; else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) @@ -25,19 +25,19 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer, if (Endpoint_IsINReady()) { uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint(); - + while (Length && (BytesInEndpoint < USB_ControlEndpointSize)) { TEMPLATE_TRANSFER_BYTE(DataStream); Length--; BytesInEndpoint++; } - + LastPacketFull = (BytesInEndpoint == USB_ControlEndpointSize); Endpoint_ClearIN(); } } - + while (!(Endpoint_IsOUTReceived())) { uint8_t USB_DeviceState_LCL = USB_DeviceState; @@ -53,4 +53,4 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer, #undef TEMPLATE_BUFFER_OFFSET #undef TEMPLATE_FUNC_NAME -#undef TEMPLATE_TRANSFER_BYTE
\ No newline at end of file +#undef TEMPLATE_TRANSFER_BYTE diff --git a/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_RW.c b/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_RW.c index fc9df951d..6657f38eb 100644 --- a/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_RW.c +++ b/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_RW.c @@ -4,7 +4,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer, { uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); uint8_t ErrorCode; - + if ((ErrorCode = Endpoint_WaitUntilReady())) return ErrorCode; @@ -34,7 +34,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer, } Length -= 8; - + TEMPLATE_TRANSFER_BYTE(DataStream); case 7: TEMPLATE_TRANSFER_BYTE(DataStream); case 6: TEMPLATE_TRANSFER_BYTE(DataStream); @@ -43,7 +43,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer, case 3: TEMPLATE_TRANSFER_BYTE(DataStream); case 2: TEMPLATE_TRANSFER_BYTE(DataStream); case 1: TEMPLATE_TRANSFER_BYTE(DataStream); - } while (Length >= 8); + } while (Length >= 8); } } #endif @@ -76,4 +76,4 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer, #undef TEMPLATE_BUFFER_TYPE #undef TEMPLATE_TRANSFER_BYTE #undef TEMPLATE_CLEAR_ENDPOINT -#undef TEMPLATE_BUFFER_OFFSET
\ No newline at end of file +#undef TEMPLATE_BUFFER_OFFSET diff --git a/LUFA/Drivers/USB/HighLevel/Template/Template_Pipe_RW.c b/LUFA/Drivers/USB/HighLevel/Template/Template_Pipe_RW.c index fb64dd837..a998469d2 100644 --- a/LUFA/Drivers/USB/HighLevel/Template/Template_Pipe_RW.c +++ b/LUFA/Drivers/USB/HighLevel/Template/Template_Pipe_RW.c @@ -4,7 +4,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer, { uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); uint8_t ErrorCode; - + Pipe_SetPipeToken(TEMPLATE_TOKEN); if ((ErrorCode = Pipe_WaitUntilReady())) @@ -36,7 +36,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer, } Length -= 8; - + TEMPLATE_TRANSFER_BYTE(DataStream); case 7: TEMPLATE_TRANSFER_BYTE(DataStream); case 6: TEMPLATE_TRANSFER_BYTE(DataStream); @@ -45,7 +45,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer, case 3: TEMPLATE_TRANSFER_BYTE(DataStream); case 2: TEMPLATE_TRANSFER_BYTE(DataStream); case 1: TEMPLATE_TRANSFER_BYTE(DataStream); - } while (Length >= 8); + } while (Length >= 8); } } #endif @@ -70,7 +70,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer, Length--; } } - + return PIPE_RWSTREAM_NoError; } @@ -80,3 +80,4 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer, #undef TEMPLATE_TRANSFER_BYTE #undef TEMPLATE_CLEAR_PIPE #undef TEMPLATE_BUFFER_OFFSET + |