X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/b5ca3990c2ec9dc240fb334002ed2f7c82eea853..1d26e78258c10dcca63e31e66732f1e525b5dade:/Demos/Host/LowLevel/StillImageHost/StillImageHost.c diff --git a/Demos/Host/LowLevel/StillImageHost/StillImageHost.c b/Demos/Host/LowLevel/StillImageHost/StillImageHost.c index a337ab045..0f511ad7a 100644 --- a/Demos/Host/LowLevel/StillImageHost/StillImageHost.c +++ b/Demos/Host/LowLevel/StillImageHost/StillImageHost.c @@ -149,7 +149,7 @@ void StillImage_Task(void) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); /* Wait until USB device disconnected */ - while (USB_IsConnected); + USB_HostState = HOST_STATE_WaitForDeviceRemoval; break; } @@ -162,7 +162,7 @@ void StillImage_Task(void) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); /* Wait until USB device disconnected */ - while (USB_IsConnected); + USB_HostState = HOST_STATE_WaitForDeviceRemoval; break; } @@ -195,6 +195,8 @@ void StillImage_Task(void) if ((ErrorCode = SImage_RecieveBlockHeader()) != PIPE_RWSTREAM_NoError) { ShowCommandError(ErrorCode, false); + + USB_HostState = HOST_STATE_WaitForDeviceRemoval; break; } @@ -246,6 +248,8 @@ void StillImage_Task(void) if ((ErrorCode = SImage_RecieveBlockHeader()) != PIPE_RWSTREAM_NoError) { ShowCommandError(ErrorCode, false); + + USB_HostState = HOST_STATE_WaitForDeviceRemoval; break; } @@ -253,6 +257,8 @@ void StillImage_Task(void) if ((PIMA_ReceivedBlock.Type != CType_ResponseBlock) || (PIMA_ReceivedBlock.Code != PIMA_RESPONSE_OK)) { ShowCommandError(PIMA_ReceivedBlock.Code, true); + + USB_HostState = HOST_STATE_WaitForDeviceRemoval; break; } @@ -274,6 +280,8 @@ void StillImage_Task(void) if ((ErrorCode = SImage_RecieveBlockHeader()) != PIPE_RWSTREAM_NoError) { ShowCommandError(ErrorCode, false); + + USB_HostState = HOST_STATE_WaitForDeviceRemoval; break; } @@ -281,6 +289,8 @@ void StillImage_Task(void) if ((PIMA_ReceivedBlock.Type != CType_ResponseBlock) || (PIMA_ReceivedBlock.Code != PIMA_RESPONSE_OK)) { ShowCommandError(PIMA_ReceivedBlock.Code, true); + + USB_HostState = HOST_STATE_WaitForDeviceRemoval; break; } @@ -302,6 +312,8 @@ void StillImage_Task(void) if ((ErrorCode = SImage_RecieveBlockHeader()) != PIPE_RWSTREAM_NoError) { ShowCommandError(ErrorCode, false); + + USB_HostState = HOST_STATE_WaitForDeviceRemoval; break; } @@ -309,6 +321,8 @@ void StillImage_Task(void) if ((PIMA_ReceivedBlock.Type != CType_ResponseBlock) || (PIMA_ReceivedBlock.Code != PIMA_RESPONSE_OK)) { ShowCommandError(PIMA_ReceivedBlock.Code, true); + + USB_HostState = HOST_STATE_WaitForDeviceRemoval; break; } @@ -327,8 +341,8 @@ void StillImage_Task(void) /** Function to convert a given Unicode encoded string to ASCII. This function will only work correctly on Unicode * strings which contain ASCII printable characters only. * - * \param UnicodeString Pointer to a Unicode encoded input string - * \param Buffer Pointer to a buffer where the converted ASCII string should be stored + * \param[in] UnicodeString Pointer to a Unicode encoded input string + * \param[out] Buffer Pointer to a buffer where the converted ASCII string should be stored */ void UnicodeToASCII(uint8_t* UnicodeString, char* Buffer) { @@ -351,8 +365,8 @@ void UnicodeToASCII(uint8_t* UnicodeString, char* Buffer) /** Displays a PIMA command error via the device's serial port. * - * \param ErrorCode Error code of the function which failed to complete successfully - * \param ResponseCodeError Indicates if the error is due to a command failed indication from the device, or a communication failure + * \param[in] ErrorCode Error code of the function which failed to complete successfully + * \param[in] ResponseCodeError Indicates if the error is due to a command failed indication from the device, or a communication failure */ void ShowCommandError(uint8_t ErrorCode, bool ResponseCodeError) { @@ -363,7 +377,4 @@ void ShowCommandError(uint8_t ErrorCode, bool ResponseCodeError) /* Indicate error via status LEDs */ LEDs_SetAllLEDs(LEDMASK_USB_ERROR); - - /* Wait until USB device disconnected */ - while (USB_IsConnected); }