diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2011-10-07 03:47:42 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2011-10-07 03:47:42 +0000 |
commit | 2ae41fb15322c92e4cbb7578c1fac23904f1209e (patch) | |
tree | e9a30f9972f8d0030d774ffbe33086cc9a517596 /LUFA/Drivers/USB | |
parent | 3bb8055459778a834794fab484af350ea7ae0725 (diff) | |
download | lufa-2ae41fb15322c92e4cbb7578c1fac23904f1209e.tar.gz lufa-2ae41fb15322c92e4cbb7578c1fac23904f1209e.tar.bz2 lufa-2ae41fb15322c92e4cbb7578c1fac23904f1209e.zip |
Added endian-correction to the CDC driver's Line Encoding control request handlers.
Diffstat (limited to 'LUFA/Drivers/USB')
-rw-r--r-- | LUFA/Drivers/USB/Class/Device/CDC.c | 16 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/UC3/Device_UC3.h | 2 |
2 files changed, 13 insertions, 5 deletions
diff --git a/LUFA/Drivers/USB/Class/Device/CDC.c b/LUFA/Drivers/USB/Class/Device/CDC.c index da880abd8..dc8c1e7a6 100644 --- a/LUFA/Drivers/USB/Class/Device/CDC.c +++ b/LUFA/Drivers/USB/Class/Device/CDC.c @@ -51,8 +51,12 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); - Endpoint_Write_Control_Stream_LE(&CDCInterfaceInfo->State.LineEncoding, sizeof(CDCInterfaceInfo->State.LineEncoding)); - Endpoint_ClearOUT(); + Endpoint_Write_32_LE(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS); + Endpoint_Write_8(CDCInterfaceInfo->State.LineEncoding.CharFormat); + Endpoint_Write_8(CDCInterfaceInfo->State.LineEncoding.ParityType); + Endpoint_Write_8(CDCInterfaceInfo->State.LineEncoding.DataBits); + Endpoint_ClearIN(); + Endpoint_ClearStatusStage(); } break; @@ -60,8 +64,12 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); - Endpoint_Read_Control_Stream_LE(&CDCInterfaceInfo->State.LineEncoding, sizeof(CDCInterfaceInfo->State.LineEncoding)); - Endpoint_ClearIN(); + CDCInterfaceInfo->State.LineEncoding.BaudRateBPS = Endpoint_Read_32_LE(); + CDCInterfaceInfo->State.LineEncoding.CharFormat = Endpoint_Read_8(); + CDCInterfaceInfo->State.LineEncoding.ParityType = Endpoint_Read_8(); + CDCInterfaceInfo->State.LineEncoding.DataBits = Endpoint_Read_8(); + Endpoint_ClearOUT(); + Endpoint_ClearStatusStage(); EVENT_CDC_Device_LineEncodingChanged(CDCInterfaceInfo); } diff --git a/LUFA/Drivers/USB/Core/UC3/Device_UC3.h b/LUFA/Drivers/USB/Core/UC3/Device_UC3.h index a4bdab004..a26d7c2da 100644 --- a/LUFA/Drivers/USB/Core/UC3/Device_UC3.h +++ b/LUFA/Drivers/USB/Core/UC3/Device_UC3.h @@ -210,7 +210,7 @@ static inline void USB_Device_SetDeviceAddress(const uint8_t Address) { AVR32_USBB.UDCON.uadd = Address; - AVR32_USBB.UDCON.adden = true; + AVR32_USBB.UDCON.adden = (Address ? true : false); } static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; |