X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/37b2130fb2767a39f3d95414c6aca75a67c26298..eeba38e343a299e12964aec15fd43108d3dc9130:/Demos/Host/GenericHIDHost/GenericHIDHost.c?ds=inline diff --git a/Demos/Host/GenericHIDHost/GenericHIDHost.c b/Demos/Host/GenericHIDHost/GenericHIDHost.c index f0d196768..580612c97 100644 --- a/Demos/Host/GenericHIDHost/GenericHIDHost.c +++ b/Demos/Host/GenericHIDHost/GenericHIDHost.c @@ -182,10 +182,8 @@ void ReadNextReport(void) /* Check to see if a packet has been received */ if (!(Pipe_IsINReceived())) { - #if !defined(INTERRUPT_DATA_PIPE) /* Refreeze HID data IN pipe */ Pipe_Freeze(); - #endif return; } @@ -208,10 +206,8 @@ void ReadNextReport(void) /* Clear the IN endpoint, ready for next data packet */ Pipe_ClearIN(); - #if !defined(INTERRUPT_DATA_PIPE) /* Refreeze HID data IN pipe */ Pipe_Freeze(); - #endif } /** Writes a report to the attached device. @@ -257,7 +253,7 @@ void WriteNextReport(uint8_t* ReportOUTData, uint8_t ReportIndex, uint8_t Report else { /* Class specific request to send a HID report to the device */ - USB_HostRequest = (USB_Host_Request_Header_t) + USB_ControlRequest = (USB_Request_Header_t) { .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), .bRequest = REQ_SetReport, @@ -286,7 +282,7 @@ TASK(USB_HID_Host) { case HOST_STATE_Addressed: /* Standard request to set the device configuration to configuration 1 */ - USB_HostRequest = (USB_Host_Request_Header_t) + USB_ControlRequest = (USB_Request_Header_t) { .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE), .bRequest = REQ_SetConfiguration, @@ -335,53 +331,13 @@ TASK(USB_HID_Host) break; } - #if defined(INTERRUPT_DATA_PIPE) - /* Select and unfreeze HID data IN pipe */ - Pipe_SelectPipe(HID_DATA_IN_PIPE); - Pipe_Unfreeze(); - #endif - puts_P(PSTR("HID Device Enumerated.\r\n")); USB_HostState = HOST_STATE_Ready; break; - #if !defined(INTERRUPT_DATA_PIPE) case HOST_STATE_Ready: ReadNextReport(); break; - #endif - } -} - -#if defined(INTERRUPT_DATA_PIPE) -/** Interrupt handler for the Endpoint/Pipe interrupt vector. This interrupt fires each time an enabled - * pipe interrupt occurs on a pipe which has had that interrupt enabled. - */ -ISR(ENDPOINT_PIPE_vect, ISR_BLOCK) -{ - /* Save previously selected pipe before selecting a new pipe */ - uint8_t PrevSelectedPipe = Pipe_GetCurrentPipe(); - - /* Check to see if the HID data IN pipe has caused the interrupt */ - if (Pipe_HasPipeInterrupted(HID_DATA_IN_PIPE)) - { - /* Clear the pipe interrupt, and select the data IN pipe */ - Pipe_ClearPipeInterrupt(HID_DATA_IN_PIPE); - Pipe_SelectPipe(HID_DATA_IN_PIPE); - - /* Check to see if the pipe IN interrupt has fired */ - if (USB_INT_HasOccurred(PIPE_INT_IN) && USB_INT_IsEnabled(PIPE_INT_IN)) - { - /* Clear interrupt flag */ - USB_INT_Clear(PIPE_INT_IN); - - /* Read and process the next report from the device */ - ReadNextReport(); - } } - - /* Restore previously selected pipe */ - Pipe_SelectPipe(PrevSelectedPipe); } -#endif