- /*\r
- This is where you need to create reports to be sent to the host from the device. This\r
- function is called each time the host is ready to accept a new report. DataArray is \r
- an array to hold the report to the host.\r
- */\r
-\r
- for (uint8_t i = 0; i < GENERIC_REPORT_SIZE; i++)\r
- DataArray[i] = LastReceived[i];\r
-}\r
-\r
-TASK(USB_HID_Report)\r
-{\r
- /* Check if the USB system is connected to a host */\r
- if (USB_IsConnected)\r
- {\r
- Endpoint_SelectEndpoint(GENERIC_OUT_EPNUM);\r
- \r
- /* Check to see if a packet has been sent from the host */\r
- if (Endpoint_IsOUTReceived())\r
- {\r
- /* Check to see if the packet contains data */\r
- if (Endpoint_IsReadWriteAllowed())\r
- {\r
- /* Create a temporary buffer to hold the read in report from the host */\r
- uint8_t GenericData[GENERIC_REPORT_SIZE];\r
- \r
- /* Read Generic Report Data */\r
- Endpoint_Read_Stream_LE(&GenericData, sizeof(GenericData));\r
- \r
- /* Process Generic Report Data */\r
- ProcessGenericHIDReport(GenericData);\r
- }\r
-\r
- /* Finalize the stream transfer to send the last packet */\r
- Endpoint_ClearOUT();\r
- } \r
-\r
- Endpoint_SelectEndpoint(GENERIC_IN_EPNUM);\r
- \r
- /* Check to see if the host is ready to accept another packet */\r
- if (Endpoint_IsINReady())\r
- {\r
- /* Create a temporary buffer to hold the report to send to the host */\r
- uint8_t GenericData[GENERIC_REPORT_SIZE];\r
- \r
- /* Create Generic Report Data */\r
- CreateGenericHIDReport(GenericData);\r
-\r
- /* Write Generic Report Data */\r
- Endpoint_Write_Stream_LE(&GenericData, sizeof(GenericData));\r
-\r
- /* Finalize the stream transfer to send the last packet */\r
- Endpoint_ClearIN();\r
- }\r
- }\r