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.
This commit is contained in:
parent
72c2922e38
commit
2ee9fc7077
116 changed files with 596 additions and 1124 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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 ------------------------------------
|
||||
|
|
|
@ -100,7 +100,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);
|
||||
|
@ -115,7 +115,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.
|
||||
*/
|
||||
EVENT_HANDLER(USB_Disconnect)
|
||||
void EVENT_USB_Disconnect(void)
|
||||
{
|
||||
/* Stop running keyboard reporting and USB management tasks */
|
||||
Scheduler_SetTaskMode(USB_Keyboard_Report, TASK_STOP);
|
||||
|
@ -128,7 +128,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 keyboard device endpoints.
|
||||
*/
|
||||
EVENT_HANDLER(USB_ConfigurationChanged)
|
||||
void EVENT_USB_ConfigurationChanged(void)
|
||||
{
|
||||
/* Setup Keyboard Keycode Report Endpoint */
|
||||
Endpoint_ConfigureEndpoint(KEYBOARD_EPNUM, EP_TYPE_INTERRUPT,
|
||||
|
@ -151,7 +151,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)
|
||||
|
@ -220,7 +220,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
|
|||
Endpoint_ClearSETUP();
|
||||
|
||||
/* Set or clear the flag depending on what the host indicates that the current Protocol should be */
|
||||
UsingReportProtocol = (USB_ControlRequest.wValue != 0x0000);
|
||||
UsingReportProtocol = (USB_ControlRequest.wValue != 0);
|
||||
|
||||
/* Acknowledge status stage */
|
||||
while (!(Endpoint_IsINReady()));
|
||||
|
|
|
@ -55,25 +55,25 @@
|
|||
|
||||
/* Macros: */
|
||||
/** Idle period indicating that reports should be sent only when the inputs have changed */
|
||||
#define HID_IDLE_CHANGESONLY 0
|
||||
#define HID_IDLE_CHANGESONLY 0
|
||||
|
||||
/** HID Class specific request to get the next HID report from the device. */
|
||||
#define REQ_GetReport 0x01
|
||||
#define REQ_GetReport 0x01
|
||||
|
||||
/** HID Class specific request to get the idle timeout period of the device. */
|
||||
#define REQ_GetIdle 0x02
|
||||
#define REQ_GetIdle 0x02
|
||||
|
||||
/** HID Class specific request to send the next HID report to the device. */
|
||||
#define REQ_SetReport 0x09
|
||||
#define REQ_SetReport 0x09
|
||||
|
||||
/** HID Class specific request to set the idle timeout period of the device. */
|
||||
#define REQ_SetIdle 0x0A
|
||||
#define REQ_SetIdle 0x0A
|
||||
|
||||
/** HID Class specific request to get the current HID protocol in use, either report or boot. */
|
||||
#define REQ_GetProtocol 0x03
|
||||
#define REQ_GetProtocol 0x03
|
||||
|
||||
/** HID Class specific request to set the current HID protocol in use, either report or boot. */
|
||||
#define REQ_SetProtocol 0x0B
|
||||
#define REQ_SetProtocol 0x0B
|
||||
|
||||
/* Task Definitions: */
|
||||
TASK(USB_Keyboard_Report);
|
||||
|
@ -97,25 +97,17 @@
|
|||
Status_USBEnumerating = 1, /**< USB interface is enumerating */
|
||||
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);
|
||||
|
||||
void CreateKeyboardReport(USB_KeyboardReport_Data_t* ReportData);
|
||||
void ProcessLEDReport(uint8_t LEDReport);
|
||||
void SendNextReport(void);
|
||||
void ReceiveNextReport(void);
|
||||
void UpdateStatus(uint8_t CurrentStatus);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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 ------------------------------------
|
||||
|
|
|
@ -84,7 +84,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);
|
||||
|
@ -96,7 +96,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_USBTask, TASK_STOP);
|
||||
|
@ -108,7 +108,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 keyboard and mouse device endpoints.
|
||||
*/
|
||||
EVENT_HANDLER(USB_ConfigurationChanged)
|
||||
void EVENT_USB_ConfigurationChanged(void)
|
||||
{
|
||||
/* Setup Keyboard Report Endpoint */
|
||||
Endpoint_ConfigureEndpoint(KEYBOARD_IN_EPNUM, EP_TYPE_INTERRUPT,
|
||||
|
@ -133,7 +133,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)
|
||||
{
|
||||
uint8_t* ReportData;
|
||||
uint8_t ReportSize;
|
||||
|
|
|
@ -95,20 +95,12 @@
|
|||
int8_t Y; /**< Current mouse delta Y movement, as a signed 8-bit integer */
|
||||
} USB_MouseReport_Data_t;
|
||||
|
||||
/* 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 ------------------------------------
|
||||
|
|
|
@ -74,7 +74,7 @@ int main(void)
|
|||
}
|
||||
|
||||
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs. */
|
||||
EVENT_HANDLER(USB_Connect)
|
||||
void EVENT_USB_Connect(void)
|
||||
{
|
||||
/* Start USB management task */
|
||||
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);
|
||||
|
@ -86,7 +86,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 MIDI management tasks.
|
||||
*/
|
||||
EVENT_HANDLER(USB_Disconnect)
|
||||
void EVENT_USB_Disconnect(void)
|
||||
{
|
||||
/* Stop running audio and USB management tasks */
|
||||
Scheduler_SetTaskMode(USB_MIDI_Task, TASK_STOP);
|
||||
|
@ -99,7 +99,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 MIDI management task started.
|
||||
*/
|
||||
EVENT_HANDLER(USB_ConfigurationChanged)
|
||||
void EVENT_USB_ConfigurationChanged(void)
|
||||
{
|
||||
/* Setup MIDI stream endpoints */
|
||||
Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK,
|
||||
|
|
|
@ -80,17 +80,11 @@
|
|||
/* Task Definitions: */
|
||||
TASK(USB_MIDI_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);
|
||||
|
||||
/* Function Prototypes: */
|
||||
void EVENT_USB_Connect(void);
|
||||
void EVENT_USB_Disconnect(void);
|
||||
void EVENT_USB_ConfigurationChanged(void);
|
||||
|
||||
void SendMIDINoteChange(const uint8_t Pitch, const bool OnOff,
|
||||
const uint8_t CableID, const uint8_t Channel);
|
||||
void UpdateStatus(uint8_t CurrentStatus);
|
||||
|
|
|
@ -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 ------------------------------------
|
||||
|
|
|
@ -86,7 +86,7 @@ int main(void)
|
|||
}
|
||||
|
||||
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs. */
|
||||
EVENT_HANDLER(USB_Connect)
|
||||
void EventHandler_USB_Connect(void)
|
||||
{
|
||||
/* Indicate USB enumerating */
|
||||
UpdateStatus(Status_USBEnumerating);
|
||||
|
@ -98,7 +98,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 Mass Storage management task.
|
||||
*/
|
||||
EVENT_HANDLER(USB_Disconnect)
|
||||
void EventHandler_USB_Disconnect(void)
|
||||
{
|
||||
/* Stop running mass storage task */
|
||||
Scheduler_SetTaskMode(USB_MassStorage, TASK_STOP);
|
||||
|
@ -110,7 +110,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 Mass Storage management task started.
|
||||
*/
|
||||
EVENT_HANDLER(USB_ConfigurationChanged)
|
||||
void EventHandler_USB_ConfigurationChanged(void)
|
||||
{
|
||||
/* Setup Mass Storage In and Out Endpoints */
|
||||
Endpoint_ConfigureEndpoint(MASS_STORAGE_IN_EPNUM, EP_TYPE_BULK,
|
||||
|
@ -132,7 +132,7 @@ EVENT_HANDLER(USB_ConfigurationChanged)
|
|||
* control requests that are not handled internally by the USB library (including the Mass Storage class-specific
|
||||
* requests) so that they can be handled appropriately for the application.
|
||||
*/
|
||||
EVENT_HANDLER(USB_UnhandledControlPacket)
|
||||
void EventHandler_USB_UnhandledControlPacket(void)
|
||||
{
|
||||
/* Process UFI specific control requests */
|
||||
switch (USB_ControlRequest.bRequest)
|
||||
|
@ -283,7 +283,7 @@ static bool ReadInCommandBlock(void)
|
|||
|
||||
/* Read in command block header */
|
||||
Endpoint_Read_Stream_LE(&CommandBlock, (sizeof(CommandBlock) - sizeof(CommandBlock.SCSICommandData)),
|
||||
AbortOnMassStoreReset);
|
||||
StreamCallback_AbortOnMassStoreReset);
|
||||
|
||||
/* Check if the current command is being aborted by the host */
|
||||
if (IsMassStoreReset)
|
||||
|
@ -305,7 +305,7 @@ static bool ReadInCommandBlock(void)
|
|||
/* Read in command block command data */
|
||||
Endpoint_Read_Stream_LE(&CommandBlock.SCSICommandData,
|
||||
CommandBlock.SCSICommandLength,
|
||||
AbortOnMassStoreReset);
|
||||
StreamCallback_AbortOnMassStoreReset);
|
||||
|
||||
/* Check if the current command is being aborted by the host */
|
||||
if (IsMassStoreReset)
|
||||
|
@ -346,7 +346,7 @@ static void ReturnCommandStatus(void)
|
|||
|
||||
/* Write the CSW to the endpoint */
|
||||
Endpoint_Write_Stream_LE(&CommandStatus, sizeof(CommandStatus),
|
||||
AbortOnMassStoreReset);
|
||||
StreamCallback_AbortOnMassStoreReset);
|
||||
|
||||
/* Check if the current command is being aborted by the host */
|
||||
if (IsMassStoreReset)
|
||||
|
@ -359,7 +359,7 @@ static void ReturnCommandStatus(void)
|
|||
/** Stream callback function for the Endpoint stream read and write functions. This callback will abort the current stream transfer
|
||||
* if a Mass Storage Reset request has been issued to the control endpoint.
|
||||
*/
|
||||
STREAM_CALLBACK(AbortOnMassStoreReset)
|
||||
uint8_t StreamCallback_AbortOnMassStoreReset(void)
|
||||
{
|
||||
/* Abort if a Mass Storage reset command was received */
|
||||
if (IsMassStoreReset)
|
||||
|
|
|
@ -130,23 +130,12 @@
|
|||
/* Task Definitions: */
|
||||
TASK(USB_MassStorage);
|
||||
|
||||
/* Stream Callbacks: */
|
||||
STREAM_CALLBACK(AbortOnMassStoreReset);
|
||||
|
||||
/* 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);
|
||||
|
||||
#if defined(INCLUDE_FROM_MASSSTORAGE_C)
|
||||
|
@ -154,4 +143,6 @@
|
|||
static void ReturnCommandStatus(void);
|
||||
#endif
|
||||
|
||||
uint8_t StreamCallback_AbortOnMassStoreReset(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -166,12 +166,12 @@ static bool SCSI_Command_Inquiry(void)
|
|||
}
|
||||
|
||||
/* Write the INQUIRY data to the endpoint */
|
||||
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, AbortOnMassStoreReset);
|
||||
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, StreamCallback_AbortOnMassStoreReset);
|
||||
|
||||
uint8_t PadBytes[AllocationLength - BytesTransferred];
|
||||
|
||||
/* Pad out remaining bytes with 0x00 */
|
||||
Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), AbortOnMassStoreReset);
|
||||
Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), StreamCallback_AbortOnMassStoreReset);
|
||||
|
||||
/* Finalize the stream transfer to send the last packet */
|
||||
Endpoint_ClearIN();
|
||||
|
@ -193,12 +193,12 @@ static bool SCSI_Command_Request_Sense(void)
|
|||
uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
|
||||
|
||||
/* Send the SENSE data - this indicates to the host the status of the last command */
|
||||
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, AbortOnMassStoreReset);
|
||||
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, StreamCallback_AbortOnMassStoreReset);
|
||||
|
||||
uint8_t PadBytes[AllocationLength - BytesTransferred];
|
||||
|
||||
/* Pad out remaining bytes with 0x00 */
|
||||
Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), AbortOnMassStoreReset);
|
||||
Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), StreamCallback_AbortOnMassStoreReset);
|
||||
|
||||
/* Finalize the stream transfer to send the last packet */
|
||||
Endpoint_ClearIN();
|
||||
|
|
|
@ -508,7 +508,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 ------------------------------------
|
||||
|
|
|
@ -100,7 +100,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);
|
||||
|
@ -115,7 +115,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 Mouse reporting tasks.
|
||||
*/
|
||||
EVENT_HANDLER(USB_Disconnect)
|
||||
void EVENT_USB_Disconnect(void)
|
||||
{
|
||||
/* Stop running mouse reporting and USB management tasks */
|
||||
Scheduler_SetTaskMode(USB_Mouse_Report, TASK_STOP);
|
||||
|
@ -128,7 +128,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 - the device endpoints are configured and the mouse reporting task started.
|
||||
*/
|
||||
EVENT_HANDLER(USB_ConfigurationChanged)
|
||||
void EVENT_USB_ConfigurationChanged(void)
|
||||
{
|
||||
/* Setup Mouse Report Endpoint */
|
||||
Endpoint_ConfigureEndpoint(MOUSE_EPNUM, EP_TYPE_INTERRUPT,
|
||||
|
@ -146,7 +146,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)
|
||||
|
@ -195,7 +195,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
|
|||
Endpoint_ClearSETUP();
|
||||
|
||||
/* Set or clear the flag depending on what the host indicates that the current Protocol should be */
|
||||
UsingReportProtocol = (USB_ControlRequest.wValue != 0x0000);
|
||||
UsingReportProtocol = (USB_ControlRequest.wValue != 0);
|
||||
|
||||
/* Acknowledge status stage */
|
||||
while (!(Endpoint_IsINReady()));
|
||||
|
|
|
@ -98,20 +98,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);
|
||||
|
||||
void CreateMouseReport(USB_MouseReport_Data_t* ReportData);
|
||||
void UpdateStatus(uint8_t CurrentStatus);
|
||||
|
||||
|
|
|
@ -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 ------------------------------------
|
||||
|
|
|
@ -83,7 +83,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);
|
||||
|
@ -95,7 +95,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 all the relevant tasks.
|
||||
*/
|
||||
EVENT_HANDLER(USB_Disconnect)
|
||||
void EVENT_USB_Disconnect(void)
|
||||
{
|
||||
/* Stop running TCP/IP and USB management tasks */
|
||||
Scheduler_SetTaskMode(RNDIS_Task, TASK_STOP);
|
||||
|
@ -110,7 +110,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 RNDIS device endpoints and starts the relevant tasks.
|
||||
*/
|
||||
EVENT_HANDLER(USB_ConfigurationChanged)
|
||||
void EVENT_USB_ConfigurationChanged(void)
|
||||
{
|
||||
/* Setup CDC Notification, Rx and Tx Endpoints */
|
||||
Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK,
|
||||
|
@ -138,7 +138,7 @@ EVENT_HANDLER(USB_ConfigurationChanged)
|
|||
* control requests that are not handled internally by the USB library (including the RNDIS control commands,
|
||||
* which set up the USB RNDIS network adapter), so that they can be handled appropriately for the application.
|
||||
*/
|
||||
EVENT_HANDLER(USB_UnhandledControlPacket)
|
||||
void EVENT_USB_UnhandledControlPacket(void)
|
||||
{
|
||||
/* Process RNDIS class commands */
|
||||
switch (USB_ControlRequest.bRequest)
|
||||
|
|
|
@ -60,19 +60,6 @@
|
|||
/* Macros: */
|
||||
/** Notification value to indicate that a frame is ready to be read by the host. */
|
||||
#define NOTIF_RESPONSE_AVAILABLE 0x01
|
||||
|
||||
/* 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 a RNDIS notification message, for transmission to the RNDIS host via the notification
|
||||
|
@ -102,6 +89,11 @@
|
|||
TASK(Ethernet_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
|
||||
|
|
|
@ -518,7 +518,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 ------------------------------------
|
||||
|
|
|
@ -93,7 +93,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);
|
||||
|
@ -105,7 +105,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);
|
||||
|
@ -122,7 +122,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,
|
||||
|
@ -148,7 +148,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;
|
||||
|
||||
|
|
|
@ -112,19 +112,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.
|
||||
|
@ -186,6 +173,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 ReconfigureUSART(void);
|
||||
void UpdateStatus(uint8_t CurrentStatus);
|
||||
|
||||
|
|
|
@ -506,7 +506,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 ------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue