// ***************************************************************************** // ************** USB Class Specific Callback Function(s) ********************** // ***************************************************************************** /******************************************************************** * Function: void USBHIDCBSetReportHandler(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: USBHIDCBSetReportHandler() is used to respond to * the HID device class specific SET_REPORT control * transfer request (starts with SETUP packet on EP0 OUT). * Note: *******************************************************************/ void USBHIDCBSetReportHandler(void) { //Prepare to receive the keyboard LED state data through a SET_REPORT //control transfer on endpoint 0. The host should only send 1 byte, //since this is all that the report descriptor allows it to send. USBEP0Receive((BYTE*)&CtrlTrfData, USB_EP0_BUFF_SIZE, USBHIDCBSetReportComplete); } //Secondary callback function that gets called when the above //control transfer completes for the USBHIDCBSetReportHandler() void USBHIDCBSetReportComplete(void) { //1 byte of LED state data should now be in the CtrlTrfData buffer. //Num Lock LED state is in Bit0. if(CtrlTrfData[0] & 0x01) //Make LED1 and LED2 match Num Lock state. { led01 = 0; } else { led01 = 1; } } /** EOF Keyboard.c **********************************************/ #endif