- /* Public Interface - May be used in end-application: */\r
- /* Macros: */\r
- /** Raises a given event name, with the specified parameters. For events with no parameters the\r
- * only argument to the macro is the event name, events with parameters list the parameter values\r
- * after the name as a comma seperated list.\r
- *\r
- * When a given event is fired, its corresponding event handler code is executed.\r
- *\r
- * Usage Examples:\r
- * \code\r
- * // Raise the USB_VBUSChange event, which takes no parameters\r
- * RAISE_EVENT(USB_VBUSChange);\r
- *\r
- * // Raise the USB_UnhandledControlPacket event which takes two parameters\r
- * RAISE_EVENT(USB_UnhandledControlPacket, 0, 1);\r
- * \endcode\r
- *\r
- * \see RAISES_EVENT()\r
- */\r
- #define RAISE_EVENT(e, ...) Event_ ## e (__VA_ARGS__)\r
-\r
- /** Indicates that a given module can raise a given event. This is the equivelent of putting the\r
- * event function's prototype into the module, but in a cleaner way. Each event which may be\r
- * fired via the RAISE_EVENT macro in the module should have an accompanying RAISES_EVENT\r
- * prototype in the module's header file.\r
- *\r
- * Usage Examples:\r
- * \code\r
- * // Module can raise the USB_VBUSChange event\r
- * RAISES_EVENT(USB_VBUSChange);\r
- *\r
- * // ...\r
- * // Inside a block of code in a function of the module, raise the USB_VBUSChange event\r
- * RAISE_EVENT(USB_VBUSChange);\r
- * \endcode\r
- *\r
- * \see RAISE_EVENT()\r
- */\r
- #define RAISES_EVENT(e) HANDLES_EVENT(e)\r
-\r
- /** Defines an event handler for the given event. Event handlers should be short in length, as they\r
- * may be raised from inside an ISR. The user application can react to each event as it sees fit,\r
- * such as logging the event, indicating the change to the user or performing some other action.\r
- *\r
- * Only one event handler may be defined in any user project for each individual event. Events may\r
- * or may not have parameters - for each event, refer to its documentation elsewhere in this module\r
- * to determine the presense and purpose of any event parameters.\r
- *\r
- * Usage Example:\r
- * \code\r
- * // Create an event handler for the USB_VBUSChange event\r
- * EVENT_HANDLER(USB_VBUSChange)\r
- * {\r
- * // Code to execute when the VBUS level changes\r
- * }\r
- * \endcode\r
- *\r
- * \see HANDLES_EVENT()\r
- */\r
- #define EVENT_HANDLER(e) void Event_ ## e e ## _P\r
- \r
- /** Indicates that a given module handles an event. This is the equivelent of putting the\r
- * event function's prototype into the module, but in a cleaner way. Each event which may be\r
- * handled via the EVENT_HANDLER macro in the module should have an accompanying HANDLES_EVENT\r
- * prototype in the module's header file.\r
- *\r
- * Usage Examples:\r
- * \code\r
- * // Module handles the USB_VBUSChange event\r
- * HANDLES_EVENT(USB_VBUSChange);\r
- *\r
- * // Create the USB_VBUSChange event handler\r
- * EVENT_HANDLER(USB_VBUSChange)\r
- * {\r
- * // Event handler code here\r
- * }\r
- * \endcode\r
- *\r
- * \see EVENT_HANDLER()\r
- */\r
- #define HANDLES_EVENT(e) EVENT_HANDLER(e)\r
- \r
- /* Psudo-Functions for Doxygen: */\r
- #if 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
- *\r
- * \note This event is only available on USB AVR models which support VBUS notification interrupts.\r
- */\r
- void 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
- *\r
- * \note This event is only available on USB AVR models which support VBUS notification interrupts.\r
- */\r
- void 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
- *\r
- * \note This event is only available on USB AVR models which support VBUS notification interrupts.\r
- */\r
- void USB_VBUSDisconnect(void);\r
-\r
- /** Event for USB device connection. This event fires when the AVR is in USB host mode and a device\r
- * has been attached (but not yet fully enumerated), or when in device mode and the device is connected\r
- * to a host, beginning the enumeration process.\r
- *\r
- * When in device mode, this can be used to progmatically start the USB management task to reduce\r
- * CPU usage.\r
- *\r
- * \note For the smaller USB AVRs (AT90USBXX2) with limited USB controllers, VBUS is not available to the USB controller.\r
- * this means that the current connection state is derived from the bus suspension and wake up events by default,\r
- * which is not always accurate (host may suspend the bus while still connected). If the actual connection state\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 by RAISE_EVENT(), and the USB_IsConnected global changed manually.\r
- *\r
- * \see USBTask.h for more information on the USB management task and reducing CPU usage.\r
- */\r
- void USB_Connect(void);\r
-\r
- /** Event for USB device disconnection. This event fires when the AVR is in USB host mode and an\r
- * attached and enumerated device has been disconnected, or when in device mode and the device is\r
- * disconnected from the host.\r
- *\r
- * When in device mode, this can be used to progmatically stop the USB management task to reduce\r
- * CPU usage.\r
- *\r
- * \note For the smaller USB AVRs (AT90USBXX2) with limited USB controllers, VBUS is not available to the USB controller.\r
- * this means that the current connection state is derived from the bus suspension and wake up events by default,\r
- * which is not always accurate (host may suspend the bus while still connected). If the actual connection state\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 by RAISE_EVENT(), and the USB_IsConnected global changed manually.\r
- *\r
- * \see USBTask.h for more information on the USB management task and reducing CPU usage.\r
- */\r
- void USB_Disconnect(void);\r
- \r
- /** Event for USB device power on failure. This event fires when the USB interface fails to\r