X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/8a68203d3451c50c573c6baf4850e72d8dbabfcb..31d8ebebc0796873f7c70db80a04acdcbb307ed8:/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c diff --git a/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c b/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c index c0a9575f4..970df4f87 100644 --- a/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c +++ b/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c @@ -133,7 +133,7 @@ uint8_t SImage_RecieveBlockHeader(void) if (Pipe_IsStalled()) { /* Clear the stall condition on the OUT pipe */ - SImage_ClearPipeStall(SIMAGE_DATA_OUT_PIPE); + USB_Host_ClearPipeStall(SIMAGE_DATA_OUT_PIPE); /* Return error code and break out of the loop */ return PIPE_RWSTREAM_PipeStalled; @@ -145,19 +145,16 @@ uint8_t SImage_RecieveBlockHeader(void) if (Pipe_IsStalled()) { /* Clear the stall condition on the IN pipe */ - SImage_ClearPipeStall(SIMAGE_DATA_IN_PIPE); + USB_Host_ClearPipeStall(SIMAGE_DATA_IN_PIPE); /* Return error code */ return PIPE_RWSTREAM_PipeStalled; } /* Check to see if the device was disconnected, if so exit function */ - if (!(USB_IsConnected)) - { - /* Return error code */ - return PIPE_RWSTREAM_DeviceDisconnected; - } - }; + if (USB_HostState == HOST_STATE_Unattached) + return PIPE_RWSTREAM_DeviceDisconnected; + } /* Freeze OUT pipe after use */ Pipe_SelectPipe(SIMAGE_DATA_OUT_PIPE); @@ -262,26 +259,3 @@ bool SImage_IsEventReceived(void) return IsEventReceived; } - -/** Clears the stall condition in the attached device on the nominated endpoint number. - * - * \param[in] EndpointNum Endpoint number in the attached device whose stall condition is to be cleared - * - * \return A value from the USB_Host_SendControlErrorCodes_t enum - */ -uint8_t SImage_ClearPipeStall(const uint8_t EndpointNum) -{ - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_ENDPOINT), - .bRequest = REQ_ClearFeature, - .wValue = FEATURE_ENDPOINT_HALT, - .wIndex = EndpointNum, - .wLength = 0, - }; - - /* Select the control pipe for the request transfer */ - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - return USB_Host_SendControlRequest(NULL); -}