X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/fb0e6597b611731e31b5d1285e52fc81a5ffd559..ff09cf9c73bbc2623a8c1420918747840382cc5b:/LUFA/Drivers/USB/Class/Device/CDC.c diff --git a/LUFA/Drivers/USB/Class/Device/CDC.c b/LUFA/Drivers/USB/Class/Device/CDC.c index 026ac269a..39154608e 100644 --- a/LUFA/Drivers/USB/Class/Device/CDC.c +++ b/LUFA/Drivers/USB/Class/Device/CDC.c @@ -133,7 +133,7 @@ void CDC_Device_USBTask(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) } uint8_t CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, - char* const Data, + const char* const Data, const uint16_t Length) { if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) @@ -219,20 +219,21 @@ uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterface int16_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) { - uint8_t ReceivedByte = -1; - if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) - return 0; + return -1; + + int16_t ReceivedByte = -1; Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber); - if (!(Endpoint_IsOUTReceived())) - return -1; - else if (Endpoint_BytesInEndpoint()) - ReceivedByte = Endpoint_Read_Byte(); + if (Endpoint_IsOUTReceived()) + { + if (Endpoint_BytesInEndpoint()) + ReceivedByte = Endpoint_Read_Byte(); - if (!(Endpoint_BytesInEndpoint())) - Endpoint_ClearOUT(); + if (!(Endpoint_BytesInEndpoint())) + Endpoint_ClearOUT(); + } return ReceivedByte; }