Fixed incorrect ENDPOINT_EPNUM_MASK mask preventing endpoints above EP3 from being selected (thanks to Jonathan Oakley).
Removed STREAM_CALLBACK() macro - callbacks now use regular function definitions to clarify user code.
Removed DESCRIPTOR_COMPARATOR() macro - comparators should now use regular function definitions to clarify user code.
/** Event handler for the USB_Disconnect event. This indicates that the bootloader should exit and the user\r
* application started.\r
*/\r
-EVENT_HANDLER(USB_Disconnect)\r
+void EVENT_USB_Disconnect(void)\r
{\r
/* Upon disconnection, run user application */\r
RunBootloader = false;\r
/** Event handler for the USB_ConfigurationChanged event. This configures the device's endpoints ready\r
* to relay data to and from the attached USB host.\r
*/\r
-EVENT_HANDLER(USB_ConfigurationChanged)\r
+void EVENT_USB_ConfigurationChanged(void)\r
{\r
/* Setup CDC Notification, Rx and Tx Endpoints */\r
Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,\r
* control requests that are not handled internally by the USB library, so that they can be handled appropriately\r
* for the application.\r
*/\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
+void EVENT_USB_UnhandledControlPacket(void)\r
{\r
uint8_t* LineCodingData = (uint8_t*)&LineCoding;\r
\r
\r
/** Eight character bootloader firmware identifier reported to the host when requested */\r
#define SOFTWARE_IDENTIFIER "LUFACDC"\r
-\r
- /* Event Handlers: */\r
- /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Disconnect);\r
-\r
- /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */\r
- HANDLES_EVENT(USB_ConfigurationChanged);\r
-\r
- /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */\r
- HANDLES_EVENT(USB_UnhandledControlPacket);\r
\r
/* Type Defines: */\r
/** Type define for a non-returning pointer to the start of the loaded application in flash memory. */\r
TASK(CDC_Task);\r
\r
/* Function Prototypes: */\r
+ void EVENT_USB_Disconnect(void);\r
+ void EVENT_USB_ConfigurationChanged(void);\r
+ void EVENT_USB_UnhandledControlPacket(void);\r
+\r
#if defined(INCLUDE_FROM_BOOTLOADERCDC_C) || defined(__DOXYGEN__)\r
static void ReadWriteMemoryBlock(const uint8_t Command);\r
static uint8_t FetchNextCommandByte(void);\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
/** Event handler for the USB_Disconnect event. This indicates that the bootloader should exit and the user\r
* application started.\r
*/\r
-EVENT_HANDLER(USB_Disconnect)\r
+void EventHandler_USB_Disconnect(void)\r
{\r
/* Upon disconnection, run user application */\r
RunBootloader = false;\r
* control requests that are not handled internally by the USB library (including the DFU commands, which are\r
* all issued via the control endpoint), so that they can be handled appropriately for the application.\r
*/\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
+void EventHandler_USB_UnhandledControlPacket(void)\r
{\r
/* Get the size of the command and data from the wLength value */\r
SentCommand.DataSize = USB_ControlRequest.wLength;\r
errUNKNOWN = 14,\r
errSTALLEDPKT = 15\r
};\r
- \r
- /* Event Handlers: */\r
- /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Disconnect);\r
-\r
- /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */\r
- HANDLES_EVENT(USB_UnhandledControlPacket);\r
- \r
+ \r
/* Function Prototypes: */\r
+ void EVENT_USB_Disconnect(void);\r
+ void EVENT_USB_UnhandledControlPacket(void);\r
+\r
#if defined(INCLUDE_FROM_BOOTLOADER_C)\r
static void DiscardFillerBytes(uint8_t NumberOfBytes);\r
static void ProcessBootloaderCommand(void);\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
/** Event handler for the USB_ConfigurationChanged event. This configures the device's endpoints ready\r
* to relay data to and from the attached USB host.\r
*/\r
-EVENT_HANDLER(USB_ConfigurationChanged)\r
+void EVENT_USB_ConfigurationChanged(void)\r
{\r
/* Setup HID Report Endpoint */\r
Endpoint_ConfigureEndpoint(HID_EPNUM, EP_TYPE_INTERRUPT,\r
* control requests that are not handled internally by the USB library (including the HID commands, which are\r
* all issued via the control endpoint), so that they can be handled appropriately for the application.\r
*/\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
+void EVENT_USB_UnhandledControlPacket(void)\r
{\r
/* Handle HID Class specific requests */\r
switch (USB_ControlRequest.bRequest)\r
#define REQ_SetReport 0x09\r
\r
#define TEENSY_STARTAPPLICATION 0xFFFF\r
-\r
- /* Event Handlers: */\r
- /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Disconnect);\r
-\r
- /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */\r
- HANDLES_EVENT(USB_ConfigurationChanged);\r
-\r
- /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */\r
- HANDLES_EVENT(USB_UnhandledControlPacket);\r
+ \r
+ /* Function Prototypes: */\r
+ void EVENT_USB_ConfigurationChanged(void);\r
+ void EVENT_USB_UnhandledControlPacket(void);\r
\r
#endif\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs, and\r
* configures the sample update and PWM timers.\r
*/\r
-EVENT_HANDLER(USB_Connect)\r
+void EVENT_USB_Connect(void)\r
{\r
/* Start USB management task */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);\r
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
* the status LEDs, disables the sample update and PWM output timers and stops the USB and Audio management tasks.\r
*/\r
-EVENT_HANDLER(USB_Disconnect)\r
+void EVENT_USB_Disconnect(void)\r
{\r
/* Stop the sample reload timer */\r
TCCR0B = 0;\r
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration\r
* of the USB device after enumeration - the device endpoints are configured.\r
*/\r
-EVENT_HANDLER(USB_ConfigurationChanged)\r
+void EVENT_USB_ConfigurationChanged(void)\r
{\r
/* Setup audio stream endpoint */\r
Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS,\r
* control requests that are not handled internally by the USB library (including the Audio class-specific\r
* requests) so that they can be handled appropriately for the application.\r
*/\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
+void EVENT_USB_UnhandledControlPacket(void)\r
{\r
/* Process General and Audio specific control requests */\r
switch (USB_ControlRequest.bRequest)\r
/* Task Definitions: */\r
TASK(USB_Audio_Task);\r
\r
- /* Event Handlers: */\r
- /** Indicates that this module will catch the USB_Connect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Connect);\r
-\r
- /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Disconnect);\r
-\r
- /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */\r
- HANDLES_EVENT(USB_ConfigurationChanged);\r
-\r
- /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */\r
- HANDLES_EVENT(USB_UnhandledControlPacket);\r
-\r
/* Function Prototypes: */\r
+ void EVENT_USB_Connect(void);\r
+ void EVENT_USB_Disconnect(void);\r
+ void EVENT_USB_ConfigurationChanged(void);\r
+ void EVENT_USB_UnhandledControlPacket(void);\r
+\r
void UpdateStatus(uint8_t CurrentStatus);\r
\r
#endif\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs, and\r
* configures the sample update and PWM timers.\r
*/\r
-EVENT_HANDLER(USB_Connect)\r
+void EventHandler_USB_Connect(void)\r
{\r
/* Start USB management task */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);\r
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
* the status LEDs, disables the sample update and PWM output timers and stops the USB and Audio management tasks.\r
*/\r
-EVENT_HANDLER(USB_Disconnect)\r
+void EventHandler_USB_Disconnect(void)\r
{\r
/* Stop the timers */\r
TCCR0B = 0;\r
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration\r
* of the USB device after enumeration - the device endpoints are configured.\r
*/\r
-EVENT_HANDLER(USB_ConfigurationChanged)\r
+void EventHandler_USB_ConfigurationChanged(void)\r
{\r
/* Setup audio stream endpoint */\r
Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS,\r
* control requests that are not handled internally by the USB library (including the Audio class-specific\r
* requests) so that they can be handled appropriately for the application.\r
*/\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
+void EventHandler_USB_UnhandledControlPacket(void)\r
{\r
/* Process General and Audio specific control requests */\r
switch (USB_ControlRequest.bRequest)\r
\r
/* Task Definitions: */\r
TASK(USB_Audio_Task);\r
-\r
- /* Event Handlers: */\r
- /** Indicates that this module will catch the USB_Connect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Connect);\r
-\r
- /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Disconnect);\r
-\r
- /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */\r
- HANDLES_EVENT(USB_ConfigurationChanged);\r
-\r
- /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */\r
- HANDLES_EVENT(USB_UnhandledControlPacket);\r
\r
/* Function Prototypes: */\r
+ void EVENT_USB_Connect(void);\r
+ void EVENT_USB_Disconnect(void);\r
+ void EVENT_USB_ConfigurationChanged(void);\r
+ void EVENT_USB_UnhandledControlPacket(void);\r
+ \r
void UpdateStatus(uint8_t CurrentStatus);\r
\r
#endif\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and\r
* starts the library USB task to begin the enumeration and USB management process.\r
*/\r
-EVENT_HANDLER(USB_Connect)\r
+void EVENT_USB_Connect(void)\r
{\r
/* Start USB management task */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);\r
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
* the status LEDs and stops the USB management and CDC management tasks.\r
*/\r
-EVENT_HANDLER(USB_Disconnect)\r
+void EVENT_USB_Disconnect(void)\r
{\r
/* Stop running CDC and USB management tasks */\r
Scheduler_SetTaskMode(CDC_Task, TASK_STOP);\r
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration\r
* of the USB device after enumeration - the device endpoints are configured and the CDC management task started.\r
*/\r
-EVENT_HANDLER(USB_ConfigurationChanged)\r
+void EVENT_USB_ConfigurationChanged(void)\r
{\r
/* Setup CDC Notification, Rx and Tx Endpoints */\r
Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,\r
* control requests that are not handled internally by the USB library (including the CDC control commands,\r
* which are all issued via the control endpoint), so that they can be handled appropriately for the application.\r
*/\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
+void EVENT_USB_UnhandledControlPacket(void)\r
{\r
uint8_t* LineCodingData = (uint8_t*)&LineCoding;\r
\r
*/\r
#define CONTROL_LINE_IN_OVERRUNERROR (1 << 6)\r
\r
- /* Event Handlers: */\r
- /** Indicates that this module will catch the USB_Connect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Connect);\r
-\r
- /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Disconnect);\r
-\r
- /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */\r
- HANDLES_EVENT(USB_ConfigurationChanged);\r
-\r
- /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */\r
- HANDLES_EVENT(USB_UnhandledControlPacket);\r
- \r
/* Type Defines: */\r
/** Type define for the virtual serial port line encoding settings, for storing the current USART configuration\r
* as set by the host via a class specific request.\r
TASK(CDC_Task);\r
\r
/* Function Prototypes: */\r
+ void EVENT_USB_Connect(void);\r
+ void EVENT_USB_Disconnect(void);\r
+ void EVENT_USB_ConfigurationChanged(void);\r
+ void EVENT_USB_UnhandledControlPacket(void);\r
+\r
void UpdateStatus(uint8_t CurrentStatus);\r
\r
#endif\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and\r
* starts the library USB task to begin the enumeration and USB management process.\r
*/\r
-EVENT_HANDLER(USB_Connect)\r
+void EVENT_USB_Connect(void)\r
{\r
/* Start USB management task */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);\r
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
* the status LEDs and stops the USB management and CDC management tasks.\r
*/\r
-EVENT_HANDLER(USB_Disconnect)\r
+void EVENT_USB_Disconnect(void)\r
{\r
/* Stop running CDC and USB management tasks */\r
Scheduler_SetTaskMode(CDC1_Task, TASK_STOP);\r
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration\r
* of the USB device after enumeration - the device endpoints are configured and the CDC management tasks are started.\r
*/\r
-EVENT_HANDLER(USB_ConfigurationChanged)\r
+void EVENT_USB_ConfigurationChanged(void)\r
{\r
/* Setup CDC Notification, Rx and Tx Endpoints for the first CDC */\r
Endpoint_ConfigureEndpoint(CDC1_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,\r
* control requests that are not handled internally by the USB library (including the CDC control commands,\r
* which are all issued via the control endpoint), so that they can be handled appropriately for the application.\r
*/\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
+void EVENT_USB_UnhandledControlPacket(void)\r
{\r
/* Determine which interface's Line Coding data is being set from the wIndex parameter */\r
uint8_t* LineCodingData = (USB_ControlRequest.wIndex == 0) ? (uint8_t*)&LineCoding1 : (uint8_t*)&LineCoding2;\r
/** CDC Class specific request to set the current virtual serial port handshake line states. */\r
#define REQ_SetControlLineState 0x22\r
\r
- /* Event Handlers: */\r
- /** Indicates that this module will catch the USB_Connect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Connect);\r
-\r
- /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Disconnect);\r
-\r
- /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */\r
- HANDLES_EVENT(USB_ConfigurationChanged);\r
-\r
- /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */\r
- HANDLES_EVENT(USB_UnhandledControlPacket);\r
- \r
/* Type Defines: */\r
/** Type define for the virtual serial port line encoding settings, for storing the current USART configuration\r
* as set by the host via a class specific request.\r
TASK(CDC2_Task);\r
\r
/* Function Prototypes: */\r
+ void EVENT_USB_Connect(void);\r
+ void EVENT_USB_Disconnect(void);\r
+ void EVENT_USB_ConfigurationChanged(void);\r
+ void EVENT_USB_UnhandledControlPacket(void);\r
+\r
void UpdateStatus(uint8_t CurrentStatus);\r
\r
#endif\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and\r
* starts the library USB task to begin the enumeration and USB management process.\r
*/\r
-EVENT_HANDLER(USB_Connect)\r
+void EVENT_USB_Connect(void)\r
{\r
/* Start USB management task */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);\r
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
* the status LEDs and stops the USB management task.\r
*/\r
-EVENT_HANDLER(USB_Disconnect)\r
+void EVENT_USB_Disconnect(void)\r
{\r
/* Stop running HID reporting and USB management tasks */\r
Scheduler_SetTaskMode(USB_HID_Report, TASK_STOP);\r
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration\r
* of the USB device after enumeration, and configures the generic HID device endpoints.\r
*/\r
-EVENT_HANDLER(USB_ConfigurationChanged)\r
+void EVENT_USB_ConfigurationChanged(void)\r
{\r
/* Setup Generic IN Report Endpoint */\r
Endpoint_ConfigureEndpoint(GENERIC_IN_EPNUM, EP_TYPE_INTERRUPT,\r
* control requests that are not handled internally by the USB library (including the HID commands, which are\r
* all issued via the control endpoint), so that they can be handled appropriately for the application.\r
*/\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
+void EVENT_USB_UnhandledControlPacket(void)\r
{\r
/* Handle HID Class specific requests */\r
switch (USB_ControlRequest.bRequest)\r
Status_USBReady = 2, /**< USB interface is connected and ready */\r
};\r
\r
- /* Event Handlers: */\r
- /** Indicates that this module will catch the USB_Connect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Connect);\r
-\r
- /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Disconnect);\r
-\r
- /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */\r
- HANDLES_EVENT(USB_ConfigurationChanged);\r
- \r
/* Task Definitions: */\r
TASK(USB_HID_Report);\r
\r
/* Function Prototypes: */\r
+ void EVENT_USB_Connect(void);\r
+ void EVENT_USB_Disconnect(void);\r
+ void EVENT_USB_ConfigurationChanged(void);\r
+ void EVENT_USB_UnhandledControlPacket(void);\r
+\r
void UpdateStatus(uint8_t CurrentStatus);\r
void ProcessGenericHIDReport(uint8_t* DataArray);\r
void CreateGenericHIDReport(uint8_t* DataArray);\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and\r
* starts the library USB task to begin the enumeration and USB management process.\r
*/\r
-EVENT_HANDLER(USB_Connect)\r
+void EVENT_USB_Connect(void)\r
{\r
/* Start USB management task */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);\r
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
* the status LEDs and stops the USB management and joystick reporting tasks.\r
*/\r
-EVENT_HANDLER(USB_Disconnect)\r
+void EVENT_USB_Disconnect(void)\r
{\r
/* Stop running joystick reporting and USB management tasks */\r
Scheduler_SetTaskMode(USB_Joystick_Report, TASK_STOP);\r
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration\r
* of the USB device after enumeration - the device endpoints are configured and the joystick reporting task started.\r
*/ \r
-EVENT_HANDLER(USB_ConfigurationChanged)\r
+void EVENT_USB_ConfigurationChanged(void)\r
{\r
/* Setup Joystick Report Endpoint */\r
Endpoint_ConfigureEndpoint(JOYSTICK_EPNUM, EP_TYPE_INTERRUPT,\r
* control requests that are not handled internally by the USB library (including the HID commands, which are\r
* all issued via the control endpoint), so that they can be handled appropriately for the application.\r
*/\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
+void EVENT_USB_UnhandledControlPacket(void)\r
{\r
/* Handle HID Class specific requests */\r
switch (USB_ControlRequest.bRequest)\r
Status_USBReady = 2, /**< USB interface is connected and ready */\r
};\r
\r
- /* Event Handlers: */\r
- /** Indicates that this module will catch the USB_Connect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Connect);\r
-\r
- /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Disconnect);\r
-\r
- /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */\r
- HANDLES_EVENT(USB_ConfigurationChanged);\r
-\r
- /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */\r
- HANDLES_EVENT(USB_UnhandledControlPacket);\r
- \r
/* Function Prototypes: */\r
+ void EVENT_USB_Connect(void);\r
+ void EVENT_USB_Disconnect(void);\r
+ void EVENT_USB_ConfigurationChanged(void);\r
+ void EVENT_USB_UnhandledControlPacket(void);\r
+\r
bool GetNextReport(USB_JoystickReport_Data_t* ReportData);\r
void UpdateStatus(uint8_t CurrentStatus);\r
\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and\r
* starts the library USB task to begin the enumeration and USB management process.\r
*/\r
-EVENT_HANDLER(USB_Connect)\r
+void EVENT_USB_Connect(void)\r
{\r
/* Start USB management task */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);\r
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
* the status LEDs.\r
*/\r
-EVENT_HANDLER(USB_Disconnect)\r
+void EVENT_USB_Disconnect(void)\r
{\r
/* Stop running keyboard reporting and USB management tasks */\r
Scheduler_SetTaskMode(USB_Keyboard_Report, TASK_STOP);\r
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration\r
* of the USB device after enumeration, and configures the keyboard device endpoints.\r
*/\r
-EVENT_HANDLER(USB_ConfigurationChanged)\r
+void EVENT_USB_ConfigurationChanged(void)\r
{\r
/* Setup Keyboard Keycode Report Endpoint */\r
Endpoint_ConfigureEndpoint(KEYBOARD_EPNUM, EP_TYPE_INTERRUPT,\r
* control requests that are not handled internally by the USB library (including the HID commands, which are\r
* all issued via the control endpoint), so that they can be handled appropriately for the application.\r
*/\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
+void EVENT_USB_UnhandledControlPacket(void)\r
{\r
/* Handle HID Class specific requests */\r
switch (USB_ControlRequest.bRequest)\r
Endpoint_ClearSETUP();\r
\r
/* Set or clear the flag depending on what the host indicates that the current Protocol should be */\r
- UsingReportProtocol = (USB_ControlRequest.wValue != 0x0000);\r
+ UsingReportProtocol = (USB_ControlRequest.wValue != 0);\r
\r
/* Acknowledge status stage */\r
while (!(Endpoint_IsINReady()));\r
\r
/* Macros: */\r
/** Idle period indicating that reports should be sent only when the inputs have changed */\r
- #define HID_IDLE_CHANGESONLY 0\r
+ #define HID_IDLE_CHANGESONLY 0\r
\r
/** HID Class specific request to get the next HID report from the device. */\r
- #define REQ_GetReport 0x01\r
+ #define REQ_GetReport 0x01\r
\r
/** HID Class specific request to get the idle timeout period of the device. */\r
- #define REQ_GetIdle 0x02\r
+ #define REQ_GetIdle 0x02\r
\r
/** HID Class specific request to send the next HID report to the device. */\r
- #define REQ_SetReport 0x09\r
+ #define REQ_SetReport 0x09\r
\r
/** HID Class specific request to set the idle timeout period of the device. */\r
- #define REQ_SetIdle 0x0A\r
+ #define REQ_SetIdle 0x0A\r
\r
/** HID Class specific request to get the current HID protocol in use, either report or boot. */\r
- #define REQ_GetProtocol 0x03\r
+ #define REQ_GetProtocol 0x03\r
\r
/** HID Class specific request to set the current HID protocol in use, either report or boot. */\r
- #define REQ_SetProtocol 0x0B\r
+ #define REQ_SetProtocol 0x0B\r
\r
/* Task Definitions: */\r
TASK(USB_Keyboard_Report);\r
Status_USBEnumerating = 1, /**< USB interface is enumerating */\r
Status_USBReady = 2, /**< USB interface is connected and ready */\r
};\r
-\r
- /* Event Handlers: */\r
- /** Indicates that this module will catch the USB_Connect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Connect);\r
-\r
- /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Disconnect);\r
-\r
- /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */\r
- HANDLES_EVENT(USB_ConfigurationChanged);\r
-\r
- /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */\r
- HANDLES_EVENT(USB_UnhandledControlPacket);\r
\r
/* Function Prototypes: */\r
+ void EVENT_USB_Connect(void);\r
+ void EVENT_USB_Disconnect(void);\r
+ void EVENT_USB_ConfigurationChanged(void);\r
+ void EVENT_USB_UnhandledControlPacket(void);\r
+\r
void CreateKeyboardReport(USB_KeyboardReport_Data_t* ReportData);\r
void ProcessLEDReport(uint8_t LEDReport);\r
void SendNextReport(void);\r
void ReceiveNextReport(void);\r
void UpdateStatus(uint8_t CurrentStatus);\r
- \r
+\r
#endif\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and\r
* starts the library USB task to begin the enumeration and USB management process.\r
*/\r
-EVENT_HANDLER(USB_Connect)\r
+void EVENT_USB_Connect(void)\r
{\r
/* Start USB management task */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);\r
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
* the status LEDs and stops the USB management task.\r
*/\r
-EVENT_HANDLER(USB_Disconnect)\r
+void EVENT_USB_Disconnect(void)\r
{\r
/* Stop running HID reporting and USB management tasks */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);\r
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration\r
* of the USB device after enumeration, and configures the keyboard and mouse device endpoints.\r
*/\r
-EVENT_HANDLER(USB_ConfigurationChanged)\r
+void EVENT_USB_ConfigurationChanged(void)\r
{\r
/* Setup Keyboard Report Endpoint */\r
Endpoint_ConfigureEndpoint(KEYBOARD_IN_EPNUM, EP_TYPE_INTERRUPT,\r
* control requests that are not handled internally by the USB library (including the HID commands, which are\r
* all issued via the control endpoint), so that they can be handled appropriately for the application.\r
*/\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
+void EVENT_USB_UnhandledControlPacket(void)\r
{\r
uint8_t* ReportData;\r
uint8_t ReportSize;\r
int8_t Y; /**< Current mouse delta Y movement, as a signed 8-bit integer */\r
} USB_MouseReport_Data_t;\r
\r
- /* Event Handlers: */\r
- /** Indicates that this module will catch the USB_Connect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Connect);\r
-\r
- /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Disconnect);\r
-\r
- /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */\r
- HANDLES_EVENT(USB_ConfigurationChanged);\r
-\r
- /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */\r
- HANDLES_EVENT(USB_UnhandledControlPacket);\r
-\r
/* Function Prototypes: */\r
+ void EVENT_USB_Connect(void);\r
+ void EVENT_USB_Disconnect(void);\r
+ void EVENT_USB_ConfigurationChanged(void);\r
+ void EVENT_USB_UnhandledControlPacket(void);\r
+\r
void UpdateStatus(uint8_t CurrentStatus);\r
\r
#endif\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
}\r
\r
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs. */\r
-EVENT_HANDLER(USB_Connect)\r
+void EVENT_USB_Connect(void)\r
{\r
/* Start USB management task */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);\r
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
* the status LEDs, disables the sample update and PWM output timers and stops the USB and MIDI management tasks.\r
*/\r
-EVENT_HANDLER(USB_Disconnect)\r
+void EVENT_USB_Disconnect(void)\r
{\r
/* Stop running audio and USB management tasks */\r
Scheduler_SetTaskMode(USB_MIDI_Task, TASK_STOP);\r
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration\r
* of the USB device after enumeration - the device endpoints are configured and the MIDI management task started.\r
*/\r
-EVENT_HANDLER(USB_ConfigurationChanged)\r
+void EVENT_USB_ConfigurationChanged(void)\r
{\r
/* Setup MIDI stream endpoints */\r
Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK,\r
/* Task Definitions: */\r
TASK(USB_MIDI_Task);\r
\r
- /* Event Handlers: */\r
- /** Indicates that this module will catch the USB_Connect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Connect);\r
-\r
- /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Disconnect);\r
-\r
- /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */\r
- HANDLES_EVENT(USB_ConfigurationChanged);\r
-\r
/* Function Prototypes: */\r
+ void EVENT_USB_Connect(void);\r
+ void EVENT_USB_Disconnect(void);\r
+ void EVENT_USB_ConfigurationChanged(void);\r
+\r
void SendMIDINoteChange(const uint8_t Pitch, const bool OnOff,\r
const uint8_t CableID, const uint8_t Channel); \r
void UpdateStatus(uint8_t CurrentStatus);\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
}\r
\r
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs. */\r
-EVENT_HANDLER(USB_Connect)\r
+void EventHandler_USB_Connect(void)\r
{\r
/* Indicate USB enumerating */\r
UpdateStatus(Status_USBEnumerating);\r
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
* the status LEDs and stops the Mass Storage management task.\r
*/\r
-EVENT_HANDLER(USB_Disconnect)\r
+void EventHandler_USB_Disconnect(void)\r
{\r
/* Stop running mass storage task */\r
Scheduler_SetTaskMode(USB_MassStorage, TASK_STOP);\r
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration\r
* of the USB device after enumeration - the device endpoints are configured and the Mass Storage management task started.\r
*/\r
-EVENT_HANDLER(USB_ConfigurationChanged)\r
+void EventHandler_USB_ConfigurationChanged(void)\r
{\r
/* Setup Mass Storage In and Out Endpoints */\r
Endpoint_ConfigureEndpoint(MASS_STORAGE_IN_EPNUM, EP_TYPE_BULK,\r
* control requests that are not handled internally by the USB library (including the Mass Storage class-specific\r
* requests) so that they can be handled appropriately for the application.\r
*/\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
+void EventHandler_USB_UnhandledControlPacket(void)\r
{\r
/* Process UFI specific control requests */\r
switch (USB_ControlRequest.bRequest)\r
\r
/* Read in command block header */\r
Endpoint_Read_Stream_LE(&CommandBlock, (sizeof(CommandBlock) - sizeof(CommandBlock.SCSICommandData)),\r
- AbortOnMassStoreReset);\r
+ StreamCallback_AbortOnMassStoreReset);\r
\r
/* Check if the current command is being aborted by the host */\r
if (IsMassStoreReset)\r
/* Read in command block command data */\r
Endpoint_Read_Stream_LE(&CommandBlock.SCSICommandData,\r
CommandBlock.SCSICommandLength,\r
- AbortOnMassStoreReset);\r
+ StreamCallback_AbortOnMassStoreReset);\r
\r
/* Check if the current command is being aborted by the host */\r
if (IsMassStoreReset)\r
\r
/* Write the CSW to the endpoint */\r
Endpoint_Write_Stream_LE(&CommandStatus, sizeof(CommandStatus),\r
- AbortOnMassStoreReset);\r
+ StreamCallback_AbortOnMassStoreReset);\r
\r
/* Check if the current command is being aborted by the host */\r
if (IsMassStoreReset)\r
/** Stream callback function for the Endpoint stream read and write functions. This callback will abort the current stream transfer\r
* if a Mass Storage Reset request has been issued to the control endpoint.\r
*/\r
-STREAM_CALLBACK(AbortOnMassStoreReset)\r
+uint8_t StreamCallback_AbortOnMassStoreReset(void)\r
{ \r
/* Abort if a Mass Storage reset command was received */\r
if (IsMassStoreReset)\r
/* Task Definitions: */\r
TASK(USB_MassStorage);\r
\r
- /* Stream Callbacks: */\r
- STREAM_CALLBACK(AbortOnMassStoreReset);\r
-\r
- /* Event Handlers: */\r
- /** Indicates that this module will catch the USB_Connect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Connect);\r
-\r
- /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Disconnect);\r
-\r
- /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */\r
- HANDLES_EVENT(USB_ConfigurationChanged);\r
-\r
- /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */\r
- HANDLES_EVENT(USB_UnhandledControlPacket);\r
-\r
/* Function Prototypes: */\r
+ void EVENT_USB_Connect(void);\r
+ void EVENT_USB_Disconnect(void);\r
+ void EVENT_USB_ConfigurationChanged(void);\r
+ void EVENT_USB_UnhandledControlPacket(void);\r
+\r
void UpdateStatus(uint8_t CurrentStatus);\r
\r
#if defined(INCLUDE_FROM_MASSSTORAGE_C)\r
static void ReturnCommandStatus(void);\r
#endif\r
\r
+ uint8_t StreamCallback_AbortOnMassStoreReset(void);\r
+\r
#endif\r
}\r
\r
/* Write the INQUIRY data to the endpoint */\r
- Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, AbortOnMassStoreReset);\r
+ Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, StreamCallback_AbortOnMassStoreReset);\r
\r
uint8_t PadBytes[AllocationLength - BytesTransferred];\r
\r
/* Pad out remaining bytes with 0x00 */\r
- Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), AbortOnMassStoreReset);\r
+ Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), StreamCallback_AbortOnMassStoreReset);\r
\r
/* Finalize the stream transfer to send the last packet */\r
Endpoint_ClearIN();\r
uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);\r
\r
/* Send the SENSE data - this indicates to the host the status of the last command */\r
- Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, AbortOnMassStoreReset);\r
+ Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, StreamCallback_AbortOnMassStoreReset);\r
\r
uint8_t PadBytes[AllocationLength - BytesTransferred];\r
\r
/* Pad out remaining bytes with 0x00 */\r
- Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), AbortOnMassStoreReset);\r
+ Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), StreamCallback_AbortOnMassStoreReset);\r
\r
/* Finalize the stream transfer to send the last packet */\r
Endpoint_ClearIN();\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and\r
* starts the library USB task to begin the enumeration and USB management process.\r
*/\r
-EVENT_HANDLER(USB_Connect)\r
+void EVENT_USB_Connect(void)\r
{\r
/* Start USB management task */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);\r
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
* the status LEDs and stops the USB management and Mouse reporting tasks.\r
*/\r
-EVENT_HANDLER(USB_Disconnect)\r
+void EVENT_USB_Disconnect(void)\r
{\r
/* Stop running mouse reporting and USB management tasks */\r
Scheduler_SetTaskMode(USB_Mouse_Report, TASK_STOP);\r
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration\r
* of the USB device after enumeration - the device endpoints are configured and the mouse reporting task started.\r
*/ \r
-EVENT_HANDLER(USB_ConfigurationChanged)\r
+void EVENT_USB_ConfigurationChanged(void)\r
{\r
/* Setup Mouse Report Endpoint */\r
Endpoint_ConfigureEndpoint(MOUSE_EPNUM, EP_TYPE_INTERRUPT,\r
* control requests that are not handled internally by the USB library (including the HID commands, which are\r
* all issued via the control endpoint), so that they can be handled appropriately for the application.\r
*/\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
+void EVENT_USB_UnhandledControlPacket(void)\r
{\r
/* Handle HID Class specific requests */\r
switch (USB_ControlRequest.bRequest)\r
Endpoint_ClearSETUP();\r
\r
/* Set or clear the flag depending on what the host indicates that the current Protocol should be */\r
- UsingReportProtocol = (USB_ControlRequest.wValue != 0x0000);\r
+ UsingReportProtocol = (USB_ControlRequest.wValue != 0);\r
\r
/* Acknowledge status stage */\r
while (!(Endpoint_IsINReady()));\r
Status_USBReady = 2, /**< USB interface is connected and ready */\r
};\r
\r
- /* Event Handlers: */\r
- /** Indicates that this module will catch the USB_Connect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Connect);\r
-\r
- /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Disconnect);\r
-\r
- /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */\r
- HANDLES_EVENT(USB_ConfigurationChanged);\r
-\r
- /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */\r
- HANDLES_EVENT(USB_UnhandledControlPacket);\r
-\r
/* Function Prototypes: */\r
+ void EVENT_USB_Connect(void);\r
+ void EVENT_USB_Disconnect(void);\r
+ void EVENT_USB_ConfigurationChanged(void);\r
+ void EVENT_USB_UnhandledControlPacket(void);\r
+\r
void CreateMouseReport(USB_MouseReport_Data_t* ReportData);\r
void UpdateStatus(uint8_t CurrentStatus);\r
\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and\r
* starts the library USB task to begin the enumeration and USB management process.\r
*/\r
-EVENT_HANDLER(USB_Connect)\r
+void EVENT_USB_Connect(void)\r
{\r
/* Start USB management task */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);\r
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
* the status LEDs and stops all the relevant tasks.\r
*/\r
-EVENT_HANDLER(USB_Disconnect)\r
+void EVENT_USB_Disconnect(void)\r
{\r
/* Stop running TCP/IP and USB management tasks */\r
Scheduler_SetTaskMode(RNDIS_Task, TASK_STOP);\r
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration\r
* of the USB device after enumeration, and configures the RNDIS device endpoints and starts the relevant tasks.\r
*/\r
-EVENT_HANDLER(USB_ConfigurationChanged)\r
+void EVENT_USB_ConfigurationChanged(void)\r
{\r
/* Setup CDC Notification, Rx and Tx Endpoints */\r
Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK,\r
* control requests that are not handled internally by the USB library (including the RNDIS control commands,\r
* which set up the USB RNDIS network adapter), so that they can be handled appropriately for the application.\r
*/\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
+void EVENT_USB_UnhandledControlPacket(void)\r
{\r
/* Process RNDIS class commands */\r
switch (USB_ControlRequest.bRequest)\r
/* Macros: */\r
/** Notification value to indicate that a frame is ready to be read by the host. */\r
#define NOTIF_RESPONSE_AVAILABLE 0x01\r
- \r
- /* Event Handlers: */\r
- /** Indicates that this module will catch the USB_Connect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Connect);\r
-\r
- /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Disconnect);\r
-\r
- /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */\r
- HANDLES_EVENT(USB_ConfigurationChanged);\r
-\r
- /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */\r
- HANDLES_EVENT(USB_UnhandledControlPacket);\r
\r
/* Type Defines: */\r
/** Type define for a RNDIS notification message, for transmission to the RNDIS host via the notification\r
TASK(Ethernet_Task);\r
\r
/* Function Prototypes: */\r
+ void EVENT_USB_Connect(void);\r
+ void EVENT_USB_Disconnect(void);\r
+ void EVENT_USB_ConfigurationChanged(void);\r
+ void EVENT_USB_UnhandledControlPacket(void);\r
+\r
void UpdateStatus(uint8_t CurrentStatus);\r
\r
#endif\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and\r
* starts the library USB task to begin the enumeration and USB management process.\r
*/\r
-EVENT_HANDLER(USB_Connect)\r
+void EVENT_USB_Connect(void)\r
{\r
/* Start USB management task */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);\r
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
* the status LEDs and stops the USB management and CDC management tasks.\r
*/\r
-EVENT_HANDLER(USB_Disconnect)\r
+void EVENT_USB_Disconnect(void)\r
{\r
/* Stop running CDC and USB management tasks */\r
Scheduler_SetTaskMode(CDC_Task, TASK_STOP);\r
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration\r
* of the USB device after enumeration - the device endpoints are configured and the CDC management task started.\r
*/\r
-EVENT_HANDLER(USB_ConfigurationChanged)\r
+void EVENT_USB_ConfigurationChanged(void)\r
{\r
/* Setup CDC Notification, Rx and Tx Endpoints */\r
Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,\r
* control requests that are not handled internally by the USB library (including the CDC control commands,\r
* which are all issued via the control endpoint), so that they can be handled appropriately for the application.\r
*/\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
+void EVENT_USB_UnhandledControlPacket(void)\r
{\r
uint8_t* LineCodingData = (uint8_t*)&LineCoding;\r
\r
*/\r
#define CONTROL_LINE_IN_OVERRUNERROR (1 << 6)\r
\r
- /* Event Handlers: */\r
- /** Indicates that this module will catch the USB_Connect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Connect);\r
-\r
- /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Disconnect);\r
-\r
- /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */\r
- HANDLES_EVENT(USB_ConfigurationChanged);\r
-\r
- /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */\r
- HANDLES_EVENT(USB_UnhandledControlPacket);\r
- \r
/* Type Defines: */\r
/** Type define for the virtual serial port line encoding settings, for storing the current USART configuration\r
* as set by the host via a class specific request.\r
TASK(CDC_Task);\r
\r
/* Function Prototypes: */\r
+ void EVENT_USB_Connect(void);\r
+ void EVENT_USB_Disconnect(void);\r
+ void EVENT_USB_ConfigurationChanged(void);\r
+ void EVENT_USB_UnhandledControlPacket(void);\r
+\r
void ReconfigureUSART(void);\r
void UpdateStatus(uint8_t CurrentStatus);\r
\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and\r
* starts the library USB task to begin the enumeration and USB management process.\r
*/\r
-EVENT_HANDLER(USB_DeviceAttached)\r
+void EVENT_USB_DeviceAttached(void)\r
{\r
puts_P(PSTR("Device Attached.\r\n"));\r
UpdateStatus(Status_USBEnumerating);\r
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and\r
* stops the library USB task management process.\r
*/\r
-EVENT_HANDLER(USB_DeviceUnattached)\r
+void EVENT_USB_DeviceUnattached(void)\r
{\r
/* Stop keyboard and USB management task */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);\r
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully\r
* enumerated by the host and is now ready to be used by the application.\r
*/\r
-EVENT_HANDLER(USB_DeviceEnumerationComplete)\r
+void EVENT_USB_DeviceEnumerationComplete(void)\r
{\r
/* Start CDC Host task */\r
Scheduler_SetTaskMode(USB_CDC_Host, TASK_RUN);\r
}\r
\r
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */\r
-EVENT_HANDLER(USB_HostError)\r
+void EVENT_USB_HostError(const uint8_t ErrorCode)\r
{\r
USB_ShutDown();\r
\r
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while\r
* enumerating an attached USB device.\r
*/\r
-EVENT_HANDLER(USB_DeviceEnumerationFailed)\r
+void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)\r
{\r
puts_P(PSTR(ESC_BG_RED "Dev Enum Error\r\n"));\r
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);\r
/* Task Definitions: */\r
TASK(USB_CDC_Host);\r
\r
- /* Event Handlers: */\r
- HANDLES_EVENT(USB_DeviceAttached);\r
- HANDLES_EVENT(USB_DeviceUnattached);\r
- HANDLES_EVENT(USB_DeviceEnumerationComplete);\r
- HANDLES_EVENT(USB_HostError);\r
- HANDLES_EVENT(USB_DeviceEnumerationFailed);\r
-\r
/* Function Prototypes: */\r
+ void EVENT_USB_HostError(const uint8_t ErrorCode);\r
+ void EVENT_USB_DeviceAttached(void);\r
+ void EVENT_USB_DeviceUnattached(void);\r
+ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);\r
+ void EVENT_USB_DeviceEnumerationComplete(void);\r
+\r
void UpdateStatus(uint8_t CurrentStatus);\r
\r
#endif\r
\r
/* Get the CDC control interface from the configuration descriptor */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoCDCInterfaceFound;\r
{\r
/* Fetch the next bulk or interrupt endpoint from the current CDC interface */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextInterfaceCDCDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextInterfaceCDCDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Check to see if the control interface's notification pipe has been found, if so search for the data interface */\r
if (FoundEndpoints & (1 << CDC_NOTIFICATIONPIPE))\r
{\r
/* Get the next CDC data interface from the configuration descriptor (CDC class has two CDC interfaces) */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, \r
- NextCDCDataInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextCDCDataInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoCDCInterfaceFound;\r
\r
/* Get the next CDC control interface from the configuration descriptor (CDC class has two CDC interfaces) */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoCDCInterfaceFound;\r
\r
/* Fetch the next bulk or interrupt endpoint from the current CDC interface */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextInterfaceCDCDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextInterfaceCDCDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoEndpointFound;\r
*\r
* \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
*/\r
-DESCRIPTOR_COMPARATOR(NextCDCControlInterface)\r
+uint8_t DComp_NextCDCControlInterface(void* CurrentDescriptor)\r
{\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)\r
{\r
*\r
* \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
*/\r
-DESCRIPTOR_COMPARATOR(NextCDCDataInterface)\r
+uint8_t DComp_NextCDCDataInterface(void* CurrentDescriptor)\r
{\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)\r
{\r
*\r
* \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
*/\r
-DESCRIPTOR_COMPARATOR(NextInterfaceCDCDataEndpoint)\r
+uint8_t DComp_NextInterfaceCDCDataEndpoint(void* CurrentDescriptor)\r
{\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)\r
{\r
NoEndpointFound = 5, /**< Compatible CDC endpoints were not found in the device's CDC interface */\r
};\r
\r
- /* Configuration Descriptor Comparison Functions: */\r
- DESCRIPTOR_COMPARATOR(NextCDCControlInterface);\r
- DESCRIPTOR_COMPARATOR(NextCDCDataInterface);\r
- DESCRIPTOR_COMPARATOR(NextInterfaceCDCDataEndpoint);\r
-\r
/* Function Prototypes: */\r
uint8_t ProcessConfigurationDescriptor(void); \r
-\r
+ \r
+ uint8_t DComp_NextCDCControlInterface(void* CurrentDescriptor);\r
+ uint8_t DComp_NextCDCDataInterface(void* CurrentDescriptor);\r
+ uint8_t DComp_NextInterfaceCDCDataEndpoint(void* CurrentDescriptor);\r
+ \r
#endif\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
\r
/* Get the HID interface from the configuration descriptor */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextHIDInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextHIDInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoHIDInterfaceFound;\r
{\r
/* Get the next HID interface's data endpoint descriptor */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextInterfaceHIDDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextInterfaceHIDDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Not all HID devices have an OUT endpoint - if we've reached the end of the HID descriptor\r
* but only found the mandatory IN endpoint, it's safe to continue with the device enumeration */\r
*\r
* \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
*/\r
-DESCRIPTOR_COMPARATOR(NextHIDInterface)\r
+uint8_t DComp_NextHIDInterface(void* CurrentDescriptor)\r
{\r
/* Determine if the current descriptor is an interface descriptor */\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)\r
*\r
* \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
*/\r
-DESCRIPTOR_COMPARATOR(NextInterfaceHIDDataEndpoint)\r
+uint8_t DComp_NextInterfaceHIDDataEndpoint(void* CurrentDescriptor)\r
{\r
/* Determine the type of the current descriptor */\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)\r
NoEndpointFound = 5, /**< A compatible HID IN endpoint was not found in the device's HID interface */\r
}; \r
\r
- /* Configuration Descriptor Comparison Functions: */\r
- DESCRIPTOR_COMPARATOR(NextHIDInterface);\r
- DESCRIPTOR_COMPARATOR(NextInterfaceHIDDataEndpoint);\r
-\r
/* Function Prototypes: */\r
- uint8_t ProcessConfigurationDescriptor(void); \r
+ uint8_t ProcessConfigurationDescriptor(void);\r
+\r
+ uint8_t DComp_NextHIDInterface(void* CurrentDescriptor);\r
+ uint8_t DComp_NextInterfaceHIDDataEndpoint(void* CurrentDescriptor);\r
\r
#endif\r
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and\r
* starts the library USB task to begin the enumeration and USB management process.\r
*/\r
-EVENT_HANDLER(USB_DeviceAttached)\r
+void EVENT_USB_DeviceAttached(void)\r
{\r
puts_P(PSTR("Device Attached.\r\n"));\r
UpdateStatus(Status_USBEnumerating);\r
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and\r
* stops the library USB task management process.\r
*/\r
-EVENT_HANDLER(USB_DeviceUnattached)\r
+void EVENT_USB_DeviceUnattached(void)\r
{\r
/* Stop HID and USB management task */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);\r
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully\r
* enumerated by the host and is now ready to be used by the application.\r
*/\r
-EVENT_HANDLER(USB_DeviceEnumerationComplete)\r
+void EVENT_USB_DeviceEnumerationComplete(void)\r
{\r
/* Start HID Host task */\r
Scheduler_SetTaskMode(USB_HID_Host, TASK_RUN);\r
}\r
\r
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */\r
-EVENT_HANDLER(USB_HostError)\r
+void EVENT_USB_HostError(const uint8_t ErrorCode)\r
{\r
USB_ShutDown();\r
\r
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while\r
* enumerating an attached USB device.\r
*/\r
-EVENT_HANDLER(USB_DeviceEnumerationFailed)\r
+void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)\r
{\r
puts_P(PSTR(ESC_BG_RED "Dev Enum Error\r\n"));\r
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);\r
Status_EnumerationError = 3, /**< Software error while enumerating the attached USB device */\r
Status_HardwareError = 4, /**< Hardware error while enumerating the attached USB device */\r
};\r
- \r
- /* Event Handlers: */\r
- HANDLES_EVENT(USB_DeviceAttached);\r
- HANDLES_EVENT(USB_DeviceUnattached);\r
- HANDLES_EVENT(USB_DeviceEnumerationComplete);\r
- HANDLES_EVENT(USB_HostError);\r
- HANDLES_EVENT(USB_DeviceEnumerationFailed);\r
\r
/* Function Prototypes: */\r
+ void EVENT_USB_HostError(const uint8_t ErrorCode);\r
+ void EVENT_USB_DeviceAttached(void);\r
+ void EVENT_USB_DeviceUnattached(void);\r
+ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);\r
+ void EVENT_USB_DeviceEnumerationComplete(void);\r
+\r
void UpdateStatus(uint8_t CurrentStatus);\r
void ReadNextReport(void);\r
void WriteNextReport(uint8_t* ReportOUTData, uint8_t ReportIndex, uint8_t ReportType, uint16_t ReportLength);\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
\r
/* Get the keyboard interface from the configuration descriptor */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextKeyboardInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextKeyboardInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoHIDInterfaceFound;\r
\r
/* Get the keyboard interface's data endpoint descriptor */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextInterfaceKeyboardDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextInterfaceKeyboardDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoEndpointFound;\r
*\r
* \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
*/\r
-DESCRIPTOR_COMPARATOR(NextKeyboardInterface)\r
+uint8_t DComp_NextKeyboardInterface(void* CurrentDescriptor)\r
{\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)\r
{\r
*\r
* \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
*/\r
-DESCRIPTOR_COMPARATOR(NextInterfaceKeyboardDataEndpoint)\r
+uint8_t DComp_NextInterfaceKeyboardDataEndpoint(void* CurrentDescriptor)\r
{\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)\r
{\r
NoHIDInterfaceFound = 4, /**< A compatible HID interface was not found in the device's Configuration Descriptor */\r
NoEndpointFound = 5, /**< A compatible HID IN endpoint was not found in the device's HID interface */\r
};\r
- \r
- /* Configuration Descriptor Comparison Functions: */\r
- DESCRIPTOR_COMPARATOR(NextKeyboardInterface);\r
- DESCRIPTOR_COMPARATOR(NextInterfaceKeyboardDataEndpoint);\r
\r
/* Function Prototypes: */\r
- uint8_t ProcessConfigurationDescriptor(void); \r
+ uint8_t ProcessConfigurationDescriptor(void);\r
+ \r
+ uint8_t DComp_NextKeyboardInterface(void* CurrentDescriptor);\r
+ uint8_t DComp_NextInterfaceKeyboardDataEndpoint(void* CurrentDescriptor);\r
\r
#endif\r
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and\r
* starts the library USB task to begin the enumeration and USB management process.\r
*/\r
-EVENT_HANDLER(USB_DeviceAttached)\r
+void EVENT_USB_DeviceAttached(void)\r
{\r
puts_P(PSTR("Device Attached.\r\n"));\r
UpdateStatus(Status_USBEnumerating);\r
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and\r
* stops the library USB task management process.\r
*/\r
-EVENT_HANDLER(USB_DeviceUnattached)\r
+void EVENT_USB_DeviceUnattached(void)\r
{\r
/* Stop Keyboard and USB management task */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);\r
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully\r
* enumerated by the host and is now ready to be used by the application.\r
*/\r
-EVENT_HANDLER(USB_DeviceEnumerationComplete)\r
+void EVENT_USB_DeviceEnumerationComplete(void)\r
{\r
/* Start Keyboard Host task */\r
Scheduler_SetTaskMode(USB_Keyboard_Host, TASK_RUN);\r
}\r
\r
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */\r
-EVENT_HANDLER(USB_HostError)\r
+void EVENT_USB_HostError(const uint8_t ErrorCode)\r
{\r
USB_ShutDown();\r
\r
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while\r
* enumerating an attached USB device.\r
*/\r
-EVENT_HANDLER(USB_DeviceEnumerationFailed)\r
+void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)\r
{\r
puts_P(PSTR(ESC_BG_RED "Dev Enum Error\r\n"));\r
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);\r
/* Task Definitions: */\r
TASK(USB_Keyboard_Host);\r
\r
- /* Event Handlers: */\r
- HANDLES_EVENT(USB_DeviceAttached);\r
- HANDLES_EVENT(USB_DeviceUnattached);\r
- HANDLES_EVENT(USB_DeviceEnumerationComplete);\r
- HANDLES_EVENT(USB_HostError);\r
- HANDLES_EVENT(USB_DeviceEnumerationFailed);\r
-\r
/* Function Prototypes: */\r
+ void EVENT_USB_HostError(const uint8_t ErrorCode);\r
+ void EVENT_USB_DeviceAttached(void);\r
+ void EVENT_USB_DeviceUnattached(void);\r
+ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);\r
+ void EVENT_USB_DeviceEnumerationComplete(void);\r
+\r
void UpdateStatus(uint8_t CurrentStatus);\r
void ReadNextReport(void);\r
\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
\r
/* Get the keyboard interface from the configuration descriptor */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextKeyboardInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextKeyboardInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoHIDInterfaceFound;\r
\r
/* Get the keyboard interface's HID descriptor */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextHID) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextHID) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoHIDDescriptorFound;\r
\r
/* Get the keyboard interface's data endpoint descriptor */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextInterfaceKeyboardDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextInterfaceKeyboardDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoEndpointFound;\r
*\r
* \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
*/\r
-DESCRIPTOR_COMPARATOR(NextKeyboardInterface)\r
+uint8_t DComp_NextKeyboardInterface(void* CurrentDescriptor)\r
{\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)\r
{\r
*\r
* \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
*/\r
-DESCRIPTOR_COMPARATOR(NextInterfaceKeyboardDataEndpoint)\r
+uint8_t DComp_NextInterfaceKeyboardDataEndpoint(void* CurrentDescriptor)\r
{\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)\r
{\r
*\r
* \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
*/\r
-DESCRIPTOR_COMPARATOR(NextHID)\r
+uint8_t DComp_NextHID(void* CurrentDescriptor)\r
{\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_HID)\r
return DESCRIPTOR_SEARCH_Found;\r
NoHIDDescriptorFound = 5, /**< A compatible HID descriptor was not found in the device's HID interface */\r
NoEndpointFound = 5, /**< A compatible HID IN endpoint was not found in the device's HID interface */\r
};\r
- \r
- /* Configuration Descriptor Comparison Functions: */\r
- DESCRIPTOR_COMPARATOR(NextKeyboardInterface);\r
- DESCRIPTOR_COMPARATOR(NextInterfaceKeyboardDataEndpoint);\r
- DESCRIPTOR_COMPARATOR(NextHID);\r
\r
/* Function Prototypes: */\r
- uint8_t ProcessConfigurationDescriptor(void); \r
+ uint8_t ProcessConfigurationDescriptor(void);\r
\r
+ uint8_t DComp_NextKeyboardInterface(void* CurrentDescriptor);\r
+ uint8_t DComp_NextInterfaceKeyboardDataEndpoint(void* CurrentDescriptor);\r
+ uint8_t DComp_NextHID(void* CurrentDescriptor);\r
+ \r
#endif\r
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and\r
* starts the library USB task to begin the enumeration and USB management process.\r
*/\r
-EVENT_HANDLER(USB_DeviceAttached)\r
+void EVENT_USB_DeviceAttached(void)\r
{\r
puts_P(PSTR("Device Attached.\r\n"));\r
UpdateStatus(Status_USBEnumerating);\r
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and\r
* stops the library USB task management process.\r
*/\r
-EVENT_HANDLER(USB_DeviceUnattached)\r
+void EVENT_USB_DeviceUnattached(void)\r
{\r
/* Stop keyboard and USB management task */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);\r
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully\r
* enumerated by the host and is now ready to be used by the application.\r
*/\r
-EVENT_HANDLER(USB_DeviceEnumerationComplete)\r
+void EVENT_USB_DeviceEnumerationComplete(void)\r
{\r
/* Start Keyboard Host task */\r
Scheduler_SetTaskMode(USB_Keyboard_Host, TASK_RUN);\r
}\r
\r
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */\r
-EVENT_HANDLER(USB_HostError)\r
+void EVENT_USB_HostError(const uint8_t ErrorCode)\r
{\r
USB_ShutDown();\r
\r
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while\r
* enumerating an attached USB device.\r
*/\r
-EVENT_HANDLER(USB_DeviceEnumerationFailed)\r
+void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)\r
{\r
puts_P(PSTR(ESC_BG_RED "Dev Enum Error\r\n"));\r
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);\r
/* Task Definitions: */\r
TASK(USB_Keyboard_Host);\r
\r
- /* Event Handlers: */\r
- HANDLES_EVENT(USB_DeviceAttached);\r
- HANDLES_EVENT(USB_DeviceUnattached);\r
- HANDLES_EVENT(USB_DeviceEnumerationComplete);\r
- HANDLES_EVENT(USB_HostError);\r
- HANDLES_EVENT(USB_DeviceEnumerationFailed);\r
-\r
/* Function Prototypes: */\r
+ void EVENT_USB_HostError(const uint8_t ErrorCode);\r
+ void EVENT_USB_DeviceAttached(void);\r
+ void EVENT_USB_DeviceUnattached(void);\r
+ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);\r
+ void EVENT_USB_DeviceEnumerationComplete(void);\r
+\r
void UpdateStatus(uint8_t CurrentStatus);\r
void ProcessKeyboardReport(uint8_t* KeyboardReport);\r
\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
\r
/* Get the mass storage interface from the configuration descriptor */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextMassStorageInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextMassStorageInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoInterfaceFound;\r
{\r
/* Fetch the next bulk endpoint from the current mass storage interface */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextInterfaceBulkDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextInterfaceBulkDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoEndpointFound;\r
*\r
* \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
*/\r
-DESCRIPTOR_COMPARATOR(NextMassStorageInterface)\r
+uint8_t DComp_NextMassStorageInterface(void* CurrentDescriptor)\r
{\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)\r
{\r
*\r
* \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
*/\r
-DESCRIPTOR_COMPARATOR(NextInterfaceBulkDataEndpoint)\r
+uint8_t DComp_NextInterfaceBulkDataEndpoint(void* CurrentDescriptor)\r
{\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)\r
{\r
NoInterfaceFound = 4, /**< A compatible MSD interface was not found in the device's Configuration Descriptor */\r
NoEndpointFound = 5, /**< The correct MSD endpoint descriptors were not found in the device's MSD interface */\r
};\r
-\r
- /* Configuration Descriptor Comparison Functions: */\r
- DESCRIPTOR_COMPARATOR(NextMassStorageInterface);\r
- DESCRIPTOR_COMPARATOR(NextInterfaceBulkDataEndpoint);\r
-\r
+ \r
/* Function Prototypes: */\r
uint8_t ProcessConfigurationDescriptor(void); \r
\r
+ uint8_t DComp_NextMassStorageInterface(void* CurrentDescriptor);\r
+ uint8_t DComp_NextInterfaceBulkDataEndpoint(void* CurrentDescriptor);\r
+ \r
#endif\r
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and\r
* starts the library USB task to begin the enumeration and USB management process.\r
*/\r
-EVENT_HANDLER(USB_DeviceAttached)\r
+void EVENT_USB_DeviceAttached(void)\r
{\r
puts_P(PSTR("Device Attached.\r\n"));\r
UpdateStatus(Status_USBEnumerating);\r
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and\r
* stops the library USB task management process.\r
*/\r
-EVENT_HANDLER(USB_DeviceUnattached)\r
+void EVENT_USB_DeviceUnattached(void)\r
{\r
/* Stop USB management and Mass Storage tasks */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);\r
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully\r
* enumerated by the host and is now ready to be used by the application.\r
*/\r
-EVENT_HANDLER(USB_DeviceEnumerationComplete)\r
+void EVENT_USB_DeviceEnumerationComplete(void)\r
{\r
/* Once device is fully enumerated, start the Mass Storage Host task */\r
Scheduler_SetTaskMode(USB_MassStore_Host, TASK_RUN);\r
}\r
\r
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */\r
-EVENT_HANDLER(USB_HostError)\r
+void EVENT_USB_HostError(const uint8_t ErrorCode)\r
{\r
USB_ShutDown();\r
\r
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while\r
* enumerating an attached USB device.\r
*/\r
-EVENT_HANDLER(USB_DeviceEnumerationFailed)\r
+void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)\r
{\r
puts_P(PSTR(ESC_BG_RED "Dev Enum Error\r\n"));\r
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);\r
\r
/* Task Definitions: */\r
TASK(USB_MassStore_Host);\r
-\r
- /* Event Handlers: */\r
- HANDLES_EVENT(USB_DeviceAttached);\r
- HANDLES_EVENT(USB_DeviceUnattached);\r
- HANDLES_EVENT(USB_DeviceEnumerationComplete);\r
- HANDLES_EVENT(USB_HostError);\r
- HANDLES_EVENT(USB_DeviceEnumerationFailed);\r
\r
/* Function Prototypes: */\r
+ void EVENT_USB_HostError(const uint8_t ErrorCode);\r
+ void EVENT_USB_DeviceAttached(void);\r
+ void EVENT_USB_DeviceUnattached(void);\r
+ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);\r
+ void EVENT_USB_DeviceEnumerationComplete(void);\r
+\r
void ShowDiskReadError(char* CommandString, bool FailedAtSCSILayer, uint8_t ErrorCode);\r
void UpdateStatus(uint8_t CurrentStatus); \r
\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
\r
/* Get the mouse interface from the configuration descriptor */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextMouseInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextMouseInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoHIDInterfaceFound;\r
\r
/* Get the mouse interface's data endpoint descriptor */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextInterfaceMouseDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextInterfaceMouseDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoEndpointFound;\r
*\r
* \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
*/\r
-DESCRIPTOR_COMPARATOR(NextMouseInterface)\r
+uint8_t DComp_NextMouseInterface(void* CurrentDescriptor)\r
{\r
/* Determine if the current descriptor is an interface descriptor */\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)\r
*\r
* \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
*/\r
-DESCRIPTOR_COMPARATOR(NextInterfaceMouseDataEndpoint)\r
+uint8_t DComp_NextInterfaceMouseDataEndpoint(void* CurrentDescriptor)\r
{\r
/* Determine the type of the current descriptor */\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)\r
InvalidConfigDataReturned = 3, /**< The device returned an invalid Configuration Descriptor */\r
NoHIDInterfaceFound = 4, /**< A compatible HID interface was not found in the device's Configuration Descriptor */\r
NoEndpointFound = 5, /**< A compatible HID IN endpoint was not found in the device's HID interface */\r
- }; \r
-\r
- /* Configuration Descriptor Comparison Functions: */\r
- DESCRIPTOR_COMPARATOR(NextMouseInterface);\r
- DESCRIPTOR_COMPARATOR(NextInterfaceMouseDataEndpoint);\r
+ };\r
\r
/* Function Prototypes: */\r
- uint8_t ProcessConfigurationDescriptor(void); \r
+ uint8_t ProcessConfigurationDescriptor(void);\r
+\r
+ uint8_t DComp_NextMouseInterface(void* CurrentDescriptor);\r
+ uint8_t DComp_NextInterfaceMouseDataEndpoint(void* CurrentDescriptor);\r
\r
#endif\r
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and\r
* starts the library USB task to begin the enumeration and USB management process.\r
*/\r
-EVENT_HANDLER(USB_DeviceAttached)\r
+void EVENT_USB_DeviceAttached(void)\r
{\r
puts_P(PSTR("Device Attached.\r\n"));\r
UpdateStatus(Status_USBEnumerating);\r
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and\r
* stops the library USB task management process.\r
*/\r
-EVENT_HANDLER(USB_DeviceUnattached)\r
+void EVENT_USB_DeviceUnattached(void)\r
{\r
/* Stop mouse and USB management task */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);\r
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully\r
* enumerated by the host and is now ready to be used by the application.\r
*/\r
-EVENT_HANDLER(USB_DeviceEnumerationComplete)\r
+void EVENT_USB_DeviceEnumerationComplete(void)\r
{\r
/* Start Mouse Host task */\r
Scheduler_SetTaskMode(USB_Mouse_Host, TASK_RUN);\r
}\r
\r
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */\r
-EVENT_HANDLER(USB_HostError)\r
+void EVENT_USB_HostError(const uint8_t ErrorCode)\r
{\r
USB_ShutDown();\r
\r
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while\r
* enumerating an attached USB device.\r
*/\r
-EVENT_HANDLER(USB_DeviceEnumerationFailed)\r
+void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)\r
{\r
puts_P(PSTR(ESC_BG_RED "Dev Enum Error\r\n"));\r
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);\r
Status_HardwareError = 4, /**< Hardware error while enumerating the attached USB device */\r
};\r
\r
- /* Event Handlers: */\r
- HANDLES_EVENT(USB_DeviceAttached);\r
- HANDLES_EVENT(USB_DeviceUnattached);\r
- HANDLES_EVENT(USB_DeviceEnumerationComplete);\r
- HANDLES_EVENT(USB_HostError);\r
- HANDLES_EVENT(USB_DeviceEnumerationFailed);\r
-\r
/* Function Prototypes: */\r
+ void EVENT_USB_HostError(const uint8_t ErrorCode);\r
+ void EVENT_USB_DeviceAttached(void);\r
+ void EVENT_USB_DeviceUnattached(void);\r
+ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);\r
+ void EVENT_USB_DeviceEnumerationComplete(void);\r
+\r
void UpdateStatus(uint8_t CurrentStatus);\r
void ReadNextReport(void);\r
\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
\r
/* Get the mouse interface from the configuration descriptor */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextMouseInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextMouseInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoHIDInterfaceFound;\r
\r
/* Get the mouse interface's HID descriptor */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextHID) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextHID) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoHIDDescriptorFound;\r
\r
/* Get the mouse interface's data endpoint descriptor */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextInterfaceMouseDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextInterfaceMouseDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoEndpointFound;\r
*\r
* \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
*/\r
-DESCRIPTOR_COMPARATOR(NextMouseInterface)\r
+uint8_t DComp_NextMouseInterface(void* CurrentDescriptor)\r
{\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)\r
{\r
*\r
* \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
*/\r
-DESCRIPTOR_COMPARATOR(NextInterfaceMouseDataEndpoint)\r
+uint8_t DComp_NextInterfaceMouseDataEndpoint(void* CurrentDescriptor)\r
{\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)\r
{\r
*\r
* \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
*/\r
-DESCRIPTOR_COMPARATOR(NextHID)\r
+uint8_t DComp_NextHID(void* CurrentDescriptor)\r
{\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_HID)\r
return DESCRIPTOR_SEARCH_Found;\r
NoHIDDescriptorFound = 5, /**< A compatible HID descriptor was not found in the device's HID interface */\r
NoEndpointFound = 5, /**< A compatible HID IN endpoint was not found in the device's HID interface */\r
};\r
- \r
- /* Configuration Descriptor Comparison Functions: */\r
- DESCRIPTOR_COMPARATOR(NextMouseInterface);\r
- DESCRIPTOR_COMPARATOR(NextInterfaceMouseDataEndpoint);\r
- DESCRIPTOR_COMPARATOR(NextHID);\r
\r
/* Function Prototypes: */\r
- uint8_t ProcessConfigurationDescriptor(void); \r
+ uint8_t ProcessConfigurationDescriptor(void);\r
+\r
+ uint8_t DComp_NextMouseInterface(void* CurrentDescriptor);\r
+ uint8_t DComp_NextInterfaceMouseDataEndpoint(void* CurrentDescriptor);\r
+ uint8_t DComp_NextHID(void* CurrentDescriptor);\r
\r
#endif\r
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and\r
* starts the library USB task to begin the enumeration and USB management process.\r
*/\r
-EVENT_HANDLER(USB_DeviceAttached)\r
+void EVENT_USB_DeviceAttached(void)\r
{\r
puts_P(PSTR("Device Attached.\r\n"));\r
UpdateStatus(Status_USBEnumerating);\r
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and\r
* stops the library USB task management process.\r
*/\r
-EVENT_HANDLER(USB_DeviceUnattached)\r
+void EVENT_USB_DeviceUnattached(void)\r
{\r
/* Stop mouse and USB management task */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);\r
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully\r
* enumerated by the host and is now ready to be used by the application.\r
*/\r
-EVENT_HANDLER(USB_DeviceEnumerationComplete)\r
+void EVENT_USB_DeviceEnumerationComplete(void)\r
{\r
/* Start Mouse Host task */\r
Scheduler_SetTaskMode(USB_Mouse_Host, TASK_RUN);\r
}\r
\r
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */\r
-EVENT_HANDLER(USB_HostError)\r
+void EVENT_USB_HostError(const uint8_t ErrorCode)\r
{\r
USB_ShutDown();\r
\r
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while\r
* enumerating an attached USB device.\r
*/\r
-EVENT_HANDLER(USB_DeviceEnumerationFailed)\r
+void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)\r
{\r
puts_P(PSTR(ESC_BG_RED "Dev Enum Error\r\n"));\r
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);\r
\r
/* Task Definitions: */\r
TASK(USB_Mouse_Host);\r
- \r
- /* Event Handlers: */\r
- HANDLES_EVENT(USB_DeviceAttached);\r
- HANDLES_EVENT(USB_DeviceUnattached);\r
- HANDLES_EVENT(USB_DeviceEnumerationComplete);\r
- HANDLES_EVENT(USB_HostError);\r
- HANDLES_EVENT(USB_DeviceEnumerationFailed);\r
\r
/* Function Prototypes: */\r
+ void EVENT_USB_HostError(const uint8_t ErrorCode);\r
+ void EVENT_USB_DeviceAttached(void);\r
+ void EVENT_USB_DeviceUnattached(void);\r
+ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);\r
+ void EVENT_USB_DeviceEnumerationComplete(void);\r
+\r
void UpdateStatus(uint8_t CurrentStatus);\r
void ProcessMouseReport(uint8_t* MouseReport);\r
\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
\r
/* Get the Still Image interface from the configuration descriptor */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextStillImageInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextStillImageInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoInterfaceFound;\r
{\r
/* Fetch the next endpoint from the current Still Image interface */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextSImageInterfaceDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextSImageInterfaceDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoEndpointFound;\r
*\r
* \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
*/\r
-DESCRIPTOR_COMPARATOR(NextStillImageInterface)\r
+uint8_t DComp_NextStillImageInterface(void* CurrentDescriptor)\r
{\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)\r
{\r
*\r
* \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
*/\r
-DESCRIPTOR_COMPARATOR(NextSImageInterfaceDataEndpoint)\r
+uint8_t DComp_NextSImageInterfaceDataEndpoint(void* CurrentDescriptor)\r
{\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)\r
{\r
NoEndpointFound = 5, /**< The correct SI endpoint descriptors were not found in the device's SI interface */\r
};\r
\r
- /* Configuration Descriptor Comparison Functions: */\r
- DESCRIPTOR_COMPARATOR(NextStillImageInterface);\r
- DESCRIPTOR_COMPARATOR(NextSImageInterfaceDataEndpoint);\r
-\r
/* Function Prototypes: */\r
- uint8_t ProcessConfigurationDescriptor(void); \r
+ uint8_t ProcessConfigurationDescriptor(void);\r
+\r
+ uint8_t DComp_NextStillImageInterface(void* CurrentDescriptor);\r
+ uint8_t DComp_NextSImageInterfaceDataEndpoint(void* CurrentDescriptor);\r
\r
#endif\r
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and\r
* starts the library USB task to begin the enumeration and USB management process.\r
*/\r
-EVENT_HANDLER(USB_DeviceAttached)\r
+void EVENT_USB_DeviceAttached(void)\r
{\r
puts_P(PSTR("Device Attached.\r\n"));\r
UpdateStatus(Status_USBEnumerating);\r
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and\r
* stops the library USB task management process.\r
*/\r
-EVENT_HANDLER(USB_DeviceUnattached)\r
+void EVENT_USB_DeviceUnattached(void)\r
{\r
/* Stop USB management and Still Image tasks */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);\r
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully\r
* enumerated by the host and is now ready to be used by the application.\r
*/\r
-EVENT_HANDLER(USB_DeviceEnumerationComplete)\r
+void EVENT_USB_DeviceEnumerationComplete(void)\r
{\r
/* Once device is fully enumerated, start the Still Image Host task */\r
Scheduler_SetTaskMode(USB_SImage_Host, TASK_RUN);\r
}\r
\r
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */\r
-EVENT_HANDLER(USB_HostError)\r
+void EVENT_USB_HostError(const uint8_t ErrorCode)\r
{\r
USB_ShutDown();\r
\r
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while\r
* enumerating an attached USB device.\r
*/\r
-EVENT_HANDLER(USB_DeviceEnumerationFailed)\r
+void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)\r
{\r
puts_P(PSTR(ESC_BG_RED "Dev Enum Error\r\n"));\r
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);\r
/* Task Definitions: */\r
TASK(USB_SImage_Host);\r
\r
- /* Event Handlers: */\r
- HANDLES_EVENT(USB_DeviceAttached);\r
- HANDLES_EVENT(USB_DeviceUnattached);\r
- HANDLES_EVENT(USB_DeviceEnumerationComplete);\r
- HANDLES_EVENT(USB_HostError);\r
- HANDLES_EVENT(USB_DeviceEnumerationFailed);\r
- \r
/* Function Prototypes: */\r
+ void EVENT_USB_HostError(const uint8_t ErrorCode);\r
+ void EVENT_USB_DeviceAttached(void);\r
+ void EVENT_USB_DeviceUnattached(void);\r
+ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);\r
+ void EVENT_USB_DeviceEnumerationComplete(void);\r
+\r
void UnicodeToASCII(uint8_t* restrict UnicodeString, char* restrict Buffer);\r
void ShowCommandError(uint8_t ErrorCode, bool ResponseCodeError);\r
void UpdateStatus(uint8_t CurrentStatus);\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
}\r
\r
/** Event handler for the USB_VBUSChange event. When fired, the event is logged to the USART. */\r
-EVENT_HANDLER(USB_VBUSChange)\r
+void EVENT_USB_VBUSChange(void)\r
{\r
puts_P(PSTR(EVENT_PREFIX "VBUS Change\r\n"));\r
}\r
\r
/** Event handler for the USB_VBUSConnect event. When fired, the event is logged to the USART. */\r
-EVENT_HANDLER(USB_VBUSConnect)\r
+void EVENT_USB_VBUSConnect(void)\r
{\r
puts_P(PSTR(EVENT_PREFIX "VBUS +\r\n"));\r
}\r
\r
/** Event handler for the USB_VBUSDisconnect event. When fired, the event is logged to the USART. */\r
-EVENT_HANDLER(USB_VBUSDisconnect)\r
+void EVENT_USB_VBUSDisconnect(void)\r
{\r
puts_P(PSTR(EVENT_PREFIX "VBUS -\r\n"));\r
}\r
* Event handler for the USB_Connect event. When fired, the event is logged to the USART and the\r
* USB task started.\r
*/\r
-EVENT_HANDLER(USB_Connect)\r
+void EVENT_USB_Connect(void)\r
{\r
puts_P(PSTR(EVENT_PREFIX "USB +\r\n"));\r
LEDs_SetAllLEDs(LEDS_LED2 | LEDS_LED3 | LEDS_LED4);\r
* Event handler for the USB_Disconnect event. When fired, the event is logged to the USART and the\r
* USB task stopped.\r
*/\r
-EVENT_HANDLER(USB_Disconnect)\r
+void EVENT_USB_Disconnect(void)\r
{\r
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);\r
\r
}\r
\r
/** Event handler for the USB_Suspend event. When fired, the event is logged to the USART. */\r
-EVENT_HANDLER(USB_Suspend)\r
+void EVENT_USB_Suspend(void)\r
{\r
puts_P(PSTR(EVENT_PREFIX ESC_BG_YELLOW "USB Sleep\r\n"));\r
LEDs_SetAllLEDs(LEDS_ALL_LEDS);\r
}\r
\r
/** Event handler for the USB_WakeUp event. When fired, the event is logged to the USART. */\r
-EVENT_HANDLER(USB_WakeUp)\r
+void EVENT_USB_WakeUp(void)\r
{\r
puts_P(PSTR(EVENT_PREFIX ESC_BG_GREEN "USB Wakeup\r\n"));\r
LEDs_SetAllLEDs(LEDS_LED2 | LEDS_LED4);\r
}\r
\r
/** Event handler for the USB_Reset event. When fired, the event is logged to the USART. */\r
-EVENT_HANDLER(USB_Reset)\r
+void EVENT_USB_Reset(void)\r
{\r
puts_P(PSTR(EVENT_PREFIX "USB Reset\r\n"));\r
}\r
\r
/** Event handler for the USB_UIDChange event. When fired, the event is logged to the USART. */\r
-EVENT_HANDLER(USB_UIDChange)\r
+void EVENT_USB_UIDChange(void)\r
{\r
char* ModeStrPtr;\r
\r
* Event handler for the USB_PowerOnFail event. When fired, the event is logged to the USART and the program\r
* execution aborted.\r
*/\r
-EVENT_HANDLER(USB_InitFailure)\r
+void EVENT_USB_InitFailure(const uint8_t ErrorCode)\r
{\r
char* ModeStrPtr;\r
\r
* Event handler for the USB_HostError event. When fired, the event is logged to the USART and the program\r
* execution aborted.\r
*/\r
-EVENT_HANDLER(USB_HostError)\r
+void EVENT_USB_HostError(const uint8_t ErrorCode)\r
{\r
puts_P(PSTR(EVENT_PREFIX ESC_BG_RED "Host Mode Error\r\n"));\r
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);\r
}\r
\r
/** Event handler for the USB_DeviceEnumerationFailed event. When fired, the event is logged to the USART. */\r
-EVENT_HANDLER(USB_DeviceEnumerationFailed)\r
+void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)\r
{\r
puts_P(PSTR(ESC_BG_RED "Dev Enum Error\r\n"));\r
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);\r
* Event handler for the USB_DeviceError event. When fired, the event is logged to the USART and the program\r
* execution aborted.\r
*/\r
-EVENT_HANDLER(USB_DeviceError)\r
+void EVENT_USB_DeviceError(const uint8_t ErrorCode)\r
{\r
puts_P(PSTR(EVENT_PREFIX ESC_BG_RED "Device Mode Error\r\n"));\r
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);\r
}\r
\r
/** Event handler for the USB_UnhandledControlPacket event. When fired, the event is logged to the USART. */\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
+void EVENT_USB_UnhandledControlPacket(void)\r
{\r
puts_P(PSTR(EVENT_PREFIX "Ctrl Request\r\n"));\r
printf_P(PSTR(" -- Req Data %d\r\n"), USB_ControlRequest.bRequest);\r
}\r
\r
/** Event handler for the USB_ConfigurationChanged event. When fired, the event is logged to the USART. */\r
-EVENT_HANDLER(USB_ConfigurationChanged)\r
+void EVENT_USB_ConfigurationChanged(void)\r
{\r
puts_P(PSTR(EVENT_PREFIX "Configuration Number Changed\r\n"));\r
\r
}\r
\r
/** Event handler for the USB_DeviceAttached event. When fired, the event is logged to the USART. */\r
-EVENT_HANDLER(USB_DeviceAttached)\r
+void EVENT_USB_DeviceAttached(void)\r
{\r
puts_P(PSTR(EVENT_PREFIX ESC_BG_GREEN "Device +\r\n"));\r
\r
}\r
\r
/** Event handler for the USB_DeviceUnattached event. When fired, the event is logged to the USART. */\r
-EVENT_HANDLER(USB_DeviceUnattached)\r
+void EVENT_USB_DeviceUnattached(void)\r
{\r
puts_P(PSTR(EVENT_PREFIX ESC_BG_YELLOW "Device -\r\n"));\r
}\r
\r
/** Event handler for the USB_DeviceEnumerationComplete event. When fired, the event is logged to the USART. */\r
-EVENT_HANDLER(USB_DeviceEnumerationComplete)\r
+void EVENT_USB_DeviceEnumerationComplete(void)\r
{\r
puts_P(PSTR(EVENT_PREFIX "Device Enumeration Complete\r\n"));\r
}\r
#include <LUFA/Drivers/Misc/TerminalCodes.h> // ANSI Terminal Escape Codes\r
#include <LUFA/Scheduler/Scheduler.h> // Simple scheduler for task management\r
\r
- /* Event Catch List: */\r
- /** Indicates that this module will catch the USB_VBUSChange event when thrown by the library. */\r
- HANDLES_EVENT(USB_VBUSChange);\r
-\r
- /** Indicates that this module will catch the USB_VBUSConnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_VBUSConnect);\r
-\r
- /** Indicates that this module will catch the USB_VBUSDisconnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_VBUSDisconnect);\r
-\r
- /** Indicates that this module will catch the USB_Connect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Connect);\r
-\r
- /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Disconnect);\r
-\r
- /** Indicates that this module will catch the USB_Suspend event when thrown by the library. */\r
- HANDLES_EVENT(USB_Suspend);\r
-\r
- /** Indicates that this module will catch the USB_WakeUp event when thrown by the library. */\r
- HANDLES_EVENT(USB_WakeUp);\r
-\r
- /** Indicates that this module will catch the USB_Reset event when thrown by the library. */\r
- HANDLES_EVENT(USB_Reset);\r
-\r
- /** Indicates that this module will catch the USB_UIDChange event when thrown by the library. */\r
- HANDLES_EVENT(USB_UIDChange);\r
-\r
- /** Indicates that this module will catch the USB_InitFailure event when thrown by the library. */\r
- HANDLES_EVENT(USB_InitFailure);\r
-\r
- /** Indicates that this module will catch the USB_HostError event when thrown by the library. */\r
- HANDLES_EVENT(USB_HostError);\r
-\r
- /** Indicates that this module will catch the USB_DeviceEnumerationFailed event when thrown by the library. */\r
- HANDLES_EVENT(USB_DeviceEnumerationFailed);\r
-\r
- /** Indicates that this module will catch the USB_DeviceError event when thrown by the library. */\r
- HANDLES_EVENT(USB_DeviceError);\r
-\r
- /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */\r
- HANDLES_EVENT(USB_UnhandledControlPacket);\r
-\r
- /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */\r
- HANDLES_EVENT(USB_ConfigurationChanged);\r
-\r
- /** Indicates that this module will catch the USB_DeviceAttached event when thrown by the library. */\r
- HANDLES_EVENT(USB_DeviceAttached);\r
-\r
- /** Indicates that this module will catch the USB_DeviceUnattached event when thrown by the library. */\r
- HANDLES_EVENT(USB_DeviceUnattached);\r
-\r
/* Macros: */\r
/** Prefix sent through the USART when an even fires before the actual event message. */\r
#define EVENT_PREFIX ESC_INVERSE_ON "EVENT:" ESC_INVERSE_OFF " "\r
static void Abort_Program(void) ATTR_NO_RETURN;\r
#endif\r
\r
+ void EVENT_USB_VBUSChange(void);\r
+ void EVENT_USB_VBUSConnect(void);\r
+ void EVENT_USB_VBUSDisconnect(void);\r
+ void EVENT_USB_Connect(void);\r
+ void EVENT_USB_Disconnect(void);\r
+ void EVENT_USB_InitFailure(const uint8_t ErrorCode);\r
+ void EVENT_USB_UIDChange(void);\r
+ void EVENT_USB_HostError(const uint8_t ErrorCode);\r
+ void EVENT_USB_DeviceAttached(void);\r
+ void EVENT_USB_DeviceUnattached(void);\r
+ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);\r
+ void EVENT_USB_DeviceEnumerationComplete(void);\r
+ void EVENT_USB_UnhandledControlPacket(void);\r
+ void EVENT_USB_ConfigurationChanged(void);\r
+ void EVENT_USB_Suspend(void);\r
+ void EVENT_USB_WakeUp(void);\r
+ void EVENT_USB_Reset(void);\r
+ void EVENT_USB_DeviceError(const uint8_t ErrorCode); \r
+ \r
#endif\r
checkhooks: build\r
@echo\r
@echo ------- Unhooked LUFA Events -------\r
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
echo "(None)"\r
@echo ------------------------------------\r
* - Clarified the size of library tokens which accept integer values in the Compile Time Tokens page, values now use the smallest datatype\r
* inside the library that is able to hold their defined value to save space\r
* - Removed DESCRIPTOR_ADDRESS() macro as it was largely supurflous and only served to obfuscate code\r
+ * - Rewritten event system to remove all macros, to make user code clearer\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
*\r
*\r
* \section Sec_ChangeLog090510 Version 090510\r
USB_GetNextDescriptorOfType(BytesRem, CurrConfigLoc, Type);\r
}\r
\r
-uint8_t USB_GetNextDescriptorComp_Prv(uint16_t* BytesRem, uint8_t** CurrConfigLoc, ConfigComparatorPtr_t ComparatorRoutine)\r
+uint8_t USB_GetNextDescriptorComp(uint16_t* BytesRem, uint8_t** CurrConfigLoc, ConfigComparatorPtr_t ComparatorRoutine)\r
{\r
uint8_t ErrorCode;\r
\r
#else\r
#define DESCRIPTOR_SIZE(DescriptorPtr) DESCRIPTOR_CAST(DescriptorPtr, USB_Descriptor_Header_t).bLength\r
#endif\r
- \r
- /** Creates a prototype for or begins a descriptor comparator routine. Descriptor comparator routines are \r
- * small search routines which are passed a pointer to the current sub descriptor in the configuration\r
- * descriptor, and which analyse the sub descriptor to determine whether or not it matches the routine's\r
- * search parameters. Comparator routines provide a powerful way to scan through the config descriptor\r
- * for certain descriptors matching unique criteria.\r
+\r
+ /* Type Defines: */\r
+ /** Type define for a Configuration Descriptor comparator function (function taking a pointer to an array\r
+ * of type void, returning a uint8_t value).\r
*\r
- * Comparator routines are passed in a single pointer named CurrentDescriptor, and should return a value\r
- * of a member of the \ref DSearch_Return_ErrorCodes_t enum.\r
+ * \see \ref USB_GetNextDescriptorComp function for more details\r
*/\r
- #define DESCRIPTOR_COMPARATOR(name) uint8_t DCOMP_##name (void* const CurrentDescriptor)\r
+ typedef uint8_t (* const ConfigComparatorPtr_t)(void* const);\r
\r
- /* Pseudo-Function Macros: */\r
- #if defined(__DOXYGEN__)\r
- /** Searches for the next descriptor in the given configuration descriptor using a premade comparator\r
- * function. The routine updates the position and remaining configuration descriptor bytes values\r
- * automatically. If a comparator routine fails a search, the descriptor pointer is retreated back\r
- * so that the next descriptor search invocation will start from the descriptor which first caused the\r
- * original search to fail. This behaviour allows for one comparator to be used immediately after another\r
- * has failed, starting the second search from the descriptor which failed the first.\r
- *\r
- * \note This function is available in USB Host mode only.\r
- *\r
- * \param BytesRem Pointer to an int storing the remaining bytes in the configuration descriptor\r
- * \param CurrConfigLoc Pointer to the current position in the configuration descriptor\r
- * \param ComparatorRoutine Name of the comparator search function to use on the configuration descriptor\r
- *\r
- * \return Value of one of the members of the \ref DSearch_Comp_Return_ErrorCodes_t enum\r
- *\r
- * Usage Example:\r
- * \code\r
- * DESCRIPTOR_COMPARATOR(EndpointSearcher); // Comparator Prototype\r
- *\r
- * DESCRIPTOR_COMPARATOR(EndpointSearcher)\r
- * {\r
- * if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)\r
- * return DESCRIPTOR_SEARCH_Found;\r
- * else\r
- * return DESCRIPTOR_SEARCH_NotFound;\r
- * }\r
- *\r
- * //...\r
- * // After retrieving configuration descriptor:\r
- * if (USB_Host_GetNextDescriptorComp(&BytesRemaining, &ConfigDescriptorData, EndpointSearcher) ==\r
- * Descriptor_Search_Comp_Found)\r
- * {\r
- * // Do something with the endpoint descriptor\r
- * }\r
- * \endcode\r
- */\r
- uint8_t USB_GetNextDescriptorComp(uint16_t* BytesRem, uint8_t** CurrConfigLoc, ComparatorPtr_t ComparatorRoutine);\r
- #else\r
- #define USB_GetNextDescriptorComp(DSize, DPos, DSearch) USB_GetNextDescriptorComp_Prv(DSize, DPos, DCOMP_##DSearch)\r
- #endif\r
+ /* Function Prototypes: */\r
+ /** Searches for the next descriptor in the given configuration descriptor using a premade comparator\r
+ * function. The routine updates the position and remaining configuration descriptor bytes values\r
+ * automatically. If a comparator routine fails a search, the descriptor pointer is retreated back\r
+ * so that the next descriptor search invocation will start from the descriptor which first caused the\r
+ * original search to fail. This behaviour allows for one comparator to be used immediately after another\r
+ * has failed, starting the second search from the descriptor which failed the first.\r
+ *\r
+ * Comparator functions should be standard functions which accept a pointer to the header of the current\r
+ * descriptor inside the configuration descriptor which is being compared, and should return a value from\r
+ * the \ref DSearch_Return_ErrorCodes_t enum as a uint8_t value.\r
+ *\r
+ * \note This function is available in USB Host mode only.\r
+ *\r
+ * \param BytesRem Pointer to an int storing the remaining bytes in the configuration descriptor\r
+ * \param CurrConfigLoc Pointer to the current position in the configuration descriptor\r
+ * \param ComparatorRoutine Name of the comparator search function to use on the configuration descriptor\r
+ *\r
+ * \return Value of one of the members of the \ref DSearch_Comp_Return_ErrorCodes_t enum\r
+ *\r
+ * Usage Example:\r
+ * \code\r
+ * uint8_t EndpointSearcher(void* CurrentDescriptor); // Comparator Prototype\r
+ *\r
+ * uint8_t EndpointSearcher(void* CurrentDescriptor)\r
+ * {\r
+ * if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)\r
+ * return DESCRIPTOR_SEARCH_Found;\r
+ * else\r
+ * return DESCRIPTOR_SEARCH_NotFound;\r
+ * }\r
+ *\r
+ * //...\r
+ * // After retrieving configuration descriptor:\r
+ * if (USB_Host_GetNextDescriptorComp(&BytesRemaining, &ConfigDescriptorData, EndpointSearcher) ==\r
+ * Descriptor_Search_Comp_Found)\r
+ * {\r
+ * // Do something with the endpoint descriptor\r
+ * }\r
+ * \endcode\r
+ */\r
+ uint8_t USB_GetNextDescriptorComp(uint16_t* BytesRem, uint8_t** CurrConfigLoc, ConfigComparatorPtr_t ComparatorRoutine);\r
\r
/* Enums: */\r
- /** Enum for return values of a descriptor comparator made with \ref DESCRIPTOR_COMPARATOR. */\r
+ /** Enum for return values of a descriptor comparator function. */\r
enum DSearch_Return_ErrorCodes_t\r
{\r
DESCRIPTOR_SEARCH_Found = 0, /**< Current descriptor matches comparator criteria. */\r
*BytesRem -= CurrDescriptorSize;\r
}\r
\r
- /* Type Defines: */\r
- /** Type define for a Configuration Descriptor comparator function (function taking a pointer to an array\r
- * of type void, returning a uint8_t value).\r
- *\r
- * \see \ref USB_GetNextDescriptorComp function for more details\r
- */\r
- typedef uint8_t (* const ConfigComparatorPtr_t)(void* const);\r
-\r
- /* Private Interface - For use in library only: */\r
- #if !defined(__DOXYGEN__)\r
- /* Function Prototypes: */\r
- uint8_t USB_GetNextDescriptorComp_Prv(uint16_t* BytesRem, uint8_t** CurrConfigLoc, ConfigComparatorPtr_t ComparatorRoutine);\r
- #endif\r
- \r
/* Disable C linkage for C++ Compilers: */\r
#if defined(__cplusplus)\r
}\r
* multiple places in the user or library code, which may or may not be inside an ISR, thus each handler\r
* should be written to be as small and fast as possible to prevent possible problems.\r
*\r
- * Events can be hooked by the user application using the \ref EVENT_HANDLER() and \ref HANDLES_EVENT() macros. If an\r
- * event with no associated handler is fired within the library, it by default fires an internal empty stub\r
- * function. This is achieved through the use of the GCC compiler's "alias" attribute.\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
*\r
* Each event must only have one associated event handler, but can be raised by multiple sources.\r
*\r
extern "C" {\r
#endif\r
\r
- /* 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 separated 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 equivalent 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 \ref RAISE_EVENT macro in the module should have an accompanying \ref 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 presence 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 equivalent 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 \ref EVENT_HANDLER macro in the module should have an accompanying \ref 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
+ /* Public Interface - May be used in end-application: */ \r
/* Pseudo-Functions for Doxygen: */\r
- #if defined(__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
*\r
* \note This event is only available on USB AVR models which support VBUS notification interrupts.\r
*/\r
- void USB_VBUSChange(void);\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
*\r
* \note This event is only available on USB AVR models which support VBUS notification interrupts.\r
*/\r
- void USB_VBUSConnect(void);\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
*\r
* \note This event is only available on USB AVR models which support VBUS notification interrupts.\r
*/\r
- void USB_VBUSDisconnect(void);\r
+ void EVENT_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
* 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 \ref RAISE_EVENT(), and the \ref USB_IsConnected global changed manually.\r
+ * and disconnection events may be manually fired, and the \ref 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
+ void EVENT_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
* 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 \ref RAISE_EVENT(), and the \ref USB_IsConnected global changed manually.\r
+ * and disconnection events may be manually fired, and the \ref 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
+ void EVENT_USB_Disconnect(void);\r
\r
/** Event for USB initialization failure. This event fires when the USB interface fails to\r
* initialize correctly due to a hardware or software fault.\r
* \note This event only exists on USB AVR models which support dual role modes.\r
*\r
* \param ErrorCode Error code indicating the failure reason, a value in \ref USB_InitErrorCodes_t\r
- * located in LowLevel.h.\r
*/\r
- void USB_InitFailure(const uint8_t ErrorCode);\r
+ void EVENT_USB_InitFailure(const uint8_t ErrorCode);\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
* \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
*/\r
- void USB_UIDChange(void);\r
+ void EVENT_USB_UIDChange(void);\r
\r
/** Event for USB host error. This event fires when a hardware fault has occurred whilst the USB\r
* interface is in host mode.\r
*\r
* \param ErrorCode Error code indicating the failure reason, a value in \ref USB_Host_ErrorCodes_t\r
- * located in Host.h.\r
*\r
* \note This event only exists on USB AVR models which supports host mode.\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
*/\r
- void USB_HostError(const uint8_t ErrorCode);\r
+ void EVENT_USB_HostError(const uint8_t ErrorCode);\r
\r
/** Event for USB device attachment. This event fires when a the USB interface is in host mode, and\r
* a USB device has been connected to the USB interface. This is interrupt driven, thus fires before\r
- * the standard \ref USB_Connect event and so can be used to programmatically start the USB management\r
+ * the standard \ref EVENT_USB_Connect event and so can be used to programmatically start the USB management\r
* task to reduce CPU consumption.\r
*\r
* \note This event only exists on USB AVR models which supports host mode.\r
*\r
* \see \ref TASK(USB_USBTask) for more information on the USB management task and reducing CPU usage.\r
*/\r
- void USB_DeviceAttached(void);\r
+ void EVENT_USB_DeviceAttached(void);\r
\r
/** Event for USB device removal. This event fires when a the USB interface is in host mode, and\r
* a USB device has been removed the USB interface whether or not it has been enumerated. This\r
*\r
* \see \ref TASK(USB_USBTask) for more information on the USB management task and reducing CPU usage.\r
*/\r
- void USB_DeviceUnattached(void);\r
+ void EVENT_USB_DeviceUnattached(void);\r
\r
/** Event for USB device enumeration failure. This event fires when a the USB interface is\r
* in host mode, and an attached USB device has failed to enumerate completely.\r
*\r
* \param ErrorCode Error code indicating the failure reason, a value in \r
- * \ref USB_Host_EnumerationErrorCodes_t located in Host.h.\r
+ * \ref USB_Host_EnumerationErrorCodes_t\r
*\r
* \param SubErrorCode Sub error code indicating the reason for failure - for example, if the\r
* ErrorCode parameter indicates a control error, this will give the error\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
*/\r
- void USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);\r
+ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);\r
\r
/** Event for USB device enumeration completion. This event fires when a the USB interface is\r
* in host mode and an attached USB device has been completely enumerated and is ready to be\r
* controlled by the user application, or when the library is in device mode, and the Host\r
* has finished enumerating the device.\r
*/\r
- void USB_DeviceEnumerationComplete(void);\r
+ void EVENT_USB_DeviceEnumerationComplete(void);\r
\r
/** Event for unhandled control requests. This event fires when a the USB host issues a control\r
* request to the control endpoint (address 0) that the library does not handle. This may either\r
* request SETUP parameters into the \ref USB_ControlRequest structure which should then be used\r
* by the application to determine how to handle the issued request.\r
*/\r
- void USB_UnhandledControlPacket(void);\r
+ void EVENT_USB_UnhandledControlPacket(void);\r
\r
/** Event for USB configuration number changed. This event fires when a the USB host changes the\r
* selected configuration number while in device mode. This event should be hooked in device\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 USB_ConfigurationChanged(void);\r
+ void EVENT_USB_ConfigurationChanged(void);\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
* \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
- * \see \ref USB_WakeUp() event for accompanying Wake Up event.\r
+ * \see \ref EVENT_USB_WakeUp() event for accompanying Wake Up event.\r
*/\r
- void USB_Suspend(void);\r
+ void EVENT_USB_Suspend(void);\r
\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
* \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
- * \see \ref USB_Suspend() event for accompanying Suspend event.\r
+ * \see \ref EVENT_USB_Suspend() event for accompanying Suspend event.\r
*/\r
- void USB_WakeUp(void);\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
* \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 USB_Reset(void);\r
+ void EVENT_USB_Reset(void);\r
\r
/** Event for USB device mode error. This event fires when the USB interface is in device mode,\r
* and an error occurs which prevents it from operating normally.\r
*\r
- * \param ErrorCode Error code indicating the source of the error. One of the values in the\r
- * \ref USB_Device_ErrorCodes_t enum located in Device.h.\r
+ * \param ErrorCode Error code indicating the source of the error, a value in\r
+ * \ref USB_Device_ErrorCodes_t\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 USB_DeviceError(const uint8_t ErrorCode);\r
+ void EVENT_USB_DeviceError(const uint8_t ErrorCode);\r
#endif\r
\r
/* Private Interface - For use in library only: */\r
#if !defined(__DOXYGEN__)\r
- /* Macros: */\r
- #define ALIAS_STUB(e) EVENT_HANDLER(e) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub)\r
- \r
- #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER)\r
- #define USB_VBUSChange_P (void)\r
- #define USB_VBUSConnect_P (void)\r
- #define USB_VBUSDisconnect_P (void)\r
- #endif\r
- \r
- #define USB_Connect_P (void)\r
- #define USB_Disconnect_P (void)\r
- #define USB_DeviceEnumerationComplete_P (void)\r
- \r
- #if defined(USB_CAN_BE_BOTH)\r
- #define USB_InitFailure_P (const uint8_t ErrorCode)\r
- #define USB_UIDChange_P (void)\r
- #endif\r
-\r
- #if defined(USB_CAN_BE_HOST)\r
- #define USB_HostError_P (const uint8_t ErrorCode)\r
- #define USB_DeviceAttached_P (void)\r
- #define USB_DeviceUnattached_P (void)\r
- #define USB_DeviceEnumerationFailed_P (const uint8_t ErrorCode, const uint8_t SubErrorCode)\r
- #endif\r
- \r
- #if defined(USB_CAN_BE_DEVICE)\r
- #define USB_UnhandledControlPacket_P (void)\r
- #define USB_ConfigurationChanged_P (void)\r
- #define USB_Suspend_P (void)\r
- #define USB_WakeUp_P (void)\r
- #define USB_Reset_P (void)\r
- #define USB_DeviceError_P (const uint8_t ErrorCode)\r
- #endif\r
-\r
/* Function Prototypes: */\r
#if defined(INCLUDE_FROM_EVENTS_C)\r
void USB_Event_Stub(void) ATTR_CONST;\r
\r
#if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER)\r
- ALIAS_STUB(USB_VBUSChange);\r
- ALIAS_STUB(USB_VBUSConnect);\r
- ALIAS_STUB(USB_VBUSDisconnect);\r
+ void EVENT_USB_VBUSChange(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);\r
+ void EVENT_USB_VBUSConnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);\r
+ void EVENT_USB_VBUSDisconnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);\r
#endif\r
- \r
- ALIAS_STUB(USB_Connect);\r
- ALIAS_STUB(USB_Disconnect);\r
- ALIAS_STUB(USB_DeviceEnumerationComplete);\r
+ \r
+ void EVENT_USB_Connect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);\r
+ void EVENT_USB_Disconnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);\r
+ void EVENT_USB_DeviceEnumerationComplete(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);\r
\r
#if defined(USB_CAN_BE_BOTH)\r
- ALIAS_STUB(USB_InitFailure);\r
- ALIAS_STUB(USB_UIDChange);\r
+ void EVENT_USB_InitFailure(const uint8_t ErrorCode) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);\r
+ void EVENT_USB_UIDChange(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);\r
#endif\r
\r
#if defined(USB_CAN_BE_HOST)\r
- ALIAS_STUB(USB_HostError);\r
- ALIAS_STUB(USB_DeviceAttached);\r
- ALIAS_STUB(USB_DeviceUnattached);\r
- ALIAS_STUB(USB_DeviceEnumerationFailed);\r
+ void EVENT_USB_HostError(const uint8_t ErrorCode) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);\r
+ void EVENT_USB_DeviceAttached(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);\r
+ void EVENT_USB_DeviceUnattached(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);\r
+ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)\r
+ ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);\r
#endif\r
\r
- #if defined(USB_CAN_BE_DEVICE)\r
- ALIAS_STUB(USB_UnhandledControlPacket);\r
- ALIAS_STUB(USB_ConfigurationChanged);\r
- ALIAS_STUB(USB_Suspend);\r
- ALIAS_STUB(USB_WakeUp);\r
- ALIAS_STUB(USB_Reset);\r
- ALIAS_STUB(USB_DeviceError);\r
- #endif\r
+ void EVENT_USB_UnhandledControlPacket(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);\r
+ void EVENT_USB_ConfigurationChanged(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);\r
+ void EVENT_USB_Suspend(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);\r
+ void EVENT_USB_WakeUp(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);\r
+ void EVENT_USB_Reset(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);\r
+ void EVENT_USB_DeviceError(const uint8_t ErrorCode) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);\r
#endif\r
#endif\r
\r
\r
uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)\r
{\r
- RAISE_EVENT(USB_DeviceError, DEVICE_ERROR_GetDescriptorNotHooked);\r
+ EVENT_USB_DeviceError(DEVICE_ERROR_GetDescriptorNotHooked);\r
\r
return 0;\r
};\r
*/\r
#define ENDPOINT_USAGE_IMPLICIT_FEEDBACK (2 << 4)\r
\r
- /* Events: */\r
- #if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__)\r
- /** This module raises the Device Error event while in device mode, if the \ref USB_GetDescriptor()\r
- * routine is not hooked in the user application to properly return descriptors to the library.\r
- *\r
- * \see \ref Group_Events for more information on this event.\r
- */\r
- RAISES_EVENT(USB_DeviceError);\r
- #endif\r
- \r
/* Enums: */\r
/** Enum for the possible standard descriptor types, as given in each descriptor's header. */\r
enum USB_DescriptorTypes_t\r
{\r
REQ_GetStatus = 0, /**< Implemented in the library for device, endpoint and interface\r
* recipients. Passed to the user application for other recipients\r
- * via the \ref USB_UnhandledControlPacket() event when received in\r
+ * via the \ref EVENT_USB_UnhandledControlPacket() event when received in\r
* device mode. */\r
REQ_ClearFeature = 1, /**< Implemented in the library for device, endpoint and interface\r
* recipients. Passed to the user application for other recipients\r
- * via the \ref USB_UnhandledControlPacket() event when received in\r
+ * via the \ref EVENT_USB_UnhandledControlPacket() event when received in\r
* device mode. */\r
REQ_SetFeature = 3, /**< Implemented in the library for device, endpoint and interface\r
* recipients. Passed to the user application for other recipients\r
- * via the \ref USB_UnhandledControlPacket() event when received in\r
+ * via the \ref EVENT_USB_UnhandledControlPacket() event when received in\r
* device mode. */\r
REQ_SetAddress = 5, /**< Implemented in the library for the device recipient. Passed\r
* to the user application for other recipients via the\r
- * \ref USB_UnhandledControlPacket() event when received in\r
+ * \ref EVENT_USB_UnhandledControlPacket() event when received in\r
* device mode. */\r
REQ_GetDescriptor = 6, /**< Implemented in the library for all recipients and all request\r
* types. */\r
REQ_SetDescriptor = 7, /**< Not implemented in the library, passed to the user application\r
- * via the \ref USB_UnhandledControlPacket() event when received in\r
+ * via the \ref EVENT_USB_UnhandledControlPacket() event when received in\r
* device mode. */\r
REQ_GetConfiguration = 8, /**< Implemented in the library for the device recipient. Passed\r
* to the user application for other recipients via the\r
- * \ref USB_UnhandledControlPacket() event when received in\r
+ * \ref EVENT_USB_UnhandledControlPacket() event when received in\r
* device mode. */\r
REQ_SetConfiguration = 9, /**< Implemented in the library for the device recipient. Passed\r
* to the user application for other recipients via the\r
- * \ref USB_UnhandledControlPacket() event when received in\r
+ * \ref EVENT_USB_UnhandledControlPacket() event when received in\r
* device mode. */\r
REQ_GetInterface = 10, /**< Not implemented in the library, passed to the user application\r
- * via the \ref USB_UnhandledControlPacket() event when received in\r
+ * via the \ref EVENT_USB_UnhandledControlPacket() event when received in\r
* device mode. */\r
REQ_SetInterface = 11, /**< Not implemented in the library, passed to the user application\r
- * via the \ref USB_UnhandledControlPacket() event when received in\r
+ * via the \ref EVENT_USB_UnhandledControlPacket() event when received in\r
* device mode. */\r
REQ_SynchFrame = 12, /**< Not implemented in the library, passed to the user application\r
- * via the \ref USB_UnhandledControlPacket() event when received in\r
+ * via the \ref EVENT_USB_UnhandledControlPacket() event when received in\r
* device mode. */\r
};\r
\r
* @defgroup Group_StreamCallbacks Endpoint and Pipe Stream Callbacks\r
*\r
* Macros and enums for the stream callback routines. This module contains the code required to easily set up\r
- * stream callback functions which can be used to force early abort of a stream read/write process.\r
+ * stream callback functions which can be used to force early abort of a stream read/write process. Each callback\r
+ * should take no arguments, and return a value from the \ref StreamCallback_Return_ErrorCodes_t enum.\r
*\r
* @{\r
*/\r
\r
/* Public Interface - May be used in end-application: */\r
/* Macros: */\r
- /** Creates a prototype for or begins a stream callback routine. Stream callback routines are small\r
- * routines which are executed during stream read or writes (if the callback-enabled versions of\r
- * these functions are used) which allow the user application to abort the transfer when certain\r
- * arbitrary conditions are met.\r
- *\r
- * Stream callback functions should return a value from the \ref StreamCallback_Return_ErrorCodes_t\r
- * enum.\r
- *\r
- * Usage Example (Device Endpoint, but applicable for Host Pipes also):\r
- * \code\r
- * STREAM_CALLBACK(GlobalNotSet); // Callback Prototype\r
- *\r
- * STREAM_CALLBACK(GlobalNotSet)\r
- * {\r
- * if (MyGlobal == false)\r
- * return ENDPOINT_STREAMCALLBACK_Continue;\r
- * else\r
- * return ENDPOINT_STREAMCALLBACK_Abort;\r
- * }\r
- *\r
- * //...\r
- * // Inside some routine:\r
- * if (Endpoint_Write_Stream_LE(DataBuffer, sizeof(DataBuffer), GlobalNotSet) == \r
- * ENDPOINT_RWSTREAM_ERROR_CallbackAborted)\r
- * {\r
- * // Do something when the callback aborted the transfer early\r
- * }\r
- * \endcode\r
- */\r
- #define STREAM_CALLBACK(name) uint8_t name (void)\r
-\r
/** Used with the Endpoint and Pipe stream functions as the callback function parameter, indicating that the stream\r
* call has no callback function to be called between USB packets.\r
*/\r
{\r
USB_INT_Clear(USB_INT_VBUS);\r
\r
- RAISE_EVENT(USB_VBUSChange);\r
+ EVENT_USB_VBUSChange();\r
\r
if (USB_VBUS_GetStatus())\r
{\r
- RAISE_EVENT(USB_VBUSConnect);\r
+ EVENT_USB_VBUSConnect();\r
\r
if (USB_IsConnected)\r
- RAISE_EVENT(USB_Disconnect);\r
+ EVENT_USB_Disconnect();\r
\r
USB_ResetInterface();\r
\r
USB_IsConnected = true;\r
\r
- RAISE_EVENT(USB_Connect);\r
+ EVENT_USB_Connect();\r
}\r
else\r
{\r
- RAISE_EVENT(USB_Disconnect);\r
+ EVENT_USB_Disconnect();\r
\r
USB_Detach();\r
USB_CLK_Freeze();\r
\r
USB_IsConnected = false;\r
\r
- RAISE_EVENT(USB_VBUSDisconnect);\r
+ EVENT_USB_VBUSDisconnect();\r
\r
USB_INT_Clear(USB_INT_VBUS);\r
}\r
\r
USB_IsSuspended = true;\r
\r
- RAISE_EVENT(USB_Suspend);\r
+ EVENT_USB_Suspend();\r
\r
#if defined(USB_LIMITED_CONTROLLER) && !defined(NO_LIMITED_CONTROLLER_CONNECT)\r
if (USB_IsConnected)\r
{\r
USB_IsConnected = false;\r
- RAISE_EVENT(USB_Disconnect);\r
+ EVENT_USB_Disconnect();\r
}\r
#endif\r
}\r
if (!(USB_IsConnected))\r
{\r
USB_IsConnected = true;\r
- RAISE_EVENT(USB_Connect);\r
+ EVENT_USB_Connect();\r
}\r
#endif\r
\r
USB_IsSuspended = false;\r
\r
- RAISE_EVENT(USB_WakeUp);\r
+ EVENT_USB_WakeUp();\r
}\r
\r
if (USB_INT_HasOccurred(USB_INT_EORSTI) && USB_INT_IsEnabled(USB_INT_EORSTI))\r
USB_INT_Enable(USB_INT_ENDPOINT_SETUP);\r
#endif\r
\r
- RAISE_EVENT(USB_Reset);\r
+ EVENT_USB_Reset();\r
}\r
#endif\r
\r
USB_INT_Clear(USB_INT_DCONNI);\r
USB_INT_Disable(USB_INT_DDISCI);\r
\r
- RAISE_EVENT(USB_DeviceUnattached);\r
- RAISE_EVENT(USB_Disconnect);\r
+ EVENT_USB_DeviceUnattached();\r
+ EVENT_USB_Disconnect();\r
\r
USB_ResetInterface();\r
}\r
USB_Host_VBUS_Manual_Off();\r
USB_Host_VBUS_Auto_Off();\r
\r
- RAISE_EVENT(USB_HostError, HOST_ERROR_VBusVoltageDip);\r
- RAISE_EVENT(USB_DeviceUnattached);\r
+ EVENT_USB_HostError(HOST_ERROR_VBusVoltageDip);\r
+ EVENT_USB_DeviceUnattached();\r
\r
USB_HostState = HOST_STATE_Unattached;\r
}\r
USB_INT_Clear(USB_INT_SRPI);\r
USB_INT_Disable(USB_INT_SRPI);\r
\r
- RAISE_EVENT(USB_DeviceAttached);\r
+ EVENT_USB_DeviceAttached();\r
\r
USB_INT_Enable(USB_INT_DDISCI);\r
\r
{\r
USB_INT_Clear(USB_INT_BCERRI);\r
\r
- RAISE_EVENT(USB_DeviceEnumerationFailed, HOST_ENUMERROR_NoDeviceDetected, 0);\r
- RAISE_EVENT(USB_DeviceUnattached);\r
+ EVENT_USB_DeviceEnumerationFailed(HOST_ENUMERROR_NoDeviceDetected, 0);\r
+ EVENT_USB_DeviceUnattached();\r
\r
if (USB_IsConnected)\r
- RAISE_EVENT(USB_Disconnect);\r
+ EVENT_USB_Disconnect();\r
\r
USB_ResetInterface();\r
}\r
if (USB_IsConnected)\r
{\r
if (USB_CurrentMode == USB_MODE_HOST)\r
- RAISE_EVENT(USB_DeviceUnattached);\r
+ EVENT_USB_DeviceUnattached();\r
else\r
- RAISE_EVENT(USB_Disconnect);\r
+ EVENT_USB_Disconnect();\r
}\r
\r
- RAISE_EVENT(USB_UIDChange);\r
+ EVENT_USB_UIDChange();\r
\r
USB_ResetInterface();\r
}\r
extern "C" {\r
#endif\r
\r
- /* Public Interface - May be used in end-application: */\r
- /* Throwable Events: */\r
- /** This module raises the USB Connected interrupt when the AVR is attached to a host while in device\r
- * USB mode.\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 \ref RAISE_EVENT(), and the USB_IsConnected global changed manually.\r
- */\r
- RAISES_EVENT(USB_Connect);\r
-\r
- /** This module raises the USB Disconnected interrupt when the AVR is removed from a host while in\r
- * device USB mode.\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 \ref RAISE_EVENT(), and the USB_IsConnected global changed manually.\r
- */\r
- RAISES_EVENT(USB_Disconnect);\r
-\r
- #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER) || defined(__DOXYGEN__)\r
- /** This module raises the VBUS Change event when the current VBUS status (present or not present) has\r
- * changed.\r
- *\r
- * \note Not all USB AVR models support VBUS interrupts; this event only exists on supported AVRs.\r
- *\r
- * \see \ref Group_Events for more information on this event.\r
- */\r
- RAISES_EVENT(USB_VBUSChange);\r
-\r
- /** This module raises the VBUS Connect event when the VBUS line is powered.\r
- *\r
- * \note Not all USB AVR models support VBUS interrupts; this event only exists on supported AVRs.\r
- *\r
- * \see \ref Group_Events for more information on this event.\r
- */\r
- RAISES_EVENT(USB_VBUSConnect);\r
-\r
- /** This module raises the VBUS Disconnect event when power is removed from the VBUS line.\r
- *\r
- * \note Not all USB AVR models support VBUS interrupts; this event only exists on supported AVRs.\r
- *\r
- * \see \ref Group_Events for more information on this event.\r
- */\r
- RAISES_EVENT(USB_VBUSDisconnect);\r
- #endif\r
-\r
- #if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__)\r
- /** This module raises the Suspended event when the host suspends the USB interface of the AVR\r
- * whilst running in device mode.\r
- *\r
- * \see \ref Group_Events for more information on this event.\r
- */\r
- RAISES_EVENT(USB_Suspend);\r
-\r
- /** This module raises the Wake Up event when the host resumes the USB interface of the AVR\r
- * whilst running in device mode.\r
- *\r
- * \see \ref Group_Events for more information on this event.\r
- */\r
- RAISES_EVENT(USB_WakeUp);\r
-\r
- /** This module raises the USB Reset event when the host resets the USB interface of the AVR\r
- * whilst running in device mode.\r
- *\r
- * \see \ref Group_Events for more information on this event.\r
- */\r
- RAISES_EVENT(USB_Reset);\r
- #endif\r
- \r
- #if defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__)\r
- /** This module raises the Host Error event when the VBUS line voltage dips below the minimum threshold\r
- * while running in host mode.\r
- *\r
- * \note Not all USB AVR models support host mode; this event only exists on supported AVRs.\r
- *\r
- * \see \ref Group_Events for more information on this event.\r
- */\r
- RAISES_EVENT(USB_HostError);\r
-\r
- /** This module raises the Device Unattached event when an attached device is removed from the AVR whilst\r
- * running in host mode.\r
- *\r
- * \note Not all USB AVR models support host mode; this event only exists on supported AVRs.\r
- *\r
- * \see \ref Group_Events for more information on this event.\r
- */\r
- RAISES_EVENT(USB_DeviceUnattached);\r
- #endif\r
-\r
- #if defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__)\r
- /** This module raises the UID Change event when the UID line changes in value on dual-role devices.\r
- *\r
- * \note Not all USB AVR models support host mode and thus the UID pin; this event only exists on\r
- * supported AVRs.\r
- *\r
- * \see \ref Group_Events for more information on this event.\r
- */\r
- RAISES_EVENT(USB_UIDChange);\r
- #endif\r
- \r
/* Private Interface - For use in library only: */\r
#if !defined(__DOXYGEN__)\r
/* Macros: */\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 \ref RAISE_EVENT(), and the \ref USB_IsConnected global changed manually.\r
+ * and disconnection events may be manually fired, and the \ref USB_IsConnected global changed manually.\r
*\r
* \ingroup Group_USBManagement\r
*/\r
extern volatile bool USB_IsInitialized;\r
\r
/** Structure containing the last received Control request when in Device mode (for use in user-applications\r
- * inside of the \ref USB_UnhandledControlPacket() event, or for filling up with a control request to issue when\r
+ * inside of the \ref EVENT_USB_UnhandledControlPacket() event, or for filling up with a control request to issue when\r
* in Host mode before calling \ref USB_Host_SendControlRequest().\r
*\r
* \ingroup Group_USBManagement\r
extern volatile uint8_t USB_HostState;\r
#endif\r
\r
- /* Throwable Events: */\r
- #if defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__)\r
- /** This module raises the \ref USB_Connect event when a USB device has been connected whilst in host\r
- * mode, but not yet enumerated.\r
- *\r
- * \see \ref Group_Events for more information on this event.\r
- */\r
- RAISES_EVENT(USB_Connect);\r
-\r
- /** This module raises the \ref USB_DeviceAttached event when in host mode, and a device is attached\r
- * to the AVR's USB interface.\r
- *\r
- * \see \ref Group_Events for more information on this event.\r
- */\r
- RAISES_EVENT(USB_DeviceAttached);\r
-\r
- /** This module raises the \ref USB_DeviceUnattached event when in host mode, and a device is removed\r
- * from the AVR's USB interface.\r
- *\r
- * \see \ref Group_Events for more information on this event.\r
- */\r
- RAISES_EVENT(USB_DeviceUnattached);\r
- \r
- /** This module raises the \ref USB_DeviceEnumerationFailed event when in host mode, and an\r
- * attached USB device has failed to successfully enumerated.\r
- *\r
- * \see \ref Group_Events for more information on this event.\r
- */\r
- RAISES_EVENT(USB_DeviceEnumerationFailed);\r
-\r
- /** This module raises the \ref USB_DeviceEnumerationComplete event when in host mode, and an\r
- * attached USB device has been successfully enumerated and ready to be used by the user\r
- * application.\r
- *\r
- * \see \ref Group_Events for more information on this event.\r
- */\r
- RAISES_EVENT(USB_DeviceEnumerationComplete);\r
-\r
- /** This module raises the \ref USB_Disconnect event when an attached USB device is removed from the USB\r
- * bus.\r
- *\r
- * \see \ref Group_Events for more information on this event.\r
- */\r
- RAISES_EVENT(USB_Disconnect);\r
- #endif\r
-\r
/* Tasks: */\r
/** This is the main USB management task. The USB driver requires that this task be executed\r
* continuously when the USB system is active (device attached in host mode, or attached to a host\r
* The USB task must be serviced within 50mS in all modes, when needed. The task may be serviced \r
* at all times, or (for minimum CPU consumption):\r
*\r
- * - In device mode, it may be disabled at start-up, enabled on the firing of the \ref USB_Connect event\r
- * and disabled again on the firing of the \ref USB_Disconnect event.\r
+ * - In device mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_Connect() event\r
+ * and disabled again on the firing of the \ref EVENT_USB_Disconnect() event.\r
*\r
- * - In host mode, it may be disabled at start-up, enabled on the firing of the \ref USB_DeviceAttached\r
- * event and disabled again on the firing of the \ref USB_DeviceUnattached event.\r
+ * - In host mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_DeviceAttached()\r
+ * event and disabled again on the firing of the \ref EVENT_USB_DeviceUnattached() event.\r
*\r
* If in device mode (only), the control endpoint can instead be managed via interrupts entirely by the library\r
* by defining the INTERRUPT_CONTROL_ENDPOINT token and passing it to the compiler via the -D switch.\r
}\r
\r
if (!(RequestHandled))\r
- RAISE_EVENT(USB_UnhandledControlPacket);\r
+ EVENT_USB_UnhandledControlPacket();\r
\r
if (Endpoint_IsSETUPReceived())\r
{\r
Endpoint_ClearIN();\r
\r
if (!(AlreadyConfigured) && USB_ConfigurationNumber)\r
- RAISE_EVENT(USB_DeviceEnumerationComplete);\r
+ EVENT_USB_DeviceEnumerationComplete();\r
\r
- RAISE_EVENT(USB_ConfigurationChanged);\r
+ EVENT_USB_ConfigurationChanged();\r
}\r
\r
void USB_Device_GetConfiguration(void)\r
* \ingroup Group_Device\r
*/\r
extern bool USB_CurrentlySelfPowered;\r
-\r
- /* Throwable Events: */\r
- /** This module raises the \ref USB_UnhandledControlPacket event when a request to the default control\r
- * endpoint has been received, but the library does not implement an internal handler for it.\r
- *\r
- * \see \ref Group_Events for more information on this event.\r
- */\r
- RAISES_EVENT(USB_UnhandledControlPacket);\r
-\r
- /** This module raises the \ref USB_ConfigurationChanged event when the host issues a \ref REQ_SetConfiguration\r
- * device request, to change the currently selected configuration number.\r
- *\r
- * \see \ref Group_Events for more information on this event.\r
- */\r
- RAISES_EVENT(USB_ConfigurationChanged);\r
-\r
- /** This module raises the \ref USB_DeviceEnumerationComplete event when the host has completed its\r
- * enumeration of the device (i.e. when a \ref REQ_SetConfiguration request changes the current configuration\r
- * number from 0 to a non-zero value).\r
- *\r
- * \see \ref Group_Events for more information on this event.\r
- */\r
- RAISES_EVENT(USB_DeviceEnumerationComplete);\r
\r
/* Private Interface - For use in library only: */\r
#if !defined(__DOXYGEN__)\r
#endif\r
\r
/* Enums: */\r
- /** Enum for the ErrorCode parameter of the \ref USB_DeviceError event.\r
+ /** Enum for the ErrorCode parameter of the \ref EVENT_USB_DeviceError() event.\r
*\r
* \see Events.h for more information on this event.\r
*/\r
/** Endpoint number mask, for masking against endpoint addresses to retrieve the endpoint's\r
* numerical address in the device.\r
*/\r
- #define ENDPOINT_EPNUM_MASK 0x03\r
+ #define ENDPOINT_EPNUM_MASK 0x07\r
\r
/** Endpoint bank size mask, for masking against endpoint addresses to retrieve the endpoint's\r
* bank size in the device.\r
* each USB packet, the given stream callback function is executed repeatedly until the next\r
* packet is ready, allowing for early aborts of stream transfers.\r
*\r
- * The callback routine should be created using the \ref STREAM_CALLBACK() macro. If the token\r
- * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled\r
- * and this function has the Callback parameter omitted.\r
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.\r
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are\r
+ * disabled and this function has the Callback parameter omitted.\r
*\r
* \note This routine should not be used on CONTROL type endpoints.\r
*\r
* is executed repeatedly until the endpoint is ready to accept the next packet, allowing for early\r
* aborts of stream transfers.\r
*\r
- * The callback routine should be created using the \ref STREAM_CALLBACK() macro. If the token\r
- * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled\r
- * and this function has the Callback parameter omitted.\r
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.\r
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are\r
+ * disabled and this function has the Callback parameter omitted.\r
*\r
* \note This routine should not be used on CONTROL type endpoints.\r
*\r
* is executed repeatedly until the endpoint is ready to accept the next packet, allowing for early\r
* aborts of stream transfers.\r
*\r
- * The callback routine should be created using the \ref STREAM_CALLBACK() macro. If the token\r
- * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled\r
- * and this function has the Callback parameter omitted.\r
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.\r
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are\r
+ * disabled and this function has the Callback parameter omitted.\r
*\r
* \note This routine should not be used on CONTROL type endpoints.\r
*\r
* each USB packet, the given stream callback function is executed repeatedly until the endpoint\r
* is ready to accept the next packet, allowing for early aborts of stream transfers.\r
*\r
- * The callback routine should be created using the \ref STREAM_CALLBACK() macro. If the token\r
- * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled\r
- * and this function has the Callback parameter omitted.\r
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.\r
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are\r
+ * disabled and this function has the Callback parameter omitted.\r
*\r
* \note This routine should not be used on CONTROL type endpoints.\r
*\r
* each USB packet, the given stream callback function is executed repeatedly until the endpoint\r
* is ready to accept the next packet, allowing for early aborts of stream transfers.\r
*\r
- * The callback routine should be created using the \ref STREAM_CALLBACK() macro. If the token\r
- * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled\r
- * and this function has the Callback parameter omitted.\r
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.\r
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are\r
+ * disabled and this function has the Callback parameter omitted.\r
*\r
* \note This routine should not be used on CONTROL type endpoints.\r
*\r
USB_INT_Enable(USB_INT_VBERRI);\r
\r
USB_IsConnected = true;\r
- RAISE_EVENT(USB_Connect);\r
+ EVENT_USB_Connect();\r
\r
USB_Host_ResumeBus();\r
Pipe_ClearPipes();\r
case HOST_STATE_Default_PostAddressSet:\r
USB_Host_SetDeviceAddress(USB_HOST_DEVICEADDRESS);\r
\r
- RAISE_EVENT(USB_DeviceEnumerationComplete);\r
+ EVENT_USB_DeviceEnumerationComplete();\r
USB_HostState = HOST_STATE_Addressed;\r
\r
break;\r
\r
if ((ErrorCode != HOST_ENUMERROR_NoError) && (USB_HostState != HOST_STATE_Unattached))\r
{\r
- RAISE_EVENT(USB_DeviceEnumerationFailed, ErrorCode, SubErrorCode);\r
+ EVENT_USB_DeviceEnumerationFailed(ErrorCode, SubErrorCode);\r
\r
USB_Host_VBUS_Auto_Off();\r
\r
- RAISE_EVENT(USB_DeviceUnattached);\r
+ EVENT_USB_DeviceUnattached();\r
\r
if (USB_IsConnected)\r
- RAISE_EVENT(USB_Disconnect);\r
+ EVENT_USB_Disconnect();\r
\r
USB_ResetInterface();\r
}\r
HOST_STATE_Suspended = 13, /**< May be implemented by the user project. */\r
};\r
\r
- /** Enum for the error codes for the \ref USB_HostError event.\r
+ /** Enum for the error codes for the \ref EVENT_USB_HostError() event.\r
*\r
* \see \ref Group_Events for more information on this event.\r
*/\r
*/\r
};\r
\r
- /** Enum for the error codes for the \ref USB_DeviceEnumerationFailed event.\r
+ /** Enum for the error codes for the \ref EVENT_USB_DeviceEnumerationFailed() event.\r
*\r
* \see \ref Group_Events for more information on this event.\r
*/\r
enum USB_Host_EnumerationErrorCodes_t\r
{\r
HOST_ENUMERROR_NoError = 0, /**< No error occurred. Used internally, this is not a valid\r
- * ErrorCode parameter value for the \ref USB_DeviceEnumerationFailed\r
+ * ErrorCode parameter value for the \ref EVENT_USB_DeviceEnumerationFailed()\r
* event.\r
*/\r
HOST_ENUMERROR_WaitStage = 1, /**< One of the delays between enumeration steps failed\r
}\r
else\r
{\r
- RAISE_EVENT(USB_InitFailure, USB_INITERROR_NoUSBModeSpecified);\r
+ EVENT_USB_InitFailure(USB_INITERROR_NoUSBModeSpecified);\r
return;\r
}\r
#endif\r
void USB_ShutDown(void)\r
{\r
if (USB_IsConnected)\r
- RAISE_EVENT(USB_Disconnect);\r
+ EVENT_USB_Disconnect();\r
\r
USB_Detach();\r
\r
\r
/* Enums: */\r
/** Enum for error codes relating to the powering on of the USB interface. These error codes are\r
- * used in the ErrorCode parameter value of the \ref USB_InitFailure event.\r
+ * used in the ErrorCode parameter value of the \ref EVENT_USB_InitFailure() event.\r
*/\r
enum USB_InitErrorCodes_t\r
{\r
extern volatile uint8_t USB_Options;\r
#endif\r
\r
- /* Throwable Events: */\r
- /** This module raises the \ref USB_Disconnect event if the USB interface is reset (such as during a mode\r
- * change while in UID mode) while the USB interface is connected to a device when in host mode, or\r
- * a host while in device mode.\r
- *\r
- * \see Events.h for more information on this event.\r
- */\r
- RAISES_EVENT(USB_Disconnect);\r
- \r
- #if defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__)\r
- /** This module raises the Power On Failure event when an error occurs while initializing the USB\r
- * interface.\r
- *\r
- * \see Events.h for more information on this event.\r
- */\r
- RAISES_EVENT(USB_InitFailure);\r
- #endif\r
- \r
/* Private Interface - For use in library only: */\r
#if !defined(__DOXYGEN__)\r
/* Macros: */\r
* \ref Pipe_ClearOUT() macro. Between each USB packet, the given stream callback function is\r
* executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers.\r
*\r
- * The callback routine should be created using the \ref STREAM_CALLBACK() macro. If the token\r
- * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled\r
- * and this function has the Callback parameter omitted.\r
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.\r
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are\r
+ * disabled and this function has the Callback parameter omitted.\r
*\r
* \ingroup Group_PipeRW\r
*\r
* \ref Pipe_ClearOUT() macro. Between each USB packet, the given stream callback function is\r
* executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers.\r
*\r
- * The callback routine should be created using the \ref STREAM_CALLBACK() macro. If the token\r
- * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled\r
- * and this function has the Callback parameter omitted.\r
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.\r
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are\r
+ * disabled and this function has the Callback parameter omitted.\r
*\r
* \ingroup Group_PipeRW\r
*\r
* Between each USB packet, the given stream callback function is executed repeatedly until the next packet is ready,\r
* allowing for early aborts of stream transfers.\r
*\r
- * The callback routine should be created using the \ref STREAM_CALLBACK() macro. If the token\r
- * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled\r
- * and this function has the Callback parameter omitted.\r
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.\r
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are\r
+ * disabled and this function has the Callback parameter omitted.\r
*\r
* \ingroup Group_PipeRW\r
*\r
* \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is\r
* executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers.\r
*\r
- * The callback routine should be created using the \ref STREAM_CALLBACK() macro. If the token\r
- * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled\r
- * and this function has the Callback parameter omitted.\r
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.\r
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are\r
+ * disabled and this function has the Callback parameter omitted.\r
*\r
* \ingroup Group_PipeRW\r
*\r
* \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is\r
* executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers.\r
*\r
- * The callback routine should be created using the \ref STREAM_CALLBACK() macro. If the token\r
- * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled\r
- * and this function has the Callback parameter omitted.\r
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.\r
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are\r
+ * disabled and this function has the Callback parameter omitted.\r
*\r
* \ingroup Group_PipeRW\r
*\r
* - The Endpoint_ClearEndpointInterrupt() macro has been deleted and references to it should be removed.\r
* - The DESCRIPTOR_ADDRESS() macro has been removed. User applications should use normal casts to obtain a descriptor's memory\r
* address.\r
+ * - The library events system has been rewritten, so that all macros have been removed to allow for clearer user code. See\r
+ * \ref Group_Events for new API details.\r
+ * - The STREAM_CALLBACK() macro has been removed. User applications should replace all instances of the macro with regular\r
+ * function signatures of a function accepting no arguments and returning a uint8_t value.\r
*\r
- * <b>Device Mode</b>\r
+ * <b>Host Mode</b>\r
* - Support for non-control data pipe interrupts has been dropped due to many issues in the implementation. All existing\r
* projects using interrupts on non-control pipes should switch to polling.\r
* - The Pipe_ClearPipeInterrupt() macro has been deleted and references to it should be removed.\r
+ * - The library events system has been rewritten, so that all macros have been removed to allow for clearer user code. See\r
+ * \ref Group_Events for new API details.\r
+ * - The STREAM_CALLBACK() macro has been removed. User applications should replace all instances of the macro with regular\r
+ * function signatures of a function accepting no arguments and returning a uint8_t value.\r
+ * - The DESCRIPTOR_COMPARATOR() macro has been removed. User applications should replace all instances of the macro with\r
+ * regular function signatures of a function accepting a pointer to the descriptor to test, and returning a uint8_t value.\r
*\r
*\r
* \section Sec_Migration090510 Migrating from 090401 to 090510\r
}\r
\r
/** Event handler for the USB_Connect event. This starts the USB task. */\r
-EVENT_HANDLER(USB_Connect)\r
+void EVENT_USB_Connect(void)\r
{\r
/* Start USB management task */\r
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);\r
}\r
\r
/** Event handler for the USB_Disconnect event. This stops the USB and keyboard report tasks. */\r
-EVENT_HANDLER(USB_Disconnect)\r
+void EVENT_USB_Disconnect(void)\r
{\r
/* Stop running keyboard reporting, card reading and USB management tasks */\r
Scheduler_SetTaskMode(USB_Keyboard_Report, TASK_STOP);\r
/** Event handler for the USB_ConfigurationChanged event. This configures the device's endpoints ready\r
* to relay reports to the host, and starts the keyboard report task.\r
*/\r
-EVENT_HANDLER(USB_ConfigurationChanged)\r
+void EVENT_USB_ConfigurationChanged(void)\r
{\r
/* Setup Keyboard Keycode Report Endpoint */\r
Endpoint_ConfigureEndpoint(KEYBOARD_EPNUM, EP_TYPE_INTERRUPT,\r
* control requests that are not handled internally by the USB library, so that they can be handled appropriately\r
* for the application.\r
*/\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
+void EVENT_USB_UnhandledControlPacket(void)\r
{\r
/* Handle HID Class specific requests */\r
switch (USB_ControlRequest.bRequest)\r
uint8_t Reserved; /**< Reserved for OEM use, always set to 0 */\r
uint8_t KeyCode; /**< Key code array for pressed keys - up to six can be given simultaneously */\r
} USB_KeyboardReport_Data_t;\r
-\r
- /* Event Handlers: */\r
- /** Indicates that this module will catch the USB_Connect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Connect);\r
-\r
- /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
- HANDLES_EVENT(USB_Disconnect);\r
-\r
- /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */\r
- HANDLES_EVENT(USB_ConfigurationChanged);\r
-\r
- /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */\r
- HANDLES_EVENT(USB_UnhandledControlPacket);\r
- \r
+ \r
/* Function Prototypes: */\r
+ void EVENT_USB_Connect(void);\r
+ void EVENT_USB_Disconnect(void);\r
+ void EVENT_USB_ConfigurationChanged(void);\r
+ void EVENT_USB_UnhandledControlPacket(void);\r
+ \r
bool GetNextReport(USB_KeyboardReport_Data_t* ReportData);\r
void SendKey(USB_KeyboardReport_Data_t* KeyboardReportData, uint8_t Key);\r
void Send(USB_KeyboardReport_Data_t* KeyboardReportData, bool SendReport);\r
checkhooks: build
@echo
@echo ------- Unhooked LUFA Events -------
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \
echo "(None)"
@echo ------------------------------------