Minor documentation improvements.
* - Fixed incorrect ENDPOINT_EPNUM_MASK mask preventing endpoints above EP3 from being selected (thanks to Jonathan Oakley)\r
* - Removed STREAM_CALLBACK() macro - callbacks now use regular function definitions to clarify user code\r
* - Removed DESCRIPTOR_COMPARATOR() macro - comparators should now use regular function definitions to clarify user code\r
* - Fixed incorrect ENDPOINT_EPNUM_MASK mask preventing endpoints above EP3 from being selected (thanks to Jonathan Oakley)\r
* - Removed STREAM_CALLBACK() macro - callbacks now use regular function definitions to clarify user code\r
* - Removed DESCRIPTOR_COMPARATOR() macro - comparators should now use regular function definitions to clarify user code\r
+ * - USB_IsConnected is now cleared before the USB_Disconnect() event is fired in response to VBUS being removed\r
*\r
*\r
* \section Sec_ChangeLog090510 Version 090510\r
*\r
*\r
* \section Sec_ChangeLog090510 Version 090510\r
# This will remove the Files entry from the Quick Index and from the \r
# Folder Tree View (if specified). The default is YES.\r
\r
# This will remove the Files entry from the Quick Index and from the \r
# Folder Tree View (if specified). The default is YES.\r
\r
\r
# Set the SHOW_NAMESPACES tag to NO to disable the generation of the \r
# Namespaces page. This will remove the Namespaces entry from the Quick Index\r
\r
# Set the SHOW_NAMESPACES tag to NO to disable the generation of the \r
# Namespaces page. This will remove the Namespaces entry from the Quick Index\r
*\r
* Events can be hooked by the user application by declaring a handler function with the same name and parameters\r
* listed here. If an event with no user-associated handler is fired within the library, it by default maps to an\r
*\r
* Events can be hooked by the user application by declaring a handler function with the same name and parameters\r
* listed here. If an event with no user-associated handler is fired within the library, it by default maps to an\r
- * internal empty stub function. This is achieved through the use of the GCC compiler's "alias" attribute.\r
+ * internal empty stub function. This trasparent hook system is achieved through the use of the GCC compiler's\r
+ * "alias" attribute.\r
*\r
* Each event must only have one associated event handler, but can be raised by multiple sources.\r
*\r
*\r
* Each event must only have one associated event handler, but can be raised by multiple sources.\r
*\r
/* Pseudo-Functions for Doxygen: */\r
#if !defined(INCLUDE_FROM_EVENTS_C) || defined(__DOXYGEN__)\r
/** Event for VBUS level change. This event fires when the VBUS line of the USB AVR changes from\r
/* Pseudo-Functions for Doxygen: */\r
#if !defined(INCLUDE_FROM_EVENTS_C) || defined(__DOXYGEN__)\r
/** Event for VBUS level change. This event fires when the VBUS line of the USB AVR changes from\r
- * high to low or vice-versa.\r
+ * high to low or vice-versa, before the new VBUS level is sampled and the appropriate action\r
+ * taken.\r
*\r
* \note This event is only available on USB AVR models which support VBUS notification interrupts.\r
*/\r
void EVENT_USB_VBUSChange(void);\r
\r
*\r
* \note This event is only available on USB AVR models which support VBUS notification interrupts.\r
*/\r
void EVENT_USB_VBUSChange(void);\r
\r
- /** Event for VBUS attachment. This event fires when the VBUS line of the USB AVR changes from\r
- * low to high, signalling the attachment of the USB device to a host, before the enumeration\r
- * process has begun.\r
+ /** Event for VBUS attachment. On the AVR models with a dedicated VBUS pin, this event fires when\r
+ * the VBUS line of the USB AVR changes from low to high (after the VBUS events have been handled),\r
+ * signalling the attachment of the USB device to a host, before the enumeration process has begun.\r
*\r
* \note This event is only available on USB AVR models which support VBUS notification interrupts.\r
*/\r
void EVENT_USB_VBUSConnect(void);\r
\r
*\r
* \note This event is only available on USB AVR models which support VBUS notification interrupts.\r
*/\r
void EVENT_USB_VBUSConnect(void);\r
\r
- /** Event for VBUS detachment. This event fires when the VBUS line of the USB AVR changes from\r
- * high to low, signalling the USB device has been removed from a host whether it has been enumerated\r
- * or not.\r
+ /** Event for VBUS attachment. On the AVR models with a dedicated VBUS pin, this event fires when\r
+ * the VBUS line of the USB AVR changes from high to low (after the VBUS events have been handled),\r
+ * signalling the detatchment of the USB device from a host, regardless of its enumeration state.\r
*\r
* \note This event is only available on USB AVR models which support VBUS notification interrupts.\r
*/\r
*\r
* \note This event is only available on USB AVR models which support VBUS notification interrupts.\r
*/\r
\r
/** Event for USB mode pin level change. This event fires when the USB interface is set to dual role\r
* mode, and the UID pin level has changed to indicate a new mode (device or host). This event fires\r
\r
/** Event for USB mode pin level change. This event fires when the USB interface is set to dual role\r
* mode, and the UID pin level has changed to indicate a new mode (device or host). This event fires\r
- * before the mode is switched to the newly indicated mode.\r
+ * before the mode is switched to the newly indicated mode but after the \ref USB_Disconnect event has\r
+ * fired (if connected before the role change).\r
*\r
* \note This event only exists on USB AVR models which support dual role modes.\r
*\r
*\r
* \note This event only exists on USB AVR models which support dual role modes.\r
*\r
\r
/** Event for USB suspend. This event fires when a the USB host suspends the device by halting its\r
* transmission of Start Of Frame pulses to the device. This is generally hooked in order to move\r
\r
/** Event for USB suspend. This event fires when a the USB host suspends the device by halting its\r
* transmission of Start Of Frame pulses to the device. This is generally hooked in order to move\r
- * the device over to a low power state until the host wakes up the device.\r
+ * the device over to a low power state until the host wakes up the device. If the USB interface is\r
+ * enumerated with the \ref USB_OPT_AUTO_PLL option set, the library will automatically suspend the\r
+ * USB PLL before the event is fired to save power.\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
*\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
/** Event for USB wake up. This event fires when a the USB interface is suspended while in device\r
* mode, and the host wakes up the device by supplying Start Of Frame pulses. This is generally\r
* hooked to pull the user application out of a lowe power state and back into normal operating\r
/** Event for USB wake up. This event fires when a the USB interface is suspended while in device\r
* mode, and the host wakes up the device by supplying Start Of Frame pulses. This is generally\r
* hooked to pull the user application out of a lowe power state and back into normal operating\r
+ * mode. If the USB interface is enumerated with the \ref USB_OPT_AUTO_PLL option set, the library\r
+ * will automatically restart the USB PLL before the event is fired.\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
*\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
*/\r
void EVENT_USB_WakeUp(void);\r
\r
*/\r
void EVENT_USB_WakeUp(void);\r
\r
- /** Event for USB interface reset. This event fires when a the USB interface is in device mode, and\r
- * a the USB host requests that the device reset its interface. This is generally hooked so that\r
- * the USB control endpoint can be switched to interrupt driven mode, by selecting it and calling\r
- * USB_INT_Enable(ENDPOINT_INT_SETUP). Before this event fires, all device endpoints are reset and\r
- * disabled.\r
+ /** Event for USB interface reset. This event fires when the USB interface is in device mode, and\r
+ * a the USB host requests that the device reset its interface. This event fires after the control\r
+ * endpoint has been automatically configured by the library.\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
*\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
\r
/* Type Defines: */\r
/** Type define for a Stream Callback function (function taking no arguments and retuning a\r
\r
/* Type Defines: */\r
/** Type define for a Stream Callback function (function taking no arguments and retuning a\r
- * uint8_t value).\r
- *\r
- * \see \ref STREAM_CALLBACK macro for more details\r
+ * uint8_t value). Stream callback functions should have an identical function signature if they\r
+ * are to be used as the callback parameter of the stream functions.\r
*/\r
typedef uint8_t (* const StreamCallbackPtr_t)(void);\r
\r
*/\r
typedef uint8_t (* const StreamCallbackPtr_t)(void);\r
\r
+ USB_IsConnected = false;\r
+\r
EVENT_USB_Disconnect();\r
\r
USB_Detach();\r
EVENT_USB_Disconnect();\r
\r
USB_Detach();\r
USB_PLL_Off();\r
USB_REG_Off();\r
\r
USB_PLL_Off();\r
USB_REG_Off();\r
\r
- USB_IsConnected = false;\r
-\r
EVENT_USB_VBUSDisconnect();\r
\r
USB_INT_Clear(USB_INT_VBUS);\r
EVENT_USB_VBUSDisconnect();\r
\r
USB_INT_Clear(USB_INT_VBUS);\r
/* Function Prototypes: */\r
/** Configures the specified endpoint number with the given endpoint type, direction, bank size\r
* and banking mode. Endpoints should be allocated in ascending order by their address in the\r
/* Function Prototypes: */\r
/** Configures the specified endpoint number with the given endpoint type, direction, bank size\r
* and banking mode. Endpoints should be allocated in ascending order by their address in the\r
- * device (i.e. endpoint 1 should be configured before endpoint 2 and so on).\r
+ * device (i.e. endpoint 1 should be configured before endpoint 2 and so on) to prevent fragmentation\r
+ * of the USB FIFO memory.\r
*\r
* The endpoint type may be one of the EP_TYPE_* macros listed in LowLevel.h and the direction\r
* may be either \ref ENDPOINT_DIR_OUT or \ref ENDPOINT_DIR_IN.\r
*\r
* The endpoint type may be one of the EP_TYPE_* macros listed in LowLevel.h and the direction\r
* may be either \ref ENDPOINT_DIR_OUT or \ref ENDPOINT_DIR_IN.\r
*\r
* The banking mode may be either \ref ENDPOINT_BANK_SINGLE or \ref ENDPOINT_BANK_DOUBLE.\r
*\r
*\r
* The banking mode may be either \ref ENDPOINT_BANK_SINGLE or \ref ENDPOINT_BANK_DOUBLE.\r
*\r
- * The success of this routine can be determined via the \ref Endpoint_IsConfigured() macro.\r
+ * \note The default control endpoint does not have to be manually configured, as it is automatically\r
+ * configured by the library internally.\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 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
/* Function Prototypes: */\r
/** Configures the specified pipe number with the given pipe type, token, target endpoint number in the\r
* attached device, bank size and banking mode. Pipes should be allocated in ascending order by their\r
/* Function Prototypes: */\r
/** Configures the specified pipe number with the given pipe type, token, target endpoint number in the\r
* attached device, bank size and banking mode. Pipes should be allocated in ascending order by their\r
- * address in the device (i.e. pipe 1 should be configured before pipe 2 and so on).\r
+ * address in the device (i.e. pipe 1 should be configured before pipe 2 and so on) to prevent fragmentation\r
+ * of the USB FIFO memory.\r
*\r
* The pipe type may be one of the EP_TYPE_* macros listed in LowLevel.h, the token may be one of the\r
* PIPE_TOKEN_* masks.\r
*\r
* The pipe type may be one of the EP_TYPE_* macros listed in LowLevel.h, the token may be one of the\r
* PIPE_TOKEN_* masks.\r
*\r
* A newly configured pipe is frozen by default, and must be unfrozen before use via the \ref Pipe_Unfreeze() macro.\r
*\r
*\r
* A newly configured pipe is frozen by default, and must be unfrozen before use via the \ref Pipe_Unfreeze() macro.\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
+ *\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
*\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
*\r
* The LUFA library ships with several different host and device demos, located in the /Demos/ subdirectory.\r
* If this directory is missing, please re-download the project from the project homepage.\r
*\r
* The LUFA library ships with several different host and device demos, located in the /Demos/ subdirectory.\r
* If this directory is missing, please re-download the project from the project homepage.\r
*\r
- * Also included with the library are two fully functional bootloaders, located in the /Bootloaders/ subdirectory.\r
- * The DFU class bootloader is compatible with Atmel's FLIP software or the open source dfu-programmer project, and\r
- * the CDC class (AVR109 protocol) is compatible with such open source software as AVRDUDE and AVR-OSP.\r
+ * Also included with the library are three fully functional bootloaders, located in the /Bootloaders/ subdirectory.\r
+ * The DFU class bootloader is compatible with Atmel's FLIP software or the open source dfu-programmer project, the\r
+ * CDC class (AVR109 protocol) is compatible with such open source software as AVRDUDE and AVR-OSP, and the TeensyLoader\r
+ * HID class bootloader is compatible with the software from PJRC (http://www.pjrc.com/teensy/index.html).\r
*\r
*\r
* \section Sec_Donations Donate\r
*\r
*\r
* \section Sec_Donations Donate\r