From 6d1adf7339b71952d1ba8616af9422fbc7333eb1 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Tue, 25 Aug 2009 08:09:49 +0000 Subject: Updated Benito project -- added hardware interrupt and software buffering for serial data reception to prevent missed characters, condensed pulse generation counters into a struct for clarity. Added check to CDC_Device_BytesReceived() to ensure 0 is returned when device is not enumerated to a host. Move AVRISP project's V2Protocol_DelayMS() function to be static inline, as it is now very minimal. Added extra project doxygen documentation. --- LUFA/Drivers/USB/Class/Device/CDC.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'LUFA/Drivers/USB') diff --git a/LUFA/Drivers/USB/Class/Device/CDC.c b/LUFA/Drivers/USB/Class/Device/CDC.c index 003a6b31a..31fd8f1b0 100644 --- a/LUFA/Drivers/USB/Class/Device/CDC.c +++ b/LUFA/Drivers/USB/Class/Device/CDC.c @@ -174,6 +174,9 @@ uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) { + if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) + return 0; + Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber); if (Endpoint_IsOUTReceived() && !(Endpoint_BytesInEndpoint())) -- cgit v1.2.3