// ***************************************************************************** // ************** 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. { mLED_1_On(); //修正すること、この行と次の行を、led01 = 0; の1行に変更 mLED_2_On(); } else { mLED_1_Off(); //修正すること、この行と次の行を、led01 = 1; の1行に変更 mLED_2_Off(); } //Stop toggling the LEDs, so you can temporily see the Num lock LED state instead. //Once the CountdownTimerToShowUSBStatusOnLEDs reaches 0, the LEDs will go back to showing USB state instead. BlinkStatusValid = FALSE; CountdownTimerToShowUSBStatusOnLEDs = 140000; } /** EOF Keyboard.c **********************************************/ #endif