X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/8f6b4ddf764c3a54e42d00a7502c82c5c3e71b1c..526e398986583e2fb65c0a36a2fbf2ce153446e5:/Demos/Device/GenericHID/GenericHID.c diff --git a/Demos/Device/GenericHID/GenericHID.c b/Demos/Device/GenericHID/GenericHID.c index a9ecfa7d7..695342d0e 100644 --- a/Demos/Device/GenericHID/GenericHID.c +++ b/Demos/Device/GenericHID/GenericHID.c @@ -40,11 +40,11 @@ TASK_LIST { #if !defined(INTERRUPT_CONTROL_ENDPOINT) - { Task: USB_USBTask , TaskStatus: TASK_STOP }, + { .Task = USB_USBTask , .TaskStatus = TASK_STOP }, #endif #if !defined(INTERRUPT_DATA_ENDPOINT) - { Task: USB_HID_Report , TaskStatus: TASK_STOP }, + { .Task = USB_HID_Report , .TaskStatus = TASK_STOP }, #endif }; @@ -160,47 +160,47 @@ EVENT_HANDLER(USB_ConfigurationChanged) EVENT_HANDLER(USB_UnhandledControlPacket) { /* Handle HID Class specific requests */ - switch (bRequest) + switch (USB_ControlRequest.bRequest) { case REQ_GetReport: - if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) + if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) { - Endpoint_ClearControlSETUP(); - uint8_t GenericData[GENERIC_REPORT_SIZE]; - + + Endpoint_ClearSETUP(); + CreateGenericHIDReport(GenericData); /* Write the report data to the control endpoint */ Endpoint_Write_Control_Stream_LE(&GenericData, sizeof(GenericData)); /* Finalize the stream transfer to send the last packet or clear the host abort */ - Endpoint_ClearControlOUT(); + Endpoint_ClearOUT(); } break; case REQ_SetReport: - if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) + if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { - Endpoint_ClearControlSETUP(); + uint8_t GenericData[GENERIC_REPORT_SIZE]; + + Endpoint_ClearSETUP(); /* Wait until the generic report has been sent by the host */ while (!(Endpoint_IsOUTReceived())); - uint8_t GenericData[GENERIC_REPORT_SIZE]; - Endpoint_Read_Control_Stream_LE(&GenericData, sizeof(GenericData)); ProcessGenericHIDReport(GenericData); /* Clear the endpoint data */ - Endpoint_ClearControlOUT(); + Endpoint_ClearOUT(); /* Wait until the host is ready to receive the request confirmation */ while (!(Endpoint_IsINReady())); /* Handshake the request by sending an empty IN packet */ - Endpoint_ClearControlIN(); + Endpoint_ClearIN(); } break;