\r
}\r
\r
-void CDC_Device_ProcessControlPacket(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo)\r
+void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo)\r
{\r
if (!(Endpoint_IsSETUPReceived()))\r
return;\r
if (!(Endpoint_IsReadWriteAllowed()))\r
{\r
Endpoint_ClearIN();\r
-\r
- while (!(Endpoint_IsReadWriteAllowed()))\r
- {\r
- if (USB_DeviceState == DEVICE_STATE_Unattached)\r
- return;\r
- }\r
+ Endpoint_WaitUntilReady();\r
} \r
\r
Endpoint_ClearIN();\r
if (!(Endpoint_IsReadWriteAllowed()))\r
{\r
Endpoint_ClearIN();\r
- \r
- while (!(Endpoint_IsReadWriteAllowed()))\r
- {\r
- if (USB_DeviceState == DEVICE_STATE_Unattached)\r
- return; \r
- }\r
+ Endpoint_WaitUntilReady();\r
}\r
\r
Endpoint_Write_Byte(Data); \r
{\r
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber);\r
\r
+ if (Endpoint_IsOUTReceived() && !(Endpoint_BytesInEndpoint()))\r
+ Endpoint_ClearOUT();\r
+\r
return Endpoint_BytesInEndpoint();\r
}\r
\r
.bRequest = NOTIF_SerialState,\r
.wValue = 0,\r
.wIndex = 0,\r
- .wLength = sizeof(uint16_t),\r
+ .wLength = sizeof(CDCInterfaceInfo->State.ControlLineStates.DeviceToHost),\r
};\r
\r
Endpoint_Write_Stream_LE(&Notification, sizeof(Notification), NO_STREAM_CALLBACK);\r
- Endpoint_Write_Stream_LE(&CDCInterfaceInfo->State.ControlLineStates.DeviceToHost, sizeof(uint8_t), NO_STREAM_CALLBACK);\r
+ Endpoint_Write_Stream_LE(&CDCInterfaceInfo->State.ControlLineStates.DeviceToHost,\r
+ sizeof(CDCInterfaceInfo->State.ControlLineStates.DeviceToHost),\r
+ NO_STREAM_CALLBACK);\r
Endpoint_ClearIN();\r
}\r
\r