diff options
Diffstat (limited to 'LUFA')
-rw-r--r-- | LUFA/Drivers/USB/Class/Device/CDC.c | 21 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Device/CDC.h | 2 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/CDC.c | 28 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/CDC.h | 2 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/RNDIS.c | 6 | ||||
-rw-r--r-- | LUFA/ManPages/LUFAPoweredProjects.txt | 1 |
6 files changed, 28 insertions, 32 deletions
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; } diff --git a/LUFA/Drivers/USB/Class/Device/CDC.h b/LUFA/Drivers/USB/Class/Device/CDC.h index 3ada8f7af..1b0b86810 100644 --- a/LUFA/Drivers/USB/Class/Device/CDC.h +++ b/LUFA/Drivers/USB/Class/Device/CDC.h @@ -214,7 +214,7 @@ * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. */ uint8_t CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, - char* const Data, + const char* const Data, const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); /** Sends a given byte to the attached USB host, if connected. If a host is not connected when the function is called, the diff --git a/LUFA/Drivers/USB/Class/Host/CDC.c b/LUFA/Drivers/USB/Class/Host/CDC.c index 5fb232c09..b9e4c9ebf 100644 --- a/LUFA/Drivers/USB/Class/Host/CDC.c +++ b/LUFA/Drivers/USB/Class/Host/CDC.c @@ -205,7 +205,6 @@ void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) return; Pipe_SelectPipe(CDCInterfaceInfo->Config.NotificationPipeNumber); - Pipe_SetPipeToken(PIPE_TOKEN_IN); Pipe_Unfreeze(); if (Pipe_IsINReceived()) @@ -285,7 +284,7 @@ uint8_t CDC_Host_SendBreak(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, } uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, - char* const Data, + const char* const Data, const uint16_t Length) { if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive)) @@ -333,7 +332,6 @@ uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo return 0; Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber); - Pipe_SetPipeToken(PIPE_TOKEN_IN); Pipe_Unfreeze(); if (Pipe_IsINReceived()) @@ -360,25 +358,25 @@ uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo int16_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) { - uint8_t ReceivedByte = -1; - if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive)) - return 0; + return -1; + int16_t ReceivedByte = -1; + Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber); - Pipe_SetPipeToken(PIPE_TOKEN_IN); Pipe_Unfreeze(); - if (!(Pipe_IsINReceived())) - return -1; - else if (Pipe_BytesInPipe()) - ReceivedByte = Pipe_Read_Byte(); + if (Pipe_IsINReceived()) + { + if (Pipe_BytesInPipe()) + ReceivedByte = Pipe_Read_Byte(); - if (!(Pipe_BytesInPipe())) - Pipe_ClearIN(); - - Pipe_Freeze(); + if (!(Pipe_BytesInPipe())) + Pipe_ClearIN(); + } + Pipe_Freeze(); + return ReceivedByte; } diff --git a/LUFA/Drivers/USB/Class/Host/CDC.h b/LUFA/Drivers/USB/Class/Host/CDC.h index 56bcf3147..3e9d055e4 100644 --- a/LUFA/Drivers/USB/Class/Host/CDC.h +++ b/LUFA/Drivers/USB/Class/Host/CDC.h @@ -217,7 +217,7 @@ * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, - char* const Data, + const char* const Data, const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); /** Sends a given byte to the attached USB device, if connected. If a device is not connected when the function is called, the diff --git a/LUFA/Drivers/USB/Class/Host/RNDIS.c b/LUFA/Drivers/USB/Class/Host/RNDIS.c index b189535f0..cddd5cbb5 100644 --- a/LUFA/Drivers/USB/Class/Host/RNDIS.c +++ b/LUFA/Drivers/USB/Class/Host/RNDIS.c @@ -386,12 +386,9 @@ bool RNDIS_Host_IsPacketReceived(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfac return false; Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipeNumber); - Pipe_SetPipeToken(PIPE_TOKEN_IN); Pipe_Unfreeze(); - - PacketWaiting = Pipe_IsINReceived(); - + PacketWaiting = Pipe_IsINReceived(); Pipe_Freeze(); return PacketWaiting; @@ -407,7 +404,6 @@ uint8_t RNDIS_Host_ReadPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn return PIPE_READYWAIT_DeviceDisconnected; Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipeNumber); - Pipe_SetPipeToken(PIPE_TOKEN_IN); Pipe_Unfreeze(); if (!(Pipe_IsReadWriteAllowed())) diff --git a/LUFA/ManPages/LUFAPoweredProjects.txt b/LUFA/ManPages/LUFAPoweredProjects.txt index bc3935302..abb0e02dd 100644 --- a/LUFA/ManPages/LUFAPoweredProjects.txt +++ b/LUFA/ManPages/LUFAPoweredProjects.txt @@ -61,6 +61,7 @@ * - SD Card reader: http://elasticsheep.com/2010/04/teensy2-usb-mass-storage-with-an-sd-card/ * - SEGA Megadrive/Genesis Development Cartridge: http://www.makestuff.eu/wordpress/?page_id=398 * - Stripe Snoop, a Magnetic Card reader: http://www.ossguy.com/ss_usb/ + * - Touchscreen Input Device: http://capnstech.blogspot.com/2010/07/touchscreen-update.html * - USB Interface for Playstation Portable Devices: http://forums.ps2dev.org/viewtopic.php?t=11001 * - Userial, a USB to Serial converter with SPI, I2C and other protocols: http://www.tty1.net/userial/ * - XUM1541, a Commodore 64 floppy drive to USB adapter: http://www.root.org/~nate/c64/xum1541/ |