Commit 7b79325a authored by Dean Camera's avatar Dean Camera
Browse files

Removed two-step endpoint/pipe bank clear and switch sequence for smaller,...

Removed two-step endpoint/pipe bank clear and switch sequence for smaller, faster endpoint/pipe code.

Added spacing between multiple paragraphs in Doxygen \note sections.

Removed call to the clock prescaler reset function in the Teensy bootloader to save space - the user application is accessed via a watchdog reset anyway, so the prescale reset would only affect the speed of the bootloader itself.
parent 19ecd04f
...@@ -68,9 +68,6 @@ void SetupHardware(void) ...@@ -68,9 +68,6 @@ void SetupHardware(void)
MCUSR &= ~(1 << WDRF); MCUSR &= ~(1 << WDRF);
wdt_disable(); wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
/* Relocate the interrupt vector table to the bootloader section */ /* Relocate the interrupt vector table to the bootloader section */
MCUCR = (1 << IVCE); MCUCR = (1 << IVCE);
MCUCR = (1 << IVSEL); MCUCR = (1 << IVSEL);
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
* This bootloader enumerates to the host as a HID Class device, allowing for Teensy compatible programming * This bootloader enumerates to the host as a HID Class device, allowing for Teensy compatible programming
* software to load firmware onto the AVR, such as the official software at <a>http://www.pjrc.com/teensy/</a>. * software to load firmware onto the AVR, such as the official software at <a>http://www.pjrc.com/teensy/</a>.
* *
* Out of the box this bootloader builds for the ATMEGA32U4, and will fit into 4KB of bootloader space. For other * Out of the box this bootloader builds for the ATMEGA32U4, and will fit into 2-4KB of bootloader space. For other
* devices, the makefile will need to be updated to reflect the altered MCU model and bootloader start address. When * devices, the makefile will need to be updated to reflect the altered MCU model and bootloader start address. When
* calculating the bootloader start address, use (TARGET_FLASH_SIZE_BYTES - 4096). * calculating the bootloader start address, use (TARGET_FLASH_SIZE_BYTES - 4096).
* *
......
...@@ -146,9 +146,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn ...@@ -146,9 +146,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
uint8_t ButtonStatus_LCL = Buttons_GetStatus(); uint8_t ButtonStatus_LCL = Buttons_GetStatus();
uint8_t UsedKeyCodes = 0; uint8_t UsedKeyCodes = 0;
KeyboardReport->Modifier = HID_KEYBOARD_MODIFER_LEFTSHIFT;
if (JoyStatus_LCL & JOY_UP) if (JoyStatus_LCL & JOY_UP)
KeyboardReport->KeyCode[UsedKeyCodes++] = 0x04; // A KeyboardReport->KeyCode[UsedKeyCodes++] = 0x04; // A
else if (JoyStatus_LCL & JOY_DOWN) else if (JoyStatus_LCL & JOY_DOWN)
...@@ -165,6 +163,9 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn ...@@ -165,6 +163,9 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
if (ButtonStatus_LCL & BUTTONS_BUTTON1) if (ButtonStatus_LCL & BUTTONS_BUTTON1)
KeyboardReport->KeyCode[UsedKeyCodes++] = 0x09; // F KeyboardReport->KeyCode[UsedKeyCodes++] = 0x09; // F
if (UsedKeyCodes)
KeyboardReport->Modifier = HID_KEYBOARD_MODIFER_LEFTSHIFT;
*ReportSize = sizeof(USB_KeyboardReport_Data_t); *ReportSize = sizeof(USB_KeyboardReport_Data_t);
return false; return false;
} }
......
...@@ -125,13 +125,13 @@ ...@@ -125,13 +125,13 @@
#if !(defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || defined(__DOXYGEN__)) #if !(defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || defined(__DOXYGEN__))
/** MUX mask define for the ADC2 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading. /** MUX mask define for the ADC2 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading.
* *
* \note Note available on all AVR models. * \note Not available on all AVR models.
*/ */
#define ADC_CHANNEL2 (0x02 << MUX0) #define ADC_CHANNEL2 (0x02 << MUX0)
/** MUX mask define for the ADC3 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading. /** MUX mask define for the ADC3 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading.
* *
* \note Note available on all AVR models. * \note Not available on all AVR models.
*/ */
#define ADC_CHANNEL3 (0x03 << MUX0) #define ADC_CHANNEL3 (0x03 << MUX0)
#endif #endif
...@@ -154,44 +154,44 @@ ...@@ -154,44 +154,44 @@
#if (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || defined(__DOXYGEN__)) #if (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || defined(__DOXYGEN__))
/** MUX mask define for the ADC8 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading. /** MUX mask define for the ADC8 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading.
* *
* \note Note available on all AVR models. * \note Not available on all AVR models.
*/ */
#define ADC_CHANNEL8 ((1 << 8) | (0x00 << MUX0)) #define ADC_CHANNEL8 ((1 << 8) | (0x00 << MUX0))
/** MUX mask define for the ADC9 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading. /** MUX mask define for the ADC9 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading.
* *
* \note Note available on all AVR models. * \note Not available on all AVR models.
*/ */
#define ADC_CHANNEL9 ((1 << 8) | (0x01 << MUX0)) #define ADC_CHANNEL9 ((1 << 8) | (0x01 << MUX0))
/** MUX mask define for the ADC10 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading. /** MUX mask define for the ADC10 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading.
* *
* \note Note available on all AVR models. * \note Not available on all AVR models.
*/ */
#define ADC_CHANNEL10 ((1 << 8) | (0x02 << MUX0)) #define ADC_CHANNEL10 ((1 << 8) | (0x02 << MUX0))
/** MUX mask define for the ADC11 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading. /** MUX mask define for the ADC11 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading.
* *
* \note Note available on all AVR models. * \note Not available on all AVR models.
*/ */
#define ADC_CHANNEL11 ((1 << 8) | (0x03 << MUX0)) #define ADC_CHANNEL11 ((1 << 8) | (0x03 << MUX0))
/** MUX mask define for the ADC12 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading. /** MUX mask define for the ADC12 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading.
* *
* \note Note available on all AVR models. * \note Not available on all AVR models.
*/ */
#define ADC_CHANNEL12 ((1 << 8) | (0x04 << MUX0)) #define ADC_CHANNEL12 ((1 << 8) | (0x04 << MUX0))
/** MUX mask define for the ADC13 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading. /** MUX mask define for the ADC13 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading.
* *
* \note Note available on all AVR models. * \note Not available on all AVR models.
*/ */
#define ADC_CHANNEL13 ((1 << 8) | (0x05 << MUX0)) #define ADC_CHANNEL13 ((1 << 8) | (0x05 << MUX0))
/** MUX mask define for the internal temperature sensor channel of the ADC. See \ref ADC_StartReading and /** MUX mask define for the internal temperature sensor channel of the ADC. See \ref ADC_StartReading and
* \ref ADC_GetChannelReading. * \ref ADC_GetChannelReading.
* *
* \note Note available on all AVR models. * \note Not available on all AVR models.
*/ */
#define ADC_INT_TEMP_SENS ((1 << 8) | (0x07 << MUX0)) #define ADC_INT_TEMP_SENS ((1 << 8) | (0x07 << MUX0))
#endif #endif
...@@ -250,6 +250,7 @@ ...@@ -250,6 +250,7 @@
* *
* \note This must only be called for ADC channels with are connected to a physical port * \note This must only be called for ADC channels with are connected to a physical port
* pin of the AVR, denoted by its special alternative function ADCx. * pin of the AVR, denoted by its special alternative function ADCx.
* \n\n
* *
* \note The channel number must be specified as an integer, and NOT a ADC_CHANNELx mask. * \note The channel number must be specified as an integer, and NOT a ADC_CHANNELx mask.
* *
......
...@@ -219,6 +219,7 @@ ...@@ -219,6 +219,7 @@
* the correct endpoint is selected and ready for data. * the correct endpoint is selected and ready for data.
* *
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state
*
* \return Signed 24-bit audio sample from the audio interface * \return Signed 24-bit audio sample from the audio interface
*/ */
static inline int32_t Audio_Device_ReadSample24(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) ATTR_ALWAYS_INLINE; static inline int32_t Audio_Device_ReadSample24(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) ATTR_ALWAYS_INLINE;
......
...@@ -169,6 +169,7 @@ ...@@ -169,6 +169,7 @@
* *
* \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* \n\n
* *
* \note The destination buffer should be large enough to accommodate the largest report that the attached device * \note The destination buffer should be large enough to accommodate the largest report that the attached device
* can generate. * can generate.
...@@ -186,6 +187,7 @@ ...@@ -186,6 +187,7 @@
* *
* \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* \n\n
* *
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method is unavailable. * \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method is unavailable.
* *
...@@ -204,6 +206,7 @@ ...@@ -204,6 +206,7 @@
* *
* \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail. * call will fail.
* \n\n
* *
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, the ReportID parameter is removed * \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, the ReportID parameter is removed
* from the parameter list of this function. * from the parameter list of this function.
...@@ -256,6 +259,7 @@ ...@@ -256,6 +259,7 @@
* *
* \note Whether this function is used or not, the \ref CALLBACK_HIDParser_FilterHIDReportItem() callback from the HID * \note Whether this function is used or not, the \ref CALLBACK_HIDParser_FilterHIDReportItem() callback from the HID
* Report Parser this function references <b>must</b> be implemented in the user code. * Report Parser this function references <b>must</b> be implemented in the user code.
* \n\n
* *
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method is unavailable. * \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method is unavailable.
* *
......
...@@ -102,6 +102,7 @@ ...@@ -102,6 +102,7 @@
* event has fired (if connected before the role change). * event has fired (if connected before the role change).
* *
* \note This event only exists on USB AVR models which support dual role modes. * \note This event only exists on USB AVR models which support dual role modes.
* \n\n
* *
* \note This event does not exist if the USB_DEVICE_ONLY or USB_HOST_ONLY tokens have been supplied * \note This event does not exist if the USB_DEVICE_ONLY or USB_HOST_ONLY tokens have been supplied
* to the compiler (see \ref Group_USBManagement documentation). * to the compiler (see \ref Group_USBManagement documentation).
...@@ -114,6 +115,7 @@ ...@@ -114,6 +115,7 @@
* \param[in] ErrorCode Error code indicating the failure reason, a value in \ref USB_Host_ErrorCodes_t * \param[in] ErrorCode Error code indicating the failure reason, a value in \ref USB_Host_ErrorCodes_t
* *
* \note This event only exists on USB AVR models which supports host mode. * \note This event only exists on USB AVR models which supports host mode.
* \n\n
* *
* \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see * \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see
* \ref Group_USBManagement documentation). * \ref Group_USBManagement documentation).
...@@ -126,6 +128,7 @@ ...@@ -126,6 +128,7 @@
* management task to reduce CPU consumption. * management task to reduce CPU consumption.
* *
* \note This event only exists on USB AVR models which supports host mode. * \note This event only exists on USB AVR models which supports host mode.
* \n\n
* *
* \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see * \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see
* \ref Group_USBManagement documentation). * \ref Group_USBManagement documentation).
...@@ -139,6 +142,7 @@ ...@@ -139,6 +142,7 @@
* can be used to programmatically stop the USB management task to reduce CPU consumption. * can be used to programmatically stop the USB management task to reduce CPU consumption.
* *
* \note This event only exists on USB AVR models which supports host mode. * \note This event only exists on USB AVR models which supports host mode.
* \n\n
* *
* \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see * \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see
* \ref Group_USBManagement documentation). * \ref Group_USBManagement documentation).
...@@ -158,6 +162,7 @@ ...@@ -158,6 +162,7 @@
* code returned by the \ref USB_Host_SendControlRequest() function. * code returned by the \ref USB_Host_SendControlRequest() function.
* *
* \note This event only exists on USB AVR models which supports host mode. * \note This event only exists on USB AVR models which supports host mode.
* \n\n
* *
* \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see * \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see
* \ref Group_USBManagement documentation). * \ref Group_USBManagement documentation).
...@@ -186,6 +191,7 @@ ...@@ -186,6 +191,7 @@
* needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by * needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by
* passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection * passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection
* and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually. * and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually.
* \n\n
* *
* \note This event may fire multiple times during device enumeration on the series 2 USB AVRs with limited USB controllers * \note This event may fire multiple times during device enumeration on the series 2 USB AVRs with limited USB controllers
* if NO_LIMITED_CONTROLLER_CONNECT is not defined. * if NO_LIMITED_CONTROLLER_CONNECT is not defined.
...@@ -203,6 +209,7 @@ ...@@ -203,6 +209,7 @@
* needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by * needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by
* passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection * passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection
* and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually. * and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually.
* \n\n
* *
* \note This event may fire multiple times during device enumeration on the series 2 USB AVRs with limited USB controllers * \note This event may fire multiple times during device enumeration on the series 2 USB AVRs with limited USB controllers
* if NO_LIMITED_CONTROLLER_CONNECT is not defined. * if NO_LIMITED_CONTROLLER_CONNECT is not defined.
...@@ -226,6 +233,7 @@ ...@@ -226,6 +233,7 @@
* *
* \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
* \ref Group_USBManagement documentation). * \ref Group_USBManagement documentation).
* \n\n
* *
* \note Requests should be handled in the same manner as described in the USB 2.0 Specification, * \note Requests should be handled in the same manner as described in the USB 2.0 Specification,
* or appropriate class specification. In all instances, the library has already read the * or appropriate class specification. In all instances, the library has already read the
...@@ -256,6 +264,7 @@ ...@@ -256,6 +264,7 @@
* *
* \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
* \ref Group_USBManagement documentation). * \ref Group_USBManagement documentation).
* \n\n
* *
* \note This event does not exist on the series 2 USB AVRs when the NO_LIMITED_CONTROLLER_CONNECT * \note This event does not exist on the series 2 USB AVRs when the NO_LIMITED_CONTROLLER_CONNECT
* compile time token is not set - see \ref EVENT_USB_Device_Disconnect. * compile time token is not set - see \ref EVENT_USB_Device_Disconnect.
...@@ -272,6 +281,7 @@ ...@@ -272,6 +281,7 @@
* *
* \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
* \ref Group_USBManagement documentation). * \ref Group_USBManagement documentation).
* \n\n
* *
* \note This event does not exist on the series 2 USB AVRs when the NO_LIMITED_CONTROLLER_CONNECT * \note This event does not exist on the series 2 USB AVRs when the NO_LIMITED_CONTROLLER_CONNECT
* compile time token is not set - see \ref EVENT_USB_Device_Connect. * compile time token is not set - see \ref EVENT_USB_Device_Connect.
...@@ -301,6 +311,7 @@ ...@@ -301,6 +311,7 @@
* *
* \note This event is not normally active - it must be manually enabled and disabled via the * \note This event is not normally active - it must be manually enabled and disabled via the
* \ref USB_Device_EnableSOFEvents() and \ref USB_Device_DisableSOFEvents() commands after enumeration. * \ref USB_Device_EnableSOFEvents() and \ref USB_Device_DisableSOFEvents() commands after enumeration.
* \n\n
* *
* \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
* \ref Group_USBManagement documentation). * \ref Group_USBManagement documentation).
......
...@@ -36,7 +36,7 @@ void USB_INT_DisableAllInterrupts(void) ...@@ -36,7 +36,7 @@ void USB_INT_DisableAllInterrupts(void)
#if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) #if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
USBCON &= ~((1 << VBUSTE) | (1 << IDTE)); USBCON &= ~((1 << VBUSTE) | (1 << IDTE));
#elif defined(USB_SERIES_4_AVR) #elif defined(USB_SERIES_4_AVR)
USBCON &= ~(1 << VBUSTE); USBCON &= ~(1 << VBUSTE);
#endif #endif
#if defined(USB_CAN_BE_HOST) #if defined(USB_CAN_BE_HOST)
......
...@@ -135,6 +135,7 @@ ...@@ -135,6 +135,7 @@
* implicitly via the library APIs. * implicitly via the library APIs.
* *
* \note This global is only present if the user application can be a USB device. * \note This global is only present if the user application can be a USB device.
* \n\n
* *
* \note This variable should be treated as read-only in the user application, and never manually * \note This variable should be treated as read-only in the user application, and never manually
* changed in value except in the circumstances outlined above. * changed in value except in the circumstances outlined above.
......
...@@ -103,6 +103,7 @@ ...@@ -103,6 +103,7 @@
* *
* \note This variable should be treated as read-only in the user application, and never manually * \note This variable should be treated as read-only in the user application, and never manually
* changed in value. * changed in value.
* \n\n
* *
* \note To reduce FLASH usage of the compiled applications where Remote Wakeup is not supported, * \note To reduce FLASH usage of the compiled applications where Remote Wakeup is not supported,
* this global and the underlying management code can be disabled by defining the * this global and the underlying management code can be disabled by defining the
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
* USB interface should be initialized in low speed (1.5Mb/s) mode. * USB interface should be initialized in low speed (1.5Mb/s) mode.
* *
* \note Low Speed mode is not available on all USB AVR models. * \note Low Speed mode is not available on all USB AVR models.
* \n\n
* *
* \note Restrictions apply on the number, size and type of endpoints which can be used * \note Restrictions apply on the number, size and type of endpoints which can be used
* when running in low speed mode -- refer to the USB 2.0 standard. * when running in low speed mode -- refer to the USB 2.0 standard.
......
...@@ -405,15 +405,13 @@ ...@@ -405,15 +405,13 @@
#define Endpoint_ClearSETUP() MACROS{ UEINTX &= ~(1 << RXSTPI); }MACROE #define Endpoint_ClearSETUP() MACROS{ UEINTX &= ~(1 << RXSTPI); }MACROE
#if !defined(CONTROL_ONLY_DEVICE) #if !defined(CONTROL_ONLY_DEVICE)
#define Endpoint_ClearIN() MACROS{ uint8_t Temp = UEINTX; UEINTX = (Temp & ~(1 << TXINI)); \ #define Endpoint_ClearIN() MACROS{ UEINTX &= ~((1 << TXINI) | (1 << FIFOCON)); }MACROE
UEINTX = (Temp & ~(1 << FIFOCON)); }MACROE
#else #else
#define Endpoint_ClearIN() MACROS{ UEINTX &= ~(1 << TXINI); }MACROE #define Endpoint_ClearIN() MACROS{ UEINTX &= ~(1 << TXINI); }MACROE
#endif #endif
#if !defined(CONTROL_ONLY_DEVICE) #if !defined(CONTROL_ONLY_DEVICE)
#define Endpoint_ClearOUT() MACROS{ uint8_t Temp = UEINTX; UEINTX = (Temp & ~(1 << RXOUTI)); \ #define Endpoint_ClearOUT() MACROS{ UEINTX &= ~((1 << RXOUTI) | (1 << FIFOCON)); }MACROE
UEINTX = (Temp & ~(1 << FIFOCON)); }MACROE
#else #else
#define Endpoint_ClearOUT() MACROS{ UEINTX &= ~(1 << RXOUTI); }MACROE #define Endpoint_ClearOUT() MACROS{ UEINTX &= ~(1 << RXOUTI); }MACROE
#endif #endif
...@@ -747,7 +745,8 @@ ...@@ -747,7 +745,8 @@
* The banking mode may be either \ref ENDPOINT_BANK_SINGLE or \ref ENDPOINT_BANK_DOUBLE. * The banking mode may be either \ref ENDPOINT_BANK_SINGLE or \ref ENDPOINT_BANK_DOUBLE.
* *
* \note The default control endpoint does not have to be manually configured, as it is automatically * \note The default control endpoint does not have to be manually configured, as it is automatically
* configured by the library internally. * configured by the library internally.
* \n\n
* *
* \note This routine will select the specified endpoint, and the endpoint will remain selected * \note This routine will select the specified endpoint, and the endpoint will remain selected
* once the routine completes regardless of if the endpoint configuration succeeds. * once the routine completes regardless of if the endpoint configuration succeeds.
...@@ -971,6 +970,7 @@ ...@@ -971,6 +970,7 @@
* *
* \note This function automatically clears the control transfer's status stage. Do not manually attempt * \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction. * to clear the status stage when using this routine in a control transaction.
* \n\n
* *
* \note This routine should only be used on CONTROL type endpoints. * \note This routine should only be used on CONTROL type endpoints.
* *
...@@ -990,6 +990,7 @@ ...@@ -990,6 +990,7 @@
* *
* \note This function automatically clears the control transfer's status stage. Do not manually attempt * \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction. * to clear the status stage when using this routine in a control transaction.
* \n\n
* *
* \note This routine should only be used on CONTROL type endpoints. * \note This routine should only be used on CONTROL type endpoints.
* *
...@@ -1009,8 +1010,10 @@ ...@@ -1009,8 +1010,10 @@
* *
* \note This function automatically clears the control transfer's status stage. Do not manually attempt * \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction. * to clear the status stage when using this routine in a control transaction.
* \n\n
* *
* \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. * \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
* \n\n
* *
* \note This routine should only be used on CONTROL type endpoints. * \note This routine should only be used on CONTROL type endpoints.
* *
...@@ -1033,6 +1036,7 @@ ...@@ -1033,6 +1036,7 @@
* *
* \note This function automatically clears the control transfer's status stage. Do not manually attempt * \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction. * to clear the status stage when using this routine in a control transaction.
* \n\n
* *
* \note This routine should only be used on CONTROL type endpoints. * \note This routine should only be used on CONTROL type endpoints.
* *
...@@ -1052,6 +1056,7 @@ ...@@ -1052,6 +1056,7 @@
* *
* \note This function automatically clears the control transfer's status stage. Do not manually attempt * \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction. * to clear the status stage when using this routine in a control transaction.
* \n\n
* *
* \note This routine should only be used on CONTROL type endpoints. * \note This routine should only be used on CONTROL type endpoints.
* *
...@@ -1071,8 +1076,10 @@ ...@@ -1071,8 +1076,10 @@
* *
* \note This function automatically clears the control transfer's status stage. Do not manually attempt * \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction. * to clear the status stage when using this routine in a control transaction.
* \n\n
* *
* \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. * \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
* \n\n
* *
* \note This routine should only be used on CONTROL type endpoints. * \note This routine should only be used on CONTROL type endpoints.
* *
...@@ -1095,6 +1102,7 @@ ...@@ -1095,6 +1102,7 @@
* *
* \note This function automatically clears the control transfer's status stage. Do not manually attempt * \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction. * to clear the status stage when using this routine in a control transaction.
* \n\n
* *
* \note This routine should only be used on CONTROL type endpoints. * \note This routine should only be used on CONTROL type endpoints.
* *
...@@ -1114,6 +1122,7 @@ ...@@ -1114,6 +1122,7 @@
* *
* \note This function automatically clears the control transfer's status stage. Do not manually attempt * \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction. * to clear the status stage when using this routine in a control transaction.
* \n\n
* *
* \note This routine should only be used on CONTROL type endpoints. * \note This routine should only be used on CONTROL type endpoints.
* *
...@@ -1136,6 +1145,7 @@ ...@@ -1136,6 +1145,7 @@
* *
* \note This function automatically clears the control transfer's status stage. Do not manually attempt * \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction. * to clear the status stage when using this routine in a control transaction.
* \n\n
* *
* \note This routine should only be used on CONTROL type endpoints. * \note This routine should only be used on CONTROL type endpoints.
* *
...@@ -1155,6 +1165,7 @@ ...@@ -1155,6 +1165,7 @@
* *
* \note This function automatically clears the control transfer's status stage. Do not manually attempt * \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction. * to clear the status stage when using this routine in a control transaction.
* \n\n
* *
* \note This routine should only be used on CONTROL type endpoints. * \note This routine should only be used on CONTROL type endpoints.
* *
......
...@@ -113,9 +113,18 @@ void USB_ShutDown(void) ...@@ -113,9 +113,18 @@ void USB_ShutDown(void)
USB_Detach(); USB_Detach();
USB_Controller_Disable(); USB_Controller_Disable();
USB_INT_DisableAllInterrupts();
USB_INT_ClearAllInterrupts();
#if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
UHWCON &= ~(1 << UIMOD);
#endif
if (!(USB_Options & USB_OPT_MANUAL_PLL)) if (!(USB_Options & USB_OPT_MANUAL_PLL))
USB_PLL_Off();