Tighten up the implementations of the USB_Device_SetDeviceAddress(), USB_Controller_Reset() and USB_PLL_On() functions for the AVR8 devices.

Minor corrections to the documentation of the USB_Control_Request_t enum.
pull/1469/head
Dean Camera 13 years ago
parent 87b57522b2
commit 4e601207a7

File diff suppressed because one or more lines are too long

@ -199,8 +199,10 @@
static inline void USB_Device_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE; static inline void USB_Device_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;
static inline void USB_Device_SetDeviceAddress(const uint8_t Address) static inline void USB_Device_SetDeviceAddress(const uint8_t Address)
{ {
UDADDR = ((UDADDR & (1 << ADDEN)) | (Address & 0x7F)); uint8_t Temp = (UDADDR & (1 << ADDEN)) | (Address & 0x7F);
UDADDR |= (1 << ADDEN);
UDADDR = Temp;
UDADDR = Temp | (1 << ADDEN);
} }
static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;

@ -360,7 +360,7 @@
static inline void USB_PLL_On(void) static inline void USB_PLL_On(void)
{ {
PLLCSR = USB_PLL_PSC; PLLCSR = USB_PLL_PSC;
PLLCSR |= (1 << PLLE); PLLCSR = (USB_PLL_PSC | (1 << PLLE));
} }
static inline void USB_PLL_Off(void) ATTR_ALWAYS_INLINE; static inline void USB_PLL_Off(void) ATTR_ALWAYS_INLINE;
@ -436,10 +436,8 @@
static inline void USB_Controller_Reset(void) ATTR_ALWAYS_INLINE; static inline void USB_Controller_Reset(void) ATTR_ALWAYS_INLINE;
static inline void USB_Controller_Reset(void) static inline void USB_Controller_Reset(void)
{ {
const uint8_t Temp = USBCON; USBCON &= ~(1 << USBE);
USBCON |= (1 << USBE);
USBCON = (Temp & ~(1 << USBE));
USBCON = (Temp | (1 << USBE));
} }
#if defined(USB_CAN_BE_BOTH) #if defined(USB_CAN_BE_BOTH)

@ -178,17 +178,17 @@
*/ */
enum USB_Control_Request_t enum USB_Control_Request_t
{ {
REQ_GetStatus = 0, /**< Implemented in the library for device, endpoint and interface REQ_GetStatus = 0, /**< Implemented in the library for device and endpoint recipients. Passed
* recipients. Passed to the user application for other recipients * to the user application for other recipients via the
* via the \ref EVENT_USB_Device_ControlRequest() event when received in * \ref EVENT_USB_Device_ControlRequest() event when received in
* device mode. */ * device mode. */
REQ_ClearFeature = 1, /**< Implemented in the library for device, endpoint and interface REQ_ClearFeature = 1, /**< Implemented in the library for device and endpoint recipients. Passed
* recipients. Passed to the user application for other recipients * to the user application for other recipients via the
* via the \ref EVENT_USB_Device_ControlRequest() event when received in * \ref EVENT_USB_Device_ControlRequest() event when received in
* device mode. */ * device mode. */
REQ_SetFeature = 3, /**< Implemented in the library for device, endpoint and interface REQ_SetFeature = 3, /**< Implemented in the library for device and endpoint recipients. Passed
* recipients. Passed to the user application for other recipients * to the user application for other recipients via the
* via the \ref EVENT_USB_Device_ControlRequest() event when received in * \ref EVENT_USB_Device_ControlRequest() event when received in
* device mode. */ * device mode. */
REQ_SetAddress = 5, /**< Implemented in the library for the device recipient. Passed REQ_SetAddress = 5, /**< Implemented in the library for the device recipient. Passed
* to the user application for other recipients via the * to the user application for other recipients via the

Loading…
Cancel
Save