USB_Init();\r
}\r
\r
+/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and\r
+ * starts the library USB task to begin the enumeration and USB management process.\r
+ */\r
void EVENT_USB_Device_Connect(void)\r
{\r
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
}\r
\r
+/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
+ * the status LEDs and stops the USB management and CDC management tasks.\r
+ */\r
void EVENT_USB_Device_Disconnect(void)\r
{\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
}\r
\r
+/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration\r
+ * of the USB device after enumeration - the device endpoints are configured and the CDC management task started.\r
+ */\r
void EVENT_USB_Device_ConfigurationChanged(void)\r
{\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
}\r
}\r
\r
+/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific\r
+ * control requests that are not handled internally by the USB library (including the CDC control commands,\r
+ * which are all issued via the control endpoint), so that they can be handled appropriately for the application.\r
+ */\r
void EVENT_USB_Device_UnhandledControlRequest(void)\r
{\r
uint8_t TMCRequestStatus = TMC_REQUEST_STATUS_SUCCESS;\r
\r
+ /* Process TMC specific control requests */\r
switch (USB_ControlRequest.bRequest)\r
{\r
case Req_InitiateAbortBulkOut:\r
{\r
Endpoint_ClearSETUP();\r
\r
+ /* Check that no split transaction is already in progress and the data OUT transfer tag is valid */\r
if (RequestInProgess != 0)\r
{\r
TMCRequestStatus = TMC_REQUEST_STATUS_SPLIT_IN_PROGRESS;\r
{\r
Endpoint_ClearSETUP();\r
\r
+ /* Check that an ABORT BULK OUT transaction has been requested and that the request has completed */\r
if (RequestInProgess != Req_InitiateAbortBulkOut)\r
TMCRequestStatus = TMC_REQUEST_STATUS_SPLIT_NOT_IN_PROGRESS; \r
else if (IsTMCBulkOUTReset)\r
{\r
Endpoint_ClearSETUP();\r
\r
+ /* Check that no split transaction is already in progress and the data IN transfer tag is valid */\r
if (RequestInProgess != 0)\r
{\r
TMCRequestStatus = TMC_REQUEST_STATUS_SPLIT_IN_PROGRESS; \r
{\r
Endpoint_ClearSETUP();\r
\r
+ /* Check that an ABORT BULK IN transaction has been requested and that the request has completed */\r
if (RequestInProgess != Req_InitiateAbortBulkIn)\r
TMCRequestStatus = TMC_REQUEST_STATUS_SPLIT_NOT_IN_PROGRESS;\r
else if (IsTMCBulkINReset)\r
{\r
Endpoint_ClearSETUP();\r
\r
+ /* Check that no split transaction is already in progress */\r
if (RequestInProgess != 0)\r
{\r
Endpoint_Write_Byte(TMC_REQUEST_STATUS_SPLIT_IN_PROGRESS); \r
{\r
Endpoint_ClearSETUP();\r
\r
+ /* Check that a CLEAR transaction has been requested and that the request has completed */\r
if (RequestInProgess != Req_InitiateClear)\r
TMCRequestStatus = TMC_REQUEST_STATUS_SPLIT_NOT_IN_PROGRESS; \r
else if (IsTMCBulkINReset || IsTMCBulkOUTReset)\r
break;\r
}\r
}\r
- \r
+\r
+/** Function to manage TMC data transmission and reception to and from the host. */\r
void TMC_Task(void)\r
{\r
/* Device must be connected and configured for the task to run */\r