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.
MCUSR &= ~(1 << WDRF);\r
wdt_disable();\r
\r
- /* Disable clock division */\r
- clock_prescale_set(clock_div_1);\r
-\r
/* Relocate the interrupt vector table to the bootloader section */\r
MCUCR = (1 << IVCE);\r
MCUCR = (1 << IVSEL);\r
* This bootloader enumerates to the host as a HID Class device, allowing for Teensy compatible programming\r
* software to load firmware onto the AVR, such as the official software at <a>http://www.pjrc.com/teensy/</a>.\r
* \r
- * Out of the box this bootloader builds for the ATMEGA32U4, and will fit into 4KB of bootloader space. For other\r
+ * Out of the box this bootloader builds for the ATMEGA32U4, and will fit into 2-4KB of bootloader space. For other\r
* devices, the makefile will need to be updated to reflect the altered MCU model and bootloader start address. When\r
* calculating the bootloader start address, use (TARGET_FLASH_SIZE_BYTES - 4096).\r
*\r
uint8_t ButtonStatus_LCL = Buttons_GetStatus();\r
\r
uint8_t UsedKeyCodes = 0;\r
- \r
- KeyboardReport->Modifier = HID_KEYBOARD_MODIFER_LEFTSHIFT;\r
- \r
+ \r
if (JoyStatus_LCL & JOY_UP)\r
KeyboardReport->KeyCode[UsedKeyCodes++] = 0x04; // A\r
else if (JoyStatus_LCL & JOY_DOWN)\r
if (ButtonStatus_LCL & BUTTONS_BUTTON1)\r
KeyboardReport->KeyCode[UsedKeyCodes++] = 0x09; // F\r
\r
+ if (UsedKeyCodes)\r
+ KeyboardReport->Modifier = HID_KEYBOARD_MODIFER_LEFTSHIFT;\r
+\r
*ReportSize = sizeof(USB_KeyboardReport_Data_t);\r
return false;\r
}\r
#if !(defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || defined(__DOXYGEN__))\r
/** MUX mask define for the ADC2 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading.\r
*\r
- * \note Note available on all AVR models.\r
+ * \note Not available on all AVR models.\r
*/\r
#define ADC_CHANNEL2 (0x02 << MUX0)\r
\r
/** MUX mask define for the ADC3 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading.\r
*\r
- * \note Note available on all AVR models.\r
+ * \note Not available on all AVR models.\r
*/\r
#define ADC_CHANNEL3 (0x03 << MUX0)\r
#endif\r
#if (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || defined(__DOXYGEN__))\r
/** MUX mask define for the ADC8 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading.\r
*\r
- * \note Note available on all AVR models.\r
+ * \note Not available on all AVR models.\r
*/\r
#define ADC_CHANNEL8 ((1 << 8) | (0x00 << MUX0))\r
\r
/** MUX mask define for the ADC9 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading.\r
*\r
- * \note Note available on all AVR models.\r
+ * \note Not available on all AVR models.\r
*/\r
#define ADC_CHANNEL9 ((1 << 8) | (0x01 << MUX0))\r
\r
/** MUX mask define for the ADC10 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading.\r
*\r
- * \note Note available on all AVR models.\r
+ * \note Not available on all AVR models.\r
*/\r
#define ADC_CHANNEL10 ((1 << 8) | (0x02 << MUX0))\r
\r
/** MUX mask define for the ADC11 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading.\r
*\r
- * \note Note available on all AVR models.\r
+ * \note Not available on all AVR models.\r
*/\r
#define ADC_CHANNEL11 ((1 << 8) | (0x03 << MUX0))\r
\r
/** MUX mask define for the ADC12 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading.\r
*\r
- * \note Note available on all AVR models.\r
+ * \note Not available on all AVR models.\r
*/\r
#define ADC_CHANNEL12 ((1 << 8) | (0x04 << MUX0))\r
\r
/** MUX mask define for the ADC13 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading.\r
*\r
- * \note Note available on all AVR models.\r
+ * \note Not available on all AVR models.\r
*/\r
#define ADC_CHANNEL13 ((1 << 8) | (0x05 << MUX0))\r
\r
/** MUX mask define for the internal temperature sensor channel of the ADC. See \ref ADC_StartReading and\r
* \ref ADC_GetChannelReading.\r
*\r
- * \note Note available on all AVR models.\r
+ * \note Not available on all AVR models.\r
*/\r
#define ADC_INT_TEMP_SENS ((1 << 8) | (0x07 << MUX0))\r
#endif\r
*\r
* \note This must only be called for ADC channels with are connected to a physical port\r
* pin of the AVR, denoted by its special alternative function ADCx.\r
+ * \n\n\r
*\r
* \note The channel number must be specified as an integer, and NOT a ADC_CHANNELx mask.\r
*\r
* the correct endpoint is selected and ready for data.\r
*\r
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state\r
+ *\r
* \return Signed 24-bit audio sample from the audio interface\r
*/\r
static inline int32_t Audio_Device_ReadSample24(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) ATTR_ALWAYS_INLINE;\r
* \r
* \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the\r
* call will fail.\r
+ * \n\n\r
*\r
* \note The destination buffer should be large enough to accommodate the largest report that the attached device\r
* can generate.\r
*\r
* \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the\r
* call will fail.\r
+ * \n\n\r
*\r
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method is unavailable.\r
*\r
*\r
* \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the\r
* call will fail.\r
+ * \n\n\r
*\r
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, the ReportID parameter is removed\r
* from the parameter list of this function.\r
*\r
* \note Whether this function is used or not, the \ref CALLBACK_HIDParser_FilterHIDReportItem() callback from the HID\r
* Report Parser this function references <b>must</b> be implemented in the user code.\r
+ * \n\n\r
*\r
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method is unavailable.\r
*\r
* event has fired (if connected before the role change).\r
*\r
* \note This event only exists on USB AVR models which support dual role modes.\r
+ * \n\n\r
*\r
* \note This event does not exist if the USB_DEVICE_ONLY or USB_HOST_ONLY tokens have been supplied\r
* to the compiler (see \ref Group_USBManagement documentation).\r
* \param[in] ErrorCode Error code indicating the failure reason, a value in \ref USB_Host_ErrorCodes_t\r
*\r
* \note This event only exists on USB AVR models which supports host mode.\r
+ * \n\n\r
*\r
* \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see\r
* \ref Group_USBManagement documentation).\r
* management task to reduce CPU consumption.\r
*\r
* \note This event only exists on USB AVR models which supports host mode.\r
+ * \n\n\r
*\r
* \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see\r
* \ref Group_USBManagement documentation).\r
* can be used to programmatically stop the USB management task to reduce CPU consumption.\r
*\r
* \note This event only exists on USB AVR models which supports host mode.\r
+ * \n\n\r
*\r
* \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see\r
* \ref Group_USBManagement documentation).\r
* code returned by the \ref USB_Host_SendControlRequest() function.\r
*\r
* \note This event only exists on USB AVR models which supports host mode.\r
+ * \n\n\r
*\r
* \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see\r
* \ref Group_USBManagement documentation).\r
* needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by\r
* passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection\r
* and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually.\r
+ * \n\n\r
*\r
* \note This event may fire multiple times during device enumeration on the series 2 USB AVRs with limited USB controllers\r
* if NO_LIMITED_CONTROLLER_CONNECT is not defined.\r
* needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by\r
* passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection\r
* and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually.\r
+ * \n\n\r
*\r
* \note This event may fire multiple times during device enumeration on the series 2 USB AVRs with limited USB controllers\r
* if NO_LIMITED_CONTROLLER_CONNECT is not defined.\r
*\r
* \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see\r
* \ref Group_USBManagement documentation).\r
+ * \n\n\r
*\r
* \note Requests should be handled in the same manner as described in the USB 2.0 Specification,\r
* or appropriate class specification. In all instances, the library has already read the\r
*\r
* \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see\r
* \ref Group_USBManagement documentation).\r
+ * \n\n\r
*\r
* \note This event does not exist on the series 2 USB AVRs when the NO_LIMITED_CONTROLLER_CONNECT\r
* compile time token is not set - see \ref EVENT_USB_Device_Disconnect.\r
*\r
* \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see\r
* \ref Group_USBManagement documentation).\r
+ * \n\n\r
*\r
* \note This event does not exist on the series 2 USB AVRs when the NO_LIMITED_CONTROLLER_CONNECT\r
* compile time token is not set - see \ref EVENT_USB_Device_Connect.\r
*\r
* \note This event is not normally active - it must be manually enabled and disabled via the\r
* \ref USB_Device_EnableSOFEvents() and \ref USB_Device_DisableSOFEvents() commands after enumeration.\r
+ * \n\n\r
*\r
* \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see\r
* \ref Group_USBManagement documentation).\r
#if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)\r
USBCON &= ~((1 << VBUSTE) | (1 << IDTE)); \r
#elif defined(USB_SERIES_4_AVR)\r
- USBCON &= ~(1 << VBUSTE); \r
+ USBCON &= ~(1 << VBUSTE);\r
#endif\r
\r
#if defined(USB_CAN_BE_HOST)\r
* implicitly via the library APIs.\r
*\r
* \note This global is only present if the user application can be a USB device.\r
+ * \n\n\r
*\r
* \note This variable should be treated as read-only in the user application, and never manually\r
* changed in value except in the circumstances outlined above.\r
*\r
* \note This variable should be treated as read-only in the user application, and never manually\r
* changed in value.\r
+ * \n\n\r
*\r
* \note To reduce FLASH usage of the compiled applications where Remote Wakeup is not supported,\r
* this global and the underlying management code can be disabled by defining the \r
* USB interface should be initialized in low speed (1.5Mb/s) mode.\r
*\r
* \note Low Speed mode is not available on all USB AVR models.\r
+ * \n\n\r
*\r
* \note Restrictions apply on the number, size and type of endpoints which can be used\r
* when running in low speed mode -- refer to the USB 2.0 standard.\r
#define Endpoint_ClearSETUP() MACROS{ UEINTX &= ~(1 << RXSTPI); }MACROE\r
\r
#if !defined(CONTROL_ONLY_DEVICE)\r
- #define Endpoint_ClearIN() MACROS{ uint8_t Temp = UEINTX; UEINTX = (Temp & ~(1 << TXINI)); \\r
- UEINTX = (Temp & ~(1 << FIFOCON)); }MACROE\r
+ #define Endpoint_ClearIN() MACROS{ UEINTX &= ~((1 << TXINI) | (1 << FIFOCON)); }MACROE\r
#else\r
#define Endpoint_ClearIN() MACROS{ UEINTX &= ~(1 << TXINI); }MACROE\r
#endif\r
\r
#if !defined(CONTROL_ONLY_DEVICE)\r
- #define Endpoint_ClearOUT() MACROS{ uint8_t Temp = UEINTX; UEINTX = (Temp & ~(1 << RXOUTI)); \\r
- UEINTX = (Temp & ~(1 << FIFOCON)); }MACROE\r
+ #define Endpoint_ClearOUT() MACROS{ UEINTX &= ~((1 << RXOUTI) | (1 << FIFOCON)); }MACROE\r
#else\r
#define Endpoint_ClearOUT() MACROS{ UEINTX &= ~(1 << RXOUTI); }MACROE \r
#endif\r
* The banking mode may be either \ref ENDPOINT_BANK_SINGLE or \ref ENDPOINT_BANK_DOUBLE.\r
*\r
* \note The default control endpoint does not have to be manually configured, as it is automatically\r
- * configured by the library internally.\r
+ * configured by the library internally.\r
+ * \n\n\r
*\r
* \note This routine will select the specified endpoint, and the endpoint will remain selected\r
* once the routine completes regardless of if the endpoint configuration succeeds.\r
*\r
* \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
* to clear the status stage when using this routine in a control transaction.\r
+ * \n\n\r
*\r
* \note This routine should only be used on CONTROL type endpoints.\r
*\r
*\r
* \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
* to clear the status stage when using this routine in a control transaction.\r
+ * \n\n\r
*\r
* \note This routine should only be used on CONTROL type endpoints.\r
*\r
*\r
* \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
* to clear the status stage when using this routine in a control transaction.\r
+ * \n\n\r
*\r
* \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.\r
+ * \n\n\r
*\r
* \note This routine should only be used on CONTROL type endpoints.\r
*\r
*\r
* \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
* to clear the status stage when using this routine in a control transaction.\r
+ * \n\n\r
*\r
* \note This routine should only be used on CONTROL type endpoints.\r
*\r
*\r
* \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
* to clear the status stage when using this routine in a control transaction.\r
+ * \n\n\r
*\r
* \note This routine should only be used on CONTROL type endpoints.\r
*\r
*\r
* \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
* to clear the status stage when using this routine in a control transaction.\r
+ * \n\n\r
*\r
* \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.\r
+ * \n\n\r
*\r
* \note This routine should only be used on CONTROL type endpoints.\r
*\r
*\r
* \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
* to clear the status stage when using this routine in a control transaction.\r
+ * \n\n\r
*\r
* \note This routine should only be used on CONTROL type endpoints.\r
*\r
*\r
* \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
* to clear the status stage when using this routine in a control transaction.\r
+ * \n\n\r
*\r
* \note This routine should only be used on CONTROL type endpoints.\r
*\r
*\r
* \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
* to clear the status stage when using this routine in a control transaction.\r
+ * \n\n\r
*\r
* \note This routine should only be used on CONTROL type endpoints.\r
*\r
*\r
* \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
* to clear the status stage when using this routine in a control transaction.\r
+ * \n\n\r
*\r
* \note This routine should only be used on CONTROL type endpoints.\r
*\r
USB_Detach();\r
USB_Controller_Disable();\r
\r
+ USB_INT_DisableAllInterrupts();\r
+ USB_INT_ClearAllInterrupts();\r
+\r
+ #if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)\r
+ UHWCON &= ~(1 << UIMOD);\r
+ #endif\r
+ \r
if (!(USB_Options & USB_OPT_MANUAL_PLL))\r
USB_PLL_Off();\r
\r
+ USB_REG_Off();\r
+\r
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)\r
USB_OTGPAD_Off();\r
#endif\r
USB_ConfigurationNumber = 0;\r
\r
#if !defined(NO_DEVICE_REMOTE_WAKEUP)\r
- USB_RemoteWakeupEnabled = false;\r
+ USB_RemoteWakeupEnabled = false;\r
#endif\r
\r
#if !defined(NO_DEVICE_SELF_POWER)\r
- USB_CurrentlySelfPowered = false;\r
+ USB_CurrentlySelfPowered = false;\r
#endif\r
#endif\r
\r
USB_INT_Clear(USB_INT_EORSTI);\r
USB_INT_Enable(USB_INT_EORSTI);\r
\r
- #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)\r
- USB_INT_Enable(USB_INT_VBUS);\r
- #endif\r
+ #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)\r
+ USB_INT_Enable(USB_INT_VBUS);\r
+ #endif\r
#elif defined(USB_HOST_ONLY)\r
USB_Host_HostMode_On();\r
\r
* mode speed.\r
*\r
* \note To reduce the FLASH requirements of the library if only device or host mode is required, \r
- * this can be statically set via defining the token USB_DEVICE_ONLY for device mode or \r
- * USB_HOST_ONLY for host mode in the use project makefile, passing the token to the compiler \r
+ * the mode can be statically set in the project makefile by defining the token USB_DEVICE_ONLY\r
+ * (for device mode) or USB_HOST_ONLY (for host mode), passing the token to the compiler \r
* via the -D switch. If the mode is statically set, this parameter does not exist in the\r
* function prototype.\r
+ * \n\n\r
*\r
* \note To reduce the FLASH requirements of the library if only fixed settings are are required,\r
* the options may be set statically in the same manner as the mode (see the Mode parameter of \r
* this function). To statically set the USB options, pass in the USE_STATIC_OPTIONS token,\r
* defined to the appropriate options masks. When the options are statically set, this\r
* parameter does not exist in the function prototype.\r
+ * \n\n\r
* \r
* \note The mode parameter does not exist on devices where only one mode is possible, such as USB \r
* AVR models which only implement the USB device mode in hardware.\r
\r
#define Pipe_IsSETUPSent() ((UPINTX & (1 << TXSTPI)) ? true : false)\r
\r
- #define Pipe_ClearIN() MACROS{ uint8_t Temp = UPINTX; UPINTX = (Temp & ~(1 << RXINI)); \\r
- UPINTX = (Temp & ~(1 << FIFOCON)); }MACROE\r
+ #define Pipe_ClearIN() MACROS{ UPINTX &= ~((1 << RXINI) | (1 << FIFOCON)); }MACROE\r
\r
- #define Pipe_ClearOUT() MACROS{ uint8_t Temp = UPINTX; UPINTX = (Temp & ~(1 << TXOUTI)); \\r
- UPINTX = (Temp & ~(1 << FIFOCON)); }MACROE\r
+ #define Pipe_ClearOUT() MACROS{ UPINTX &= ~((1 << TXOUTI) | (1 << FIFOCON)); }MACROE\r
\r
- #define Pipe_ClearSETUP() MACROS{ uint8_t Temp = UPINTX; UPINTX = (Temp & ~(1 << TXSTPI)); \\r
- UPINTX = (Temp & ~(1 << FIFOCON)); }MACROE\r
+ #define Pipe_ClearSETUP() MACROS{ UPINTX &= ~((1 << TXSTPI) | (1 << FIFOCON)); }MACROE\r
\r
#define Pipe_IsNAKReceived() ((UPINTX & (1 << NAKEDI)) ? true : false)\r
\r
* \ref Pipe_SetFiniteINRequests().\r
*\r
* \note The default control pipe does not have to be manually configured, as it is automatically\r
- * configured by the library internally.\r
+ * configured by the library internally.\r
+ * \n\n\r
*\r
* \note This routine will select the specified pipe, and the pipe will remain selected once the\r
* routine completes regardless of if the pipe configuration succeeds.\r
* - All Class Driver Host mode demos now correctly set the board LEDs to READY once the enumeration process has completed\r
* - Added LIBUSB_FILTERDRV_COMPAT compile time option to the AVRISP programmer project to make the code compatible with Windows\r
* builds of avrdude at the expense of AVRStudio compatibility\r
+ * - Removed two-step endpoint/pipe bank clear and switch sequence for smaller, faster endpoint/pipe code\r
*\r
* <b>Fixed:</b>\r
* - Fixed software PDI/TPI programming mode in the AVRISP project not correctly toggling just the clock pin\r
* into difficulties or need some advice. In addition, you can also email the library author to recieve personalised\r
* support when you need it (subject to author's schedule).\r
*\r
- * <small>* Atmel Stack Mouse Device Demo 4292 bytes, LUFA Mouse Low Level Device Demo 3392 bytes, under identical build\r
+ * <small>* Atmel Stack Mouse Device Demo 4292 bytes, LUFA Mouse Low Level Device Demo 3296 bytes, under identical build\r
* environments</small>\r
*/\r
\ No newline at end of file