Commit 2ee9fc70 authored by Dean Camera's avatar Dean Camera

Rewritten event system to remove all macros, to make user code clearer.

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.
parent 72c2922e
......@@ -119,7 +119,7 @@ int main(void)
/** Event handler for the USB_Disconnect event. This indicates that the bootloader should exit and the user
* application started.
*/
EVENT_HANDLER(USB_Disconnect)
void EVENT_USB_Disconnect(void)
{
/* Upon disconnection, run user application */
RunBootloader = false;
......@@ -128,7 +128,7 @@ EVENT_HANDLER(USB_Disconnect)
/** Event handler for the USB_ConfigurationChanged event. This configures the device's endpoints ready
* to relay data to and from the attached USB host.
*/
EVENT_HANDLER(USB_ConfigurationChanged)
void EVENT_USB_ConfigurationChanged(void)
{
/* Setup CDC Notification, Rx and Tx Endpoints */
Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,
......@@ -148,7 +148,7 @@ EVENT_HANDLER(USB_ConfigurationChanged)
* control requests that are not handled internally by the USB library, so that they can be handled appropriately
* for the application.
*/
EVENT_HANDLER(USB_UnhandledControlPacket)
void EVENT_USB_UnhandledControlPacket(void)
{
uint8_t* LineCodingData = (uint8_t*)&LineCoding;
......
......@@ -83,16 +83,6 @@
/** Eight character bootloader firmware identifier reported to the host when requested */
#define SOFTWARE_IDENTIFIER "LUFACDC"
/* Event Handlers: */
/** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */
HANDLES_EVENT(USB_Disconnect);
/** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */
HANDLES_EVENT(USB_ConfigurationChanged);
/** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */
HANDLES_EVENT(USB_UnhandledControlPacket);
/* Type Defines: */
/** Type define for a non-returning pointer to the start of the loaded application in flash memory. */
......@@ -132,6 +122,10 @@
TASK(CDC_Task);
/* Function Prototypes: */
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
#if defined(INCLUDE_FROM_BOOTLOADERCDC_C) || defined(__DOXYGEN__)
static void ReadWriteMemoryBlock(const uint8_t Command);
static uint8_t FetchNextCommandByte(void);
......
......@@ -502,7 +502,7 @@ sizeafter:
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 ------------------------------------
......
......@@ -139,7 +139,7 @@ int main (void)
/** Event handler for the USB_Disconnect event. This indicates that the bootloader should exit and the user
* application started.
*/
EVENT_HANDLER(USB_Disconnect)
void EventHandler_USB_Disconnect(void)
{
/* Upon disconnection, run user application */
RunBootloader = false;
......@@ -149,7 +149,7 @@ EVENT_HANDLER(USB_Disconnect)
* control requests that are not handled internally by the USB library (including the DFU commands, which are
* all issued via the control endpoint), so that they can be handled appropriately for the application.
*/
EVENT_HANDLER(USB_UnhandledControlPacket)
void EventHandler_USB_UnhandledControlPacket(void)
{
/* Get the size of the command and data from the wLength value */
SentCommand.DataSize = USB_ControlRequest.wLength;
......
......@@ -191,15 +191,11 @@
errUNKNOWN = 14,
errSTALLEDPKT = 15
};
/* Event Handlers: */
/** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */
HANDLES_EVENT(USB_Disconnect);
/** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */
HANDLES_EVENT(USB_UnhandledControlPacket);
/* Function Prototypes: */
void EVENT_USB_Disconnect(void);
void EVENT_USB_UnhandledControlPacket(void);
#if defined(INCLUDE_FROM_BOOTLOADER_C)
static void DiscardFillerBytes(uint8_t NumberOfBytes);
static void ProcessBootloaderCommand(void);
......
......@@ -503,7 +503,7 @@ sizeafter:
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 ------------------------------------
......
......@@ -81,7 +81,7 @@ int main(void)
/** Event handler for the USB_ConfigurationChanged event. This configures the device's endpoints ready
* to relay data to and from the attached USB host.
*/
EVENT_HANDLER(USB_ConfigurationChanged)
void EVENT_USB_ConfigurationChanged(void)
{
/* Setup HID Report Endpoint */
Endpoint_ConfigureEndpoint(HID_EPNUM, EP_TYPE_INTERRUPT,
......@@ -93,7 +93,7 @@ EVENT_HANDLER(USB_ConfigurationChanged)
* control requests that are not handled internally by the USB library (including the HID commands, which are
* all issued via the control endpoint), so that they can be handled appropriately for the application.
*/
EVENT_HANDLER(USB_UnhandledControlPacket)
void EVENT_USB_UnhandledControlPacket(void)
{
/* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest)
......
......@@ -60,15 +60,9 @@
#define REQ_SetReport 0x09
#define TEENSY_STARTAPPLICATION 0xFFFF
/* Event Handlers: */
/** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */
HANDLES_EVENT(USB_Disconnect);
/** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */
HANDLES_EVENT(USB_ConfigurationChanged);
/** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */
HANDLES_EVENT(USB_UnhandledControlPacket);
/* Function Prototypes: */
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
#endif
......@@ -502,7 +502,7 @@ sizeafter:
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 ------------------------------------
......
......@@ -80,7 +80,7 @@ int main(void)
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs, and
* configures the sample update and PWM timers.
*/
EVENT_HANDLER(USB_Connect)
void EVENT_USB_Connect(void)
{
/* Start USB management task */
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);
......@@ -97,7 +97,7 @@ EVENT_HANDLER(USB_Connect)
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via
* the status LEDs, disables the sample update and PWM output timers and stops the USB and Audio management tasks.
*/
EVENT_HANDLER(USB_Disconnect)
void EVENT_USB_Disconnect(void)
{
/* Stop the sample reload timer */
TCCR0B = 0;
......@@ -113,7 +113,7 @@ EVENT_HANDLER(USB_Disconnect)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration
* of the USB device after enumeration - the device endpoints are configured.
*/
EVENT_HANDLER(USB_ConfigurationChanged)
void EVENT_USB_ConfigurationChanged(void)
{
/* Setup audio stream endpoint */
Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS,
......@@ -128,7 +128,7 @@ EVENT_HANDLER(USB_ConfigurationChanged)
* control requests that are not handled internally by the USB library (including the Audio class-specific
* requests) so that they can be handled appropriately for the application.
*/
EVENT_HANDLER(USB_UnhandledControlPacket)
void EVENT_USB_UnhandledControlPacket(void)
{
/* Process General and Audio specific control requests */
switch (USB_ControlRequest.bRequest)
......
......@@ -71,20 +71,12 @@
/* Task Definitions: */
TASK(USB_Audio_Task);
/* Event Handlers: */
/** Indicates that this module will catch the USB_Connect event when thrown by the library. */
HANDLES_EVENT(USB_Connect);
/** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */
HANDLES_EVENT(USB_Disconnect);
/** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */
HANDLES_EVENT(USB_ConfigurationChanged);
/** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */
HANDLES_EVENT(USB_UnhandledControlPacket);
/* Function Prototypes: */
void EVENT_USB_Connect(void);
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
void UpdateStatus(uint8_t CurrentStatus);
#endif
......@@ -505,7 +505,7 @@ sizeafter:
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 ------------------------------------
......
......@@ -75,7 +75,7 @@ int main(void)
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs, and
* configures the sample update and PWM timers.
*/
EVENT_HANDLER(USB_Connect)
void EventHandler_USB_Connect(void)
{
/* Start USB management task */
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);
......@@ -110,7 +110,7 @@ EVENT_HANDLER(USB_Connect)
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via
* the status LEDs, disables the sample update and PWM output timers and stops the USB and Audio management tasks.
*/
EVENT_HANDLER(USB_Disconnect)
void EventHandler_USB_Disconnect(void)
{
/* Stop the timers */
TCCR0B = 0;
......@@ -140,7 +140,7 @@ EVENT_HANDLER(USB_Disconnect)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration
* of the USB device after enumeration - the device endpoints are configured.
*/
EVENT_HANDLER(USB_ConfigurationChanged)
void EventHandler_USB_ConfigurationChanged(void)
{
/* Setup audio stream endpoint */
Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS,
......@@ -155,7 +155,7 @@ EVENT_HANDLER(USB_ConfigurationChanged)
* control requests that are not handled internally by the USB library (including the Audio class-specific
* requests) so that they can be handled appropriately for the application.
*/
EVENT_HANDLER(USB_UnhandledControlPacket)
void EventHandler_USB_UnhandledControlPacket(void)
{
/* Process General and Audio specific control requests */
switch (USB_ControlRequest.bRequest)
......
......@@ -107,21 +107,13 @@
/* Task Definitions: */
TASK(USB_Audio_Task);
/* Event Handlers: */
/** Indicates that this module will catch the USB_Connect event when thrown by the library. */
HANDLES_EVENT(USB_Connect);
/** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */
HANDLES_EVENT(USB_Disconnect);
/** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */
HANDLES_EVENT(USB_ConfigurationChanged);
/** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */
HANDLES_EVENT(USB_UnhandledControlPacket);
/* Function Prototypes: */
void EVENT_USB_Connect(void);
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
void UpdateStatus(uint8_t CurrentStatus);
#endif
......@@ -505,7 +505,7 @@ sizeafter:
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 ------------------------------------
......
......@@ -104,7 +104,7 @@ int main(void)
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and
* starts the library USB task to begin the enumeration and USB management process.
*/
EVENT_HANDLER(USB_Connect)
void EVENT_USB_Connect(void)
{
/* Start USB management task */
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);
......@@ -116,7 +116,7 @@ EVENT_HANDLER(USB_Connect)
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via
* the status LEDs and stops the USB management and CDC management tasks.
*/
EVENT_HANDLER(USB_Disconnect)
void EVENT_USB_Disconnect(void)
{
/* Stop running CDC and USB management tasks */
Scheduler_SetTaskMode(CDC_Task, TASK_STOP);
......@@ -129,7 +129,7 @@ EVENT_HANDLER(USB_Disconnect)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration
* of the USB device after enumeration - the device endpoints are configured and the CDC management task started.
*/
EVENT_HANDLER(USB_ConfigurationChanged)
void EVENT_USB_ConfigurationChanged(void)
{
/* Setup CDC Notification, Rx and Tx Endpoints */
Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,
......@@ -155,7 +155,7 @@ EVENT_HANDLER(USB_ConfigurationChanged)
* control requests that are not handled internally by the USB library (including the CDC control commands,
* which are all issued via the control endpoint), so that they can be handled appropriately for the application.
*/
EVENT_HANDLER(USB_UnhandledControlPacket)
void EVENT_USB_UnhandledControlPacket(void)
{
uint8_t* LineCodingData = (uint8_t*)&LineCoding;
......
......@@ -111,19 +111,6 @@
*/
#define CONTROL_LINE_IN_OVERRUNERROR (1 << 6)
/* Event Handlers: */
/** Indicates that this module will catch the USB_Connect event when thrown by the library. */
HANDLES_EVENT(USB_Connect);
/** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */
HANDLES_EVENT(USB_Disconnect);
/** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */
HANDLES_EVENT(USB_ConfigurationChanged);
/** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */
HANDLES_EVENT(USB_UnhandledControlPacket);
/* Type Defines: */
/** Type define for the virtual serial port line encoding settings, for storing the current USART configuration
* as set by the host via a class specific request.
......@@ -185,6 +172,11 @@
TASK(CDC_Task);
/* Function Prototypes: */
void EVENT_USB_Connect(void);
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
void UpdateStatus(uint8_t CurrentStatus);
#endif
......@@ -505,7 +505,7 @@ sizeafter:
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 ------------------------------------
......
......@@ -118,7 +118,7 @@ int main(void)
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and
* starts the library USB task to begin the enumeration and USB management process.
*/
EVENT_HANDLER(USB_Connect)
void EVENT_USB_Connect(void)
{
/* Start USB management task */
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);
......@@ -130,7 +130,7 @@ EVENT_HANDLER(USB_Connect)
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via
* the status LEDs and stops the USB management and CDC management tasks.
*/
EVENT_HANDLER(USB_Disconnect)
void EVENT_USB_Disconnect(void)
{
/* Stop running CDC and USB management tasks */
Scheduler_SetTaskMode(CDC1_Task, TASK_STOP);
......@@ -144,7 +144,7 @@ EVENT_HANDLER(USB_Disconnect)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration
* of the USB device after enumeration - the device endpoints are configured and the CDC management tasks are started.
*/
EVENT_HANDLER(USB_ConfigurationChanged)
void EVENT_USB_ConfigurationChanged(void)
{
/* Setup CDC Notification, Rx and Tx Endpoints for the first CDC */
Endpoint_ConfigureEndpoint(CDC1_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,
......@@ -184,7 +184,7 @@ EVENT_HANDLER(USB_ConfigurationChanged)
* control requests that are not handled internally by the USB library (including the CDC control commands,
* which are all issued via the control endpoint), so that they can be handled appropriately for the application.
*/
EVENT_HANDLER(USB_UnhandledControlPacket)
void EVENT_USB_UnhandledControlPacket(void)
{
/* Determine which interface's Line Coding data is being set from the wIndex parameter */
uint8_t* LineCodingData = (USB_ControlRequest.wIndex == 0) ? (uint8_t*)&LineCoding1 : (uint8_t*)&LineCoding2;
......
......@@ -60,19 +60,6 @@
/** CDC Class specific request to set the current virtual serial port handshake line states. */
#define REQ_SetControlLineState 0x22
/* Event Handlers: */
/** Indicates that this module will catch the USB_Connect event when thrown by the library. */
HANDLES_EVENT(USB_Connect);
/** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */
HANDLES_EVENT(USB_Disconnect);
/** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */
HANDLES_EVENT(USB_ConfigurationChanged);
/** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */
HANDLES_EVENT(USB_UnhandledControlPacket);
/* Type Defines: */
/** Type define for the virtual serial port line encoding settings, for storing the current USART configuration
* as set by the host via a class specific request.
......@@ -121,6 +108,11 @@
TASK(CDC2_Task);
/* Function Prototypes: */
void EVENT_USB_Connect(void);
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
void UpdateStatus(uint8_t CurrentStatus);
#endif
......@@ -505,7 +505,7 @@ sizeafter:
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 ------------------------------------
......
......@@ -75,7 +75,7 @@ int main(void)
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and
* starts the library USB task to begin the enumeration and USB management process.
*/
EVENT_HANDLER(USB_Connect)
void EVENT_USB_Connect(void)
{
/* Start USB management task */
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);
......@@ -87,7 +87,7 @@ EVENT_HANDLER(USB_Connect)
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via
* the status LEDs and stops the USB management task.
*/
EVENT_HANDLER(USB_Disconnect)
void EVENT_USB_Disconnect(void)
{
/* Stop running HID reporting and USB management tasks */
Scheduler_SetTaskMode(USB_HID_Report, TASK_STOP);
......@@ -100,7 +100,7 @@ EVENT_HANDLER(USB_Disconnect)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration
* of the USB device after enumeration, and configures the generic HID device endpoints.
*/
EVENT_HANDLER(USB_ConfigurationChanged)
void EVENT_USB_ConfigurationChanged(void)
{
/* Setup Generic IN Report Endpoint */
Endpoint_ConfigureEndpoint(GENERIC_IN_EPNUM, EP_TYPE_INTERRUPT,
......@@ -120,7 +120,7 @@ EVENT_HANDLER(USB_ConfigurationChanged)
* control requests that are not handled internally by the USB library (including the HID commands, which are
* all issued via the control endpoint), so that they can be handled appropriately for the application.
*/
EVENT_HANDLER(USB_UnhandledControlPacket)
void EVENT_USB_UnhandledControlPacket(void)
{
/* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest)
......
......@@ -67,20 +67,15 @@
Status_USBReady = 2, /**< USB interface is connected and ready */
};
/* Event Handlers: */
/** Indicates that this module will catch the USB_Connect event when thrown by the library. */
HANDLES_EVENT(USB_Connect);
/** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */
HANDLES_EVENT(USB_Disconnect);
/** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */
HANDLES_EVENT(USB_ConfigurationChanged);
/* Task Definitions: */
TASK(USB_HID_Report);
/* Function Prototypes: */
void EVENT_USB_Connect(void);
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
void UpdateStatus(uint8_t CurrentStatus);
void ProcessGenericHIDReport(uint8_t* DataArray);
void CreateGenericHIDReport(uint8_t* DataArray);
......
......@@ -504,7 +504,7 @@ sizeafter:
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 ------------------------------------
......
......@@ -76,7 +76,7 @@ int main(void)
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and
* starts the library USB task to begin the enumeration and USB management process.
*/
EVENT_HANDLER(USB_Connect)
void EVENT_USB_Connect(void)
{
/* Start USB management task */
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);
......@@ -88,7 +88,7 @@ EVENT_HANDLER(USB_Connect)
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via
* the status LEDs and stops the USB management and joystick reporting tasks.
*/
EVENT_HANDLER(USB_Disconnect)
void EVENT_USB_Disconnect(void)
{
/* Stop running joystick reporting and USB management tasks */
Scheduler_SetTaskMode(USB_Joystick_Report, TASK_STOP);
......@@ -101,7 +101,7 @@ EVENT_HANDLER(USB_Disconnect)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration
* of the USB device after enumeration - the device endpoints are configured and the joystick reporting task started.
*/
EVENT_HANDLER(USB_ConfigurationChanged)
void EVENT_USB_ConfigurationChanged(void)
{
/* Setup Joystick Report Endpoint */
Endpoint_ConfigureEndpoint(JOYSTICK_EPNUM, EP_TYPE_INTERRUPT,
......@@ -119,7 +119,7 @@ EVENT_HANDLER(USB_ConfigurationChanged)
* control requests that are not handled internally by the USB library (including the HID commands, which are
* all issued via the control endpoint), so that they can be handled appropriately for the application.
*/
EVENT_HANDLER(USB_UnhandledControlPacket)
void EVENT_USB_UnhandledControlPacket(void)
{
/* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest)
......
......@@ -78,20 +78,12 @@
Status_USBReady = 2, /**< USB interface is connected and ready */
};
/* Event Handlers: */
/** Indicates that this module will catch the USB_Connect event when thrown by the library. */
HANDLES_EVENT(USB_Connect);
/** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */
HANDLES_EVENT(USB_Disconnect);
/** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */
HANDLES_EVENT(USB_ConfigurationChanged);
/** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */
HANDLES_EVENT(USB_UnhandledControlPacket);
/* Function Prototypes: */
void EVENT_USB_Connect(void);
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
bool GetNextReport(USB_JoystickReport_Data_t* ReportData);
void UpdateStatus(uint8_t CurrentStatus);
......