Renamed all library events to properly seperate out Device and Host mode events. Changed the firing conditions for some events to ensure that events are fired by their own USB mode only.

Remove VBUS events - not needed as the library takes care of VBUS detection and feedback on supported AVRs via the USB_Device_Connected and USB_Device_Disconnected events.

Fixed incorrect Host state assignment in the incomplete BluetoothHost demo.
pull/1469/head
Dean Camera 16 years ago
parent 357ccc577b
commit c5038f1bf4

@ -119,7 +119,7 @@ void ResetHardware(void)
/** Event handler for the USB_Disconnect event. This indicates that the bootloader should exit and the user /** Event handler for the USB_Disconnect event. This indicates that the bootloader should exit and the user
* application started. * application started.
*/ */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
/* Upon disconnection, run user application */ /* Upon disconnection, run user application */
RunBootloader = false; RunBootloader = false;
@ -128,7 +128,7 @@ void EVENT_USB_Disconnect(void)
/** Event handler for the USB_ConfigurationChanged event. This configures the device's endpoints ready /** Event handler for the USB_ConfigurationChanged event. This configures the device's endpoints ready
* to relay data to and from the attached USB host. * to relay data to and from the attached USB host.
*/ */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
/* Setup CDC Notification, Rx and Tx Endpoints */ /* Setup CDC Notification, Rx and Tx Endpoints */
Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,
@ -144,11 +144,11 @@ void EVENT_USB_ConfigurationChanged(void)
ENDPOINT_BANK_SINGLE); ENDPOINT_BANK_SINGLE);
} }
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific /** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
* control requests that are not handled internally by the USB library, so that they can be handled appropriately * control requests that are not handled internally by the USB library, so that they can be handled appropriately
* for the application. * for the application.
*/ */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
uint8_t* LineCodingData = (uint8_t*)&LineCoding; uint8_t* LineCodingData = (uint8_t*)&LineCoding;

@ -118,9 +118,9 @@
void SetupHardware(void); void SetupHardware(void);
void ResetHardware(void); void ResetHardware(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
#if defined(INCLUDE_FROM_BOOTLOADERCDC_C) || defined(__DOXYGEN__) #if defined(INCLUDE_FROM_BOOTLOADERCDC_C) || defined(__DOXYGEN__)
static void ReadWriteMemoryBlock(const uint8_t Command); static void ReadWriteMemoryBlock(const uint8_t Command);

@ -144,17 +144,17 @@ void ResetHardware(void)
/** Event handler for the USB_Disconnect event. This indicates that the bootloader should exit and the user /** Event handler for the USB_Disconnect event. This indicates that the bootloader should exit and the user
* application started. * application started.
*/ */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
/* Upon disconnection, run user application */ /* Upon disconnection, run user application */
RunBootloader = false; RunBootloader = false;
} }
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific /** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
* control requests that are not handled internally by the USB library (including the DFU commands, which are * 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. * all issued via the control endpoint), so that they can be handled appropriately for the application.
*/ */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
/* Get the size of the command and data from the wLength value */ /* Get the size of the command and data from the wLength value */
SentCommand.DataSize = USB_ControlRequest.wLength; SentCommand.DataSize = USB_ControlRequest.wLength;

@ -191,8 +191,8 @@
void SetupHardware(void); void SetupHardware(void);
void ResetHardware(void); void ResetHardware(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
#if defined(INCLUDE_FROM_BOOTLOADER_C) #if defined(INCLUDE_FROM_BOOTLOADER_C)
static void DiscardFillerBytes(uint8_t NumberOfBytes); static void DiscardFillerBytes(uint8_t NumberOfBytes);

@ -84,7 +84,7 @@ void SetupHardware(void)
/** Event handler for the USB_ConfigurationChanged event. This configures the device's endpoints ready /** Event handler for the USB_ConfigurationChanged event. This configures the device's endpoints ready
* to relay data to and from the attached USB host. * to relay data to and from the attached USB host.
*/ */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
/* Setup HID Report Endpoint */ /* Setup HID Report Endpoint */
Endpoint_ConfigureEndpoint(HID_EPNUM, EP_TYPE_INTERRUPT, Endpoint_ConfigureEndpoint(HID_EPNUM, EP_TYPE_INTERRUPT,
@ -92,11 +92,11 @@ void EVENT_USB_ConfigurationChanged(void)
ENDPOINT_BANK_SINGLE); ENDPOINT_BANK_SINGLE);
} }
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific /** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
* control requests that are not handled internally by the USB library (including the HID commands, which are * 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. * all issued via the control endpoint), so that they can be handled appropriately for the application.
*/ */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
/* Handle HID Class specific requests */ /* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest) switch (USB_ControlRequest.bRequest)

@ -64,7 +64,7 @@
/* Function Prototypes: */ /* Function Prototypes: */
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
#endif #endif

@ -47,7 +47,7 @@
* This bootloader enumerates to the host as a HID Class device, allowing for Teensy compatible programming * This bootloader enumerates to the host as a HID Class device, allowing for Teensy compatible programming
* software to load firmware onto the AVR, such as the official software at http://www.pjrc.com/teensy/. * software to load firmware onto the AVR, such as the official software at http://www.pjrc.com/teensy/.
* *
* Out of the box this bootloader builds for the USB162, and will fit into 2KB of bootloader space. * Out of the box this bootloader builds for the AT90USB162, and will fit into 4KB of bootloader space.
* *
* This spoofs (with permission) the official Teensy bootloader's VID and PID, so that the software remains * This spoofs (with permission) the official Teensy bootloader's VID and PID, so that the software remains
* compatible with no changes. * compatible with no changes.

@ -112,7 +112,7 @@ void ProcessNextSample(void)
} }
/** Event handler for the library USB Connection event. */ /** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -123,7 +123,7 @@ void EVENT_USB_Connect(void)
} }
/** Event handler for the library USB Disconnection event. */ /** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
/* Stop the sample reload timer */ /* Stop the sample reload timer */
TCCR0B = 0; TCCR0B = 0;
@ -132,7 +132,7 @@ void EVENT_USB_Disconnect(void)
} }
/** Event handler for the library USB Configuration Changed event. */ /** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -140,8 +140,8 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/** Event handler for the library USB Unhandled Control Packet event. */ /** Event handler for the library USB Unhandled Control Request event. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
Audio_Device_ProcessControlPacket(&Microphone_Audio_Interface); Audio_Device_ProcessControlRequest(&Microphone_Audio_Interface);
} }

@ -76,9 +76,9 @@
void SetupHardware(void); void SetupHardware(void);
void ProcessNextSample(void); void ProcessNextSample(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
#endif #endif

@ -140,7 +140,7 @@ void ProcessNextSample(void)
} }
/** Event handler for the library USB Connection event. */ /** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -169,7 +169,7 @@ void EVENT_USB_Connect(void)
} }
/** Event handler for the library USB Disconnection event. */ /** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -194,7 +194,7 @@ void EVENT_USB_Disconnect(void)
} }
/** Event handler for the library USB Configuration Changed event. */ /** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -202,8 +202,8 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/** Event handler for the library USB Unhandled Control Packet event. */ /** Event handler for the library USB Unhandled Control Request event. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
Audio_Device_ProcessControlPacket(&Speaker_Audio_Interface); Audio_Device_ProcessControlRequest(&Speaker_Audio_Interface);
} }

@ -68,9 +68,9 @@
void SetupHardware(void); void SetupHardware(void);
void ProcessNextSample(void); void ProcessNextSample(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
#endif #endif

@ -155,19 +155,19 @@ void CheckJoystickMovement(void)
} }
/** Event handler for the library USB Connection event. */ /** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
} }
/** Event handler for the library USB Disconnection event. */ /** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} }
/** Event handler for the library USB Configuration Changed event. */ /** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -175,8 +175,8 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/** Event handler for the library USB Unhandled Control Packet event. */ /** Event handler for the library USB Unhandled Control Request event. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
CDC_Device_ProcessControlPacket(&VirtualSerial_CDC_Interface); CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
} }

@ -67,9 +67,9 @@
void SetupHardware(void); void SetupHardware(void);
void CheckJoystickMovement(void); void CheckJoystickMovement(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
#endif #endif

@ -163,19 +163,19 @@ void CheckJoystickMovement(void)
} }
/** Event handler for the library USB Connection event. */ /** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
} }
/** Event handler for the library USB Disconnection event. */ /** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} }
/** Event handler for the library USB Configuration Changed event. */ /** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -186,9 +186,9 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/** Event handler for the library USB Unhandled Control Packet event. */ /** Event handler for the library USB Unhandled Control Request event. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
CDC_Device_ProcessControlPacket(&VirtualSerial1_CDC_Interface); CDC_Device_ProcessControlRequest(&VirtualSerial1_CDC_Interface);
CDC_Device_ProcessControlPacket(&VirtualSerial2_CDC_Interface); CDC_Device_ProcessControlRequest(&VirtualSerial2_CDC_Interface);
} }

@ -67,9 +67,9 @@
void SetupHardware(void); void SetupHardware(void);
void CheckJoystickMovement(void); void CheckJoystickMovement(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
#endif #endif

@ -103,19 +103,19 @@ void SetupHardware(void)
} }
/** Event handler for the library USB Connection event. */ /** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
} }
/** Event handler for the library USB Disconnection event. */ /** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} }
/** Event handler for the library USB Configuration Changed event. */ /** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -123,10 +123,10 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/** Event handler for the library USB Unhandled Control Packet event. */ /** Event handler for the library USB Unhandled Control Request event. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
HID_Device_ProcessControlPacket(&Generic_HID_Interface); HID_Device_ProcessControlRequest(&Generic_HID_Interface);
} }
/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */ /** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */

@ -67,10 +67,10 @@
/* Function Prototypes: */ /* Function Prototypes: */
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
void* ReportData, uint16_t* ReportSize); void* ReportData, uint16_t* ReportSize);

@ -97,19 +97,19 @@ void SetupHardware(void)
} }
/** Event handler for the library USB Connection event. */ /** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
} }
/** Event handler for the library USB Disconnection event. */ /** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} }
/** Event handler for the library USB Configuration Changed event. */ /** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -117,10 +117,10 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/** Event handler for the library USB Unhandled Control Packet event. */ /** Event handler for the library USB Unhandled Control Request event. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
HID_Device_ProcessControlPacket(&Joystick_HID_Interface); HID_Device_ProcessControlRequest(&Joystick_HID_Interface);
} }
/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */ /** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */

@ -78,10 +78,10 @@
/* Function Prototypes: */ /* Function Prototypes: */
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
void* ReportData, uint16_t* ReportSize); void* ReportData, uint16_t* ReportSize);

@ -98,19 +98,19 @@ void SetupHardware()
} }
/** Event handler for the library USB Connection event. */ /** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
} }
/** Event handler for the library USB Disconnection event. */ /** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} }
/** Event handler for the library USB Configuration Changed event. */ /** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -118,10 +118,10 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/** Event handler for the library USB Unhandled Control Packet event. */ /** Event handler for the library USB Unhandled Control Request event. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
HID_Device_ProcessControlPacket(&Keyboard_HID_Interface); HID_Device_ProcessControlRequest(&Keyboard_HID_Interface);
} }
/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */ /** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */

@ -81,10 +81,10 @@
/* Function Prototypes: */ /* Function Prototypes: */
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
void* ReportData, uint16_t* ReportSize); void* ReportData, uint16_t* ReportSize);

@ -121,19 +121,19 @@ void SetupHardware()
} }
/** Event handler for the library USB Connection event. */ /** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
} }
/** Event handler for the library USB Disconnection event. */ /** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} }
/** Event handler for the library USB Configuration Changed event. */ /** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -144,11 +144,11 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/** Event handler for the library USB Unhandled Control Packet event. */ /** Event handler for the library USB Unhandled Control Request event. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
HID_Device_ProcessControlPacket(&Keyboard_HID_Interface); HID_Device_ProcessControlRequest(&Keyboard_HID_Interface);
HID_Device_ProcessControlPacket(&Mouse_HID_Interface); HID_Device_ProcessControlRequest(&Mouse_HID_Interface);
} }
/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */ /** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */

@ -85,10 +85,10 @@
/* Function Prototypes: */ /* Function Prototypes: */
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
void* ReportData, uint16_t* ReportSize); void* ReportData, uint16_t* ReportSize);

@ -157,19 +157,19 @@ void CheckJoystickMovement(void)
} }
/** Event handler for the library USB Connection event. */ /** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
} }
/** Event handler for the library USB Disconnection event. */ /** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} }
/** Event handler for the library USB Configuration Changed event. */ /** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -177,8 +177,8 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/** Event handler for the library USB Unhandled Control Packet event. */ /** Event handler for the library USB Unhandled Control Request event. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
MIDI_Device_ProcessControlPacket(&Keyboard_MIDI_Interface); MIDI_Device_ProcessControlRequest(&Keyboard_MIDI_Interface);
} }

@ -69,9 +69,9 @@
void SetupHardware(void); void SetupHardware(void);
void CheckJoystickMovement(void); void CheckJoystickMovement(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
#endif #endif

@ -92,19 +92,19 @@ void SetupHardware(void)
} }
/** Event handler for the library USB Connection event. */ /** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
} }
/** Event handler for the library USB Disconnection event. */ /** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} }
/** Event handler for the library USB Configuration Changed event. */ /** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -112,10 +112,10 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/** Event handler for the library USB Unhandled Control Packet event. */ /** Event handler for the library USB Unhandled Control Request event. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
MS_Device_ProcessControlPacket(&Disk_MS_Interface); MS_Device_ProcessControlRequest(&Disk_MS_Interface);
} }
/** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed. /** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed.

@ -78,10 +78,10 @@
/* Function Prototypes: */ /* Function Prototypes: */
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* MSInterfaceInfo); bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* MSInterfaceInfo);

@ -96,20 +96,20 @@ void SetupHardware(void)
TIMSK0 = (1 << OCIE0A); TIMSK0 = (1 << OCIE0A);
} }
/** Event handler for the library USB Connection event. */ /** Event handler for the library USB WakeUp event. */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
} }
/** Event handler for the library USB Disconnection event. */ /** Event handler for the library USB Suspend event. */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} }
/** Event handler for the library USB Configuration Changed event. */ /** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -117,10 +117,10 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/** Event handler for the library USB Unhandled Control Packet event. */ /** Event handler for the library USB Unhandled Control Request event. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_Device_UnhandledControlRequest(void)
{ {
HID_Device_ProcessControlPacket(&Mouse_HID_Interface); HID_Device_ProcessControlRequest(&Mouse_HID_Interface);
} }
/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */ /** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */

@ -80,10 +80,10 @@
/* Function Prototypes: */ /* Function Prototypes: */
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_Device_UnhandledControlRequest(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
void* ReportData, uint16_t* ReportSize); void* ReportData, uint16_t* ReportSize);

@ -107,19 +107,19 @@ void SetupHardware(void)
} }
/** Event handler for the library USB Connection event. */ /** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
} }
/** Event handler for the library USB Disconnection event. */ /** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} }
/** Event handler for the library USB Configuration Changed event. */ /** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -127,8 +127,8 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/** Event handler for the library USB Unhandled Control Packet event. */ /** Event handler for the library USB Unhandled Control Request event. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
RNDIS_Device_ProcessControlPacket(&Ethernet_RNDIS_Interface); RNDIS_Device_ProcessControlRequest(&Ethernet_RNDIS_Interface);
} }

@ -76,9 +76,9 @@
/* Function Prototypes: */ /* Function Prototypes: */
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
#endif #endif

@ -116,19 +116,19 @@ void SetupHardware(void)
} }
/** Event handler for the library USB Connection event. */ /** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
} }
/** Event handler for the library USB Disconnection event. */ /** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} }
/** Event handler for the library USB Configuration Changed event. */ /** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -136,10 +136,10 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/** Event handler for the library USB Unhandled Control Packet event. */ /** Event handler for the library USB Unhandled Control Request event. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlPacket(void)
{ {
CDC_Device_ProcessControlPacket(&VirtualSerial_CDC_Interface); CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
} }
/** ISR to manage the reception of data from the serial port, placing received bytes into a circular buffer /** ISR to manage the reception of data from the serial port, placing received bytes into a circular buffer

@ -69,10 +69,10 @@
/* Function Prototypes: */ /* Function Prototypes: */
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);

@ -82,17 +82,17 @@ void SetupHardware(void)
SerialStream_Init(9600, false); SerialStream_Init(9600, false);
} }
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
} }
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} }
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -112,7 +112,7 @@ void EVENT_USB_ConfigurationChanged(void)
} }
} }
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
/* Process UFI specific control requests */ /* Process UFI specific control requests */
switch (USB_ControlRequest.bRequest) switch (USB_ControlRequest.bRequest)

@ -65,9 +65,9 @@
void SetupHardware(void); void SetupHardware(void);
void SideShow_Task(void); void SideShow_Task(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
#endif #endif

@ -78,7 +78,7 @@ void SetupHardware(void)
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs, and /** 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. * configures the sample update and PWM timers.
*/ */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
/* Indicate USB enumerating */ /* Indicate USB enumerating */
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -92,7 +92,7 @@ void EVENT_USB_Connect(void)
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via /** 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. * the status LEDs, disables the sample update and PWM output timers and stops the USB and Audio management tasks.
*/ */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
/* Stop the sample reload timer */ /* Stop the sample reload timer */
TCCR0B = 0; TCCR0B = 0;
@ -107,7 +107,7 @@ void EVENT_USB_Disconnect(void)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration /** 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. * of the USB device after enumeration - the device endpoints are configured.
*/ */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
/* Indicate USB connected and ready */ /* Indicate USB connected and ready */
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -121,11 +121,11 @@ void EVENT_USB_ConfigurationChanged(void)
} }
} }
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific /** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
* control requests that are not handled internally by the USB library (including the Audio class-specific * 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. * requests) so that they can be handled appropriately for the application.
*/ */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
/* Process General and Audio specific control requests */ /* Process General and Audio specific control requests */
switch (USB_ControlRequest.bRequest) switch (USB_ControlRequest.bRequest)

@ -74,9 +74,9 @@
void SetupHardware(void); void SetupHardware(void);
void USB_Audio_Task(void); void USB_Audio_Task(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
#endif #endif

@ -73,7 +73,7 @@ void SetupHardware(void)
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs, and /** 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. * configures the sample update and PWM timers.
*/ */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
/* Indicate USB enumerating */ /* Indicate USB enumerating */
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -105,7 +105,7 @@ void EVENT_USB_Connect(void)
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via /** 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. * the status LEDs, disables the sample update and PWM output timers and stops the USB and Audio management tasks.
*/ */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
/* Stop the timers */ /* Stop the timers */
TCCR0B = 0; TCCR0B = 0;
@ -134,7 +134,7 @@ void EVENT_USB_Disconnect(void)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration /** 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. * of the USB device after enumeration - the device endpoints are configured.
*/ */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
/* Indicate USB connected and ready */ /* Indicate USB connected and ready */
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -148,11 +148,11 @@ void EVENT_USB_ConfigurationChanged(void)
} }
} }
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific /** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
* control requests that are not handled internally by the USB library (including the Audio class-specific * 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. * requests) so that they can be handled appropriately for the application.
*/ */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
/* Process General and Audio specific control requests */ /* Process General and Audio specific control requests */
switch (USB_ControlRequest.bRequest) switch (USB_ControlRequest.bRequest)

@ -65,9 +65,9 @@
void SetupHardware(void); void SetupHardware(void);
void USB_Audio_Task(void); void USB_Audio_Task(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
#endif #endif

@ -143,7 +143,7 @@ void SetupHardware(void)
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and /** 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. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
/* Indicate USB enumerating */ /* Indicate USB enumerating */
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -152,7 +152,7 @@ void EVENT_USB_Connect(void)
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via /** 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. * the status LEDs and stops the USB management and CDC management tasks.
*/ */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
/* Indicate USB not ready */ /* Indicate USB not ready */
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -161,7 +161,7 @@ void EVENT_USB_Disconnect(void)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration /** 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. * of the USB device after enumeration - the device endpoints are configured and the CDC management task started.
*/ */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
/* Indicate USB connected and ready */ /* Indicate USB connected and ready */
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -187,13 +187,16 @@ void EVENT_USB_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/* Reset line encoding baud rate so that the host knows to send new values */
LineEncoding.BaudRateBPS = 0;
} }
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific /** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
* control requests that are not handled internally by the USB library (including the CDC control commands, * 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. * which are all issued via the control endpoint), so that they can be handled appropriately for the application.
*/ */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
/* Process CDC specific control requests */ /* Process CDC specific control requests */
switch (USB_ControlRequest.bRequest) switch (USB_ControlRequest.bRequest)

@ -175,9 +175,9 @@
void SetupHardware(void); void SetupHardware(void);
void CDC_Task(void); void CDC_Task(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
#endif #endif

@ -97,7 +97,7 @@ void SetupHardware(void)
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and /** 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. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
/* Indicate USB enumerating */ /* Indicate USB enumerating */
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -106,7 +106,7 @@ void EVENT_USB_Connect(void)
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via /** 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. * the status LEDs and stops the USB management and CDC management tasks.
*/ */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
/* Indicate USB not ready */ /* Indicate USB not ready */
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -115,7 +115,7 @@ void EVENT_USB_Disconnect(void)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration /** 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. * of the USB device after enumeration - the device endpoints are configured and the CDC management tasks are started.
*/ */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
/* Indicate USB connected and ready */ /* Indicate USB connected and ready */
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -163,13 +163,17 @@ void EVENT_USB_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/* Reset line encoding baud rates so that the host knows to send new values */
LineEncoding1.BaudRateBPS = 0;
LineEncoding2.BaudRateBPS = 0;
} }
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific /** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
* control requests that are not handled internally by the USB library (including the CDC control commands, * 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. * which are all issued via the control endpoint), so that they can be handled appropriately for the application.
*/ */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
/* Determine which interface's Line Coding data is being set from the wIndex parameter */ /* Determine which interface's Line Coding data is being set from the wIndex parameter */
uint8_t* LineEncodingData = (USB_ControlRequest.wIndex == 0) ? (uint8_t*)&LineEncoding1 : (uint8_t*)&LineEncoding2; uint8_t* LineEncodingData = (USB_ControlRequest.wIndex == 0) ? (uint8_t*)&LineEncoding1 : (uint8_t*)&LineEncoding2;

@ -111,9 +111,9 @@
void CDC2_Task(void); void CDC2_Task(void);
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
#endif #endif

@ -74,7 +74,7 @@ void SetupHardware(void)
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and /** 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. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
/* Indicate USB enumerating */ /* Indicate USB enumerating */
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -83,7 +83,7 @@ void EVENT_USB_Connect(void)
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via /** 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. * the status LEDs and stops the USB management task.
*/ */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
/* Indicate USB not ready */ /* Indicate USB not ready */
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -92,7 +92,7 @@ void EVENT_USB_Disconnect(void)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration /** 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. * of the USB device after enumeration, and configures the generic HID device endpoints.
*/ */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
/* Indicate USB connected and ready */ /* Indicate USB connected and ready */
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -114,11 +114,11 @@ void EVENT_USB_ConfigurationChanged(void)
} }
} }
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific /** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
* control requests that are not handled internally by the USB library (including the HID commands, which are * 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. * all issued via the control endpoint), so that they can be handled appropriately for the application.
*/ */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
/* Handle HID Class specific requests */ /* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest) switch (USB_ControlRequest.bRequest)

@ -73,10 +73,10 @@
void SetupHardware(void); void SetupHardware(void);
void HID_Task(void); void HID_Task(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
void ProcessGenericHIDReport(uint8_t* DataArray); void ProcessGenericHIDReport(uint8_t* DataArray);
void CreateGenericHIDReport(uint8_t* DataArray); void CreateGenericHIDReport(uint8_t* DataArray);

@ -72,7 +72,7 @@ void SetupHardware(void)
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and /** 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. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
/* Indicate USB enumerating */ /* Indicate USB enumerating */
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -81,7 +81,7 @@ void EVENT_USB_Connect(void)
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via /** 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. * the status LEDs and stops the USB management and joystick reporting tasks.
*/ */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
/* Indicate USB not ready */ /* Indicate USB not ready */
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -90,7 +90,7 @@ void EVENT_USB_Disconnect(void)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration /** 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. * of the USB device after enumeration - the device endpoints are configured and the joystick reporting task started.
*/ */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
/* Indicate USB connected and ready */ /* Indicate USB connected and ready */
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -104,11 +104,11 @@ void EVENT_USB_ConfigurationChanged(void)
} }
} }
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific /** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
* control requests that are not handled internally by the USB library (including the HID commands, which are * 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. * all issued via the control endpoint), so that they can be handled appropriately for the application.
*/ */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
/* Handle HID Class specific requests */ /* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest) switch (USB_ControlRequest.bRequest)

@ -81,10 +81,10 @@
void SetupHardware(void); void SetupHardware(void);
void HID_Task(void); void HID_Task(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
bool GetNextReport(USB_JoystickReport_Data_t* ReportData); bool GetNextReport(USB_JoystickReport_Data_t* ReportData);

@ -96,7 +96,7 @@ void SetupHardware(void)
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and /** 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. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
/* Indicate USB enumerating */ /* Indicate USB enumerating */
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -108,7 +108,7 @@ void EVENT_USB_Connect(void)
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via /** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via
* the status LEDs. * the status LEDs.
*/ */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
/* Indicate USB not ready */ /* Indicate USB not ready */
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -117,7 +117,7 @@ void EVENT_USB_Disconnect(void)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration /** 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. * of the USB device after enumeration, and configures the keyboard device endpoints.
*/ */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
/* Indicate USB connected and ready */ /* Indicate USB connected and ready */
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -139,11 +139,11 @@ void EVENT_USB_ConfigurationChanged(void)
} }
} }
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific /** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
* control requests that are not handled internally by the USB library (including the HID commands, which are * 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. * all issued via the control endpoint), so that they can be handled appropriately for the application.
*/ */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
/* Handle HID Class specific requests */ /* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest) switch (USB_ControlRequest.bRequest)

@ -101,10 +101,10 @@
void SetupHardware(void); void SetupHardware(void);
void HID_Task(void); void HID_Task(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
void CreateKeyboardReport(USB_KeyboardReport_Data_t* ReportData); void CreateKeyboardReport(USB_KeyboardReport_Data_t* ReportData);
void ProcessLEDReport(uint8_t LEDReport); void ProcessLEDReport(uint8_t LEDReport);

@ -80,7 +80,7 @@ void SetupHardware(void)
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and /** 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. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
/* Indicate USB enumerating */ /* Indicate USB enumerating */
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -89,7 +89,7 @@ void EVENT_USB_Connect(void)
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via /** 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. * the status LEDs and stops the USB management task.
*/ */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
/* Indicate USB not ready */ /* Indicate USB not ready */
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -98,7 +98,7 @@ void EVENT_USB_Disconnect(void)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration /** 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. * of the USB device after enumeration, and configures the keyboard and mouse device endpoints.
*/ */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
/* Indicate USB connected and ready */ /* Indicate USB connected and ready */
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -132,7 +132,7 @@ void EVENT_USB_ConfigurationChanged(void)
* control requests that are not handled internally by the USB library (including the HID commands, which are * 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. * all issued via the control endpoint), so that they can be handled appropriately for the application.
*/ */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
uint8_t* ReportData; uint8_t* ReportData;
uint8_t ReportSize; uint8_t ReportSize;

@ -98,9 +98,9 @@
void Keyboard_HID_Task(void); void Keyboard_HID_Task(void);
void Mouse_HID_Task(void); void Mouse_HID_Task(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
#endif #endif

@ -70,7 +70,7 @@ void SetupHardware(void)
} }
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs. */ /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs. */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
/* Indicate USB enumerating */ /* Indicate USB enumerating */
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -79,7 +79,7 @@ void EVENT_USB_Connect(void)
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via /** 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. * the status LEDs, disables the sample update and PWM output timers and stops the USB and MIDI management tasks.
*/ */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
/* Indicate USB not ready */ /* Indicate USB not ready */
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -88,7 +88,7 @@ void EVENT_USB_Disconnect(void)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration /** 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. * of the USB device after enumeration - the device endpoints are configured and the MIDI management task started.
*/ */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
/* Indicate USB connected and ready */ /* Indicate USB connected and ready */
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);

@ -95,8 +95,8 @@
void SetupHardware(void); void SetupHardware(void);
void MIDI_Task(void); void MIDI_Task(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
#endif #endif

@ -83,7 +83,7 @@ void SetupHardware(void)
} }
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs. */ /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs. */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
/* Indicate USB enumerating */ /* Indicate USB enumerating */
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -95,7 +95,7 @@ void EVENT_USB_Connect(void)
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via /** 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. * the status LEDs and stops the Mass Storage management task.
*/ */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
/* Indicate USB not ready */ /* Indicate USB not ready */
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -104,7 +104,7 @@ void EVENT_USB_Disconnect(void)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration /** 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. * of the USB device after enumeration - the device endpoints are configured and the Mass Storage management task started.
*/ */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
/* Indicate USB connected and ready */ /* Indicate USB connected and ready */
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -129,7 +129,7 @@ void EVENT_USB_ConfigurationChanged(void)
* control requests that are not handled internally by the USB library (including the Mass Storage class-specific * 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. * requests) so that they can be handled appropriately for the application.
*/ */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
/* Process UFI specific control requests */ /* Process UFI specific control requests */
switch (USB_ControlRequest.bRequest) switch (USB_ControlRequest.bRequest)

@ -136,10 +136,10 @@
void SetupHardware(void); void SetupHardware(void);
void MassStorage_Task(void); void MassStorage_Task(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
#if defined(INCLUDE_FROM_MASSSTORAGE_C) #if defined(INCLUDE_FROM_MASSSTORAGE_C)
static bool ReadInCommandBlock(void); static bool ReadInCommandBlock(void);

@ -96,7 +96,7 @@ void SetupHardware(void)
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and /** 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. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
/* Indicate USB enumerating */ /* Indicate USB enumerating */
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -108,7 +108,7 @@ void EVENT_USB_Connect(void)
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via /** 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. * the status LEDs and stops the USB management and Mouse reporting tasks.
*/ */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
/* Indicate USB not ready */ /* Indicate USB not ready */
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -117,7 +117,7 @@ void EVENT_USB_Disconnect(void)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration /** 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. * of the USB device after enumeration - the device endpoints are configured and the mouse reporting task started.
*/ */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
/* Indicate USB connected and ready */ /* Indicate USB connected and ready */
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -131,11 +131,11 @@ void EVENT_USB_ConfigurationChanged(void)
} }
} }
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific /** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
* control requests that are not handled internally by the USB library (including the HID commands, which are * 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. * all issued via the control endpoint), so that they can be handled appropriately for the application.
*/ */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
/* Handle HID Class specific requests */ /* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest) switch (USB_ControlRequest.bRequest)

@ -101,10 +101,10 @@
void SetupHardware(void); void SetupHardware(void);
void Mouse_Task(void); void Mouse_Task(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
void CreateMouseReport(USB_MouseReport_Data_t* ReportData); void CreateMouseReport(USB_MouseReport_Data_t* ReportData);

@ -79,7 +79,7 @@ void SetupHardware(void)
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and /** 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. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
/* Indicate USB enumerating */ /* Indicate USB enumerating */
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -88,7 +88,7 @@ void EVENT_USB_Connect(void)
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via /** 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. * the status LEDs and stops all the relevant tasks.
*/ */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
/* Indicate USB not ready */ /* Indicate USB not ready */
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -97,7 +97,7 @@ void EVENT_USB_Disconnect(void)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration /** 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. * of the USB device after enumeration, and configures the RNDIS device endpoints and starts the relevant tasks.
*/ */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
/* Indicate USB connected and ready */ /* Indicate USB connected and ready */
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -125,11 +125,11 @@ void EVENT_USB_ConfigurationChanged(void)
} }
} }
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific /** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
* control requests that are not handled internally by the USB library (including the RNDIS control commands, * 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. * which set up the USB RNDIS network adapter), so that they can be handled appropriately for the application.
*/ */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
/* Process RNDIS class commands */ /* Process RNDIS class commands */
switch (USB_ControlRequest.bRequest) switch (USB_ControlRequest.bRequest)

@ -94,9 +94,9 @@
void RNDIS_Task(void); void RNDIS_Task(void);
void Ethernet_Task(void); void Ethernet_Task(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
#endif #endif

@ -89,7 +89,7 @@ void SetupHardware(void)
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and /** 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. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
/* Indicate USB enumerating */ /* Indicate USB enumerating */
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -98,7 +98,7 @@ void EVENT_USB_Connect(void)
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via /** 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. * the status LEDs and stops the USB management and CDC management tasks.
*/ */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
/* Reset Tx and Rx buffers, device disconnected */ /* Reset Tx and Rx buffers, device disconnected */
Buffer_Initialize(&Rx_Buffer); Buffer_Initialize(&Rx_Buffer);
@ -111,7 +111,7 @@ void EVENT_USB_Disconnect(void)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration /** 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. * of the USB device after enumeration - the device endpoints are configured and the CDC management task started.
*/ */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
/* Indicate USB connected and ready */ /* Indicate USB connected and ready */
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
@ -137,13 +137,16 @@ void EVENT_USB_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/* Reset line encoding baud rate so that the host knows to send new values */
LineEncoding.BaudRateBPS = 0;
} }
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific /** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
* control requests that are not handled internally by the USB library (including the CDC control commands, * 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. * which are all issued via the control endpoint), so that they can be handled appropriately for the application.
*/ */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
/* Process CDC specific control requests */ /* Process CDC specific control requests */
switch (USB_ControlRequest.bRequest) switch (USB_ControlRequest.bRequest)

@ -178,9 +178,9 @@
void CDC_Task(void); void CDC_Task(void);
void ReconfigureUSART(void); void ReconfigureUSART(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
#endif #endif

@ -130,7 +130,7 @@ void SetupHardware(void)
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_DeviceAttached(void) void EVENT_USB_Host_DeviceAttached(void)
{ {
puts_P(PSTR("Device Attached.\r\n")); puts_P(PSTR("Device Attached.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -139,7 +139,7 @@ void EVENT_USB_DeviceAttached(void)
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process. * stops the library USB task management process.
*/ */
void EVENT_USB_DeviceUnattached(void) void EVENT_USB_Host_DeviceUnattached(void)
{ {
puts_P(PSTR("\r\nDevice Unattached.\r\n")); puts_P(PSTR("\r\nDevice Unattached.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -148,13 +148,13 @@ void EVENT_USB_DeviceUnattached(void)
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application. * enumerated by the host and is now ready to be used by the application.
*/ */
void EVENT_USB_DeviceEnumerationComplete(void) void EVENT_USB_Host_DeviceEnumerationComplete(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
} }
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
void EVENT_USB_HostError(const uint8_t ErrorCode) void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
{ {
USB_ShutDown(); USB_ShutDown();
@ -168,7 +168,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode)
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{ {
puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);

@ -66,10 +66,10 @@
/* Function Prototypes: */ /* Function Prototypes: */
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_HostError(const uint8_t ErrorCode); void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_DeviceAttached(void); void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_DeviceUnattached(void); void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
void EVENT_USB_DeviceEnumerationComplete(void); void EVENT_USB_Host_DeviceEnumerationComplete(void);
#endif #endif

@ -132,7 +132,7 @@ void SetupHardware(void)
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_DeviceAttached(void) void EVENT_USB_Host_DeviceAttached(void)
{ {
puts_P(PSTR("Device Attached.\r\n")); puts_P(PSTR("Device Attached.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -141,7 +141,7 @@ void EVENT_USB_DeviceAttached(void)
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process. * stops the library USB task management process.
*/ */
void EVENT_USB_DeviceUnattached(void) void EVENT_USB_Host_DeviceUnattached(void)
{ {
puts_P(PSTR("\r\nDevice Unattached.\r\n")); puts_P(PSTR("\r\nDevice Unattached.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -150,13 +150,13 @@ void EVENT_USB_DeviceUnattached(void)
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application. * enumerated by the host and is now ready to be used by the application.
*/ */
void EVENT_USB_DeviceEnumerationComplete(void) void EVENT_USB_Host_DeviceEnumerationComplete(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
} }
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
void EVENT_USB_HostError(const uint8_t ErrorCode) void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
{ {
USB_ShutDown(); USB_ShutDown();
@ -170,7 +170,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode)
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{ {
puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);

@ -66,10 +66,10 @@
/* Function Prototypes: */ /* Function Prototypes: */
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_HostError(const uint8_t ErrorCode); void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_DeviceAttached(void); void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_DeviceUnattached(void); void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
void EVENT_USB_DeviceEnumerationComplete(void); void EVENT_USB_Host_DeviceEnumerationComplete(void);
#endif #endif

@ -75,26 +75,26 @@ void SetupHardware(void)
USB_Init(); USB_Init();
} }
void EVENT_USB_DeviceAttached(void) void EVENT_USB_Host_DeviceAttached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
} }
void EVENT_USB_DeviceUnattached(void) void EVENT_USB_Host_DeviceUnattached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} }
void EVENT_USB_DeviceEnumerationComplete(void) void EVENT_USB_Host_DeviceEnumerationComplete(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
} }
void EVENT_USB_HostError(uint8_t ErrorCode) void EVENT_USB_Host_HostError(uint8_t ErrorCode)
{ {
USB_ShutDown(); USB_ShutDown();
@ -105,7 +105,7 @@ void EVENT_USB_HostError(uint8_t ErrorCode)
for(;;); for(;;);
} }
void EVENT_USB_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode) void EVENT_USB_Host_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode)
{ {
puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);
@ -158,9 +158,6 @@ void Bluetooth_Management_Task(void)
break; break;
} }
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
puts_P(PSTR("Getting Config Data.\r\n")); puts_P(PSTR("Getting Config Data.\r\n"));
/* Get and process the configuration descriptor data */ /* Get and process the configuration descriptor data */
@ -183,7 +180,7 @@ void Bluetooth_Management_Task(void)
puts_P(PSTR("Bluetooth Dongle Enumerated.\r\n")); puts_P(PSTR("Bluetooth Dongle Enumerated.\r\n"));
USB_HostState = HOST_STATE_Ready; USB_HostState = HOST_STATE_Configured;
break; break;
} }
} }

@ -70,11 +70,11 @@
void Bluetooth_Management_Task(void); void Bluetooth_Management_Task(void);
/* Event Handlers: */ /* Event Handlers: */
void EVENT_USB_DeviceAttached(void); void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_DeviceUnattached(void); void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_DeviceEnumerationComplete(void); void EVENT_USB_Host_DeviceEnumerationComplete(void);
void EVENT_USB_HostError(uint8_t ErrorCode); void EVENT_USB_Host_HostError(uint8_t ErrorCode);
void EVENT_USB_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode); void EVENT_USB_Host_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode);
/* Function Prototypes: */ /* Function Prototypes: */
void SetupHardware(void); void SetupHardware(void);

@ -398,7 +398,7 @@ void Bluetooth_ProcessHCICommands(void)
{ {
while (!(Bluetooth_GetNextHCIEventHeader())) while (!(Bluetooth_GetNextHCIEventHeader()))
{ {
if (USB_DeviceState == DEVICE_STATE_Unattached) if (USB_HostState == HOST_STATE_Unattached)
return; return;
} }

@ -73,7 +73,7 @@ void SetupHardware(void)
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_DeviceAttached(void) void EVENT_USB_Host_DeviceAttached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -82,7 +82,7 @@ void EVENT_USB_DeviceAttached(void)
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process. * stops the library USB task management process.
*/ */
void EVENT_USB_DeviceUnattached(void) void EVENT_USB_Host_DeviceUnattached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -91,13 +91,13 @@ void EVENT_USB_DeviceUnattached(void)
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application. * enumerated by the host and is now ready to be used by the application.
*/ */
void EVENT_USB_DeviceEnumerationComplete(void) void EVENT_USB_Host_DeviceEnumerationComplete(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
} }
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
void EVENT_USB_HostError(const uint8_t ErrorCode) void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
{ {
USB_ShutDown(); USB_ShutDown();
@ -111,7 +111,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode)
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{ {
puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);

@ -117,10 +117,10 @@
void SetupHardware(void); void SetupHardware(void);
void CDC_Host_Task(void); void CDC_Host_Task(void);
void EVENT_USB_HostError(const uint8_t ErrorCode); void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_DeviceAttached(void); void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_DeviceUnattached(void); void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
void EVENT_USB_DeviceEnumerationComplete(void); void EVENT_USB_Host_DeviceEnumerationComplete(void);
#endif #endif

@ -73,7 +73,7 @@ void SetupHardware(void)
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_DeviceAttached(void) void EVENT_USB_Host_DeviceAttached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -82,7 +82,7 @@ void EVENT_USB_DeviceAttached(void)
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process. * stops the library USB task management process.
*/ */
void EVENT_USB_DeviceUnattached(void) void EVENT_USB_Host_DeviceUnattached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "Device Unattached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "Device Unattached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -91,13 +91,13 @@ void EVENT_USB_DeviceUnattached(void)
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application. * enumerated by the host and is now ready to be used by the application.
*/ */
void EVENT_USB_DeviceEnumerationComplete(void) void EVENT_USB_Host_DeviceEnumerationComplete(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
} }
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
void EVENT_USB_HostError(const uint8_t ErrorCode) void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
{ {
USB_ShutDown(); USB_ShutDown();
@ -111,7 +111,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode)
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{ {
puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);

@ -84,11 +84,11 @@
void SetupHardware(void); void SetupHardware(void);
void HID_Host_Task(void); void HID_Host_Task(void);
void EVENT_USB_HostError(const uint8_t ErrorCode); void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_DeviceAttached(void); void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_DeviceUnattached(void); void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
void EVENT_USB_DeviceEnumerationComplete(void); void EVENT_USB_Host_DeviceEnumerationComplete(void);
void ReadNextReport(void); void ReadNextReport(void);
void WriteNextReport(uint8_t* ReportOUTData, uint8_t ReportIndex, uint8_t ReportType, uint16_t ReportLength); void WriteNextReport(uint8_t* ReportOUTData, uint8_t ReportIndex, uint8_t ReportType, uint16_t ReportLength);

@ -73,7 +73,7 @@ void SetupHardware(void)
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_DeviceAttached(void) void EVENT_USB_Host_DeviceAttached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -82,7 +82,7 @@ void EVENT_USB_DeviceAttached(void)
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process. * stops the library USB task management process.
*/ */
void EVENT_USB_DeviceUnattached(void) void EVENT_USB_Host_DeviceUnattached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "Device Unattached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "Device Unattached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -91,13 +91,13 @@ void EVENT_USB_DeviceUnattached(void)
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application. * enumerated by the host and is now ready to be used by the application.
*/ */
void EVENT_USB_DeviceEnumerationComplete(void) void EVENT_USB_Host_DeviceEnumerationComplete(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
} }
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
void EVENT_USB_HostError(const uint8_t ErrorCode) void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
{ {
USB_ShutDown(); USB_ShutDown();
@ -111,7 +111,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode)
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{ {
puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);

@ -84,11 +84,11 @@
void Keyboard_HID_Task(void); void Keyboard_HID_Task(void);
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_HostError(const uint8_t ErrorCode); void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_DeviceAttached(void); void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_DeviceUnattached(void); void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
void EVENT_USB_DeviceEnumerationComplete(void); void EVENT_USB_Host_DeviceEnumerationComplete(void);
void ReadNextReport(void); void ReadNextReport(void);

@ -73,7 +73,7 @@ void SetupHardware(void)
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_DeviceAttached(void) void EVENT_USB_Host_DeviceAttached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -82,7 +82,7 @@ void EVENT_USB_DeviceAttached(void)
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process. * stops the library USB task management process.
*/ */
void EVENT_USB_DeviceUnattached(void) void EVENT_USB_Host_DeviceUnattached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -91,13 +91,13 @@ void EVENT_USB_DeviceUnattached(void)
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application. * enumerated by the host and is now ready to be used by the application.
*/ */
void EVENT_USB_DeviceEnumerationComplete(void) void EVENT_USB_Host_DeviceEnumerationComplete(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
} }
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
void EVENT_USB_HostError(const uint8_t ErrorCode) void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
{ {
USB_ShutDown(); USB_ShutDown();
@ -111,7 +111,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode)
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{ {
puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);

@ -67,11 +67,11 @@
void Keyboard_HID_Task(void); void Keyboard_HID_Task(void);
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_HostError(const uint8_t ErrorCode); void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_DeviceAttached(void); void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_DeviceUnattached(void); void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
void EVENT_USB_DeviceEnumerationComplete(void); void EVENT_USB_Host_DeviceEnumerationComplete(void);
void ProcessKeyboardReport(uint8_t* KeyboardReport); void ProcessKeyboardReport(uint8_t* KeyboardReport);

@ -79,7 +79,7 @@ void SetupHardware(void)
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_DeviceAttached(void) void EVENT_USB_Host_DeviceAttached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -88,7 +88,7 @@ void EVENT_USB_DeviceAttached(void)
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process. * stops the library USB task management process.
*/ */
void EVENT_USB_DeviceUnattached(void) void EVENT_USB_Host_DeviceUnattached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -97,7 +97,7 @@ void EVENT_USB_DeviceUnattached(void)
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application. * enumerated by the host and is now ready to be used by the application.
*/ */
void EVENT_USB_DeviceEnumerationComplete(void) void EVENT_USB_Host_DeviceEnumerationComplete(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
} }
@ -117,7 +117,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode)
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{ {
puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);

@ -76,11 +76,11 @@
void MassStorage_Task(void); void MassStorage_Task(void);
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_HostError(const uint8_t ErrorCode); void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_DeviceAttached(void); void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_DeviceUnattached(void); void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
void EVENT_USB_DeviceEnumerationComplete(void); void EVENT_USB_Host_DeviceEnumerationComplete(void);
void ShowDiskReadError(char* CommandString, bool FailedAtSCSILayer, uint8_t ErrorCode); void ShowDiskReadError(char* CommandString, bool FailedAtSCSILayer, uint8_t ErrorCode);

@ -73,7 +73,7 @@ void SetupHardware(void)
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_DeviceAttached(void) void EVENT_USB_Host_DeviceAttached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -82,7 +82,7 @@ void EVENT_USB_DeviceAttached(void)
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process. * stops the library USB task management process.
*/ */
void EVENT_USB_DeviceUnattached(void) void EVENT_USB_Host_DeviceUnattached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "Device Unattached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "Device Unattached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -91,13 +91,13 @@ void EVENT_USB_DeviceUnattached(void)
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application. * enumerated by the host and is now ready to be used by the application.
*/ */
void EVENT_USB_DeviceEnumerationComplete(void) void EVENT_USB_Host_DeviceEnumerationComplete(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
} }
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
void EVENT_USB_HostError(const uint8_t ErrorCode) void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
{ {
USB_ShutDown(); USB_ShutDown();
@ -111,7 +111,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode)
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{ {
puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);

@ -84,11 +84,11 @@
void Mouse_HID_Task(void); void Mouse_HID_Task(void);
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_HostError(const uint8_t ErrorCode); void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_DeviceAttached(void); void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_DeviceUnattached(void); void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
void EVENT_USB_DeviceEnumerationComplete(void); void EVENT_USB_Host_DeviceEnumerationComplete(void);
void ReadNextReport(void); void ReadNextReport(void);

@ -73,7 +73,7 @@ void SetupHardware(void)
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_DeviceAttached(void) void EVENT_USB_Host_DeviceAttached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -82,7 +82,7 @@ void EVENT_USB_DeviceAttached(void)
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process. * stops the library USB task management process.
*/ */
void EVENT_USB_DeviceUnattached(void) void EVENT_USB_Host_DeviceUnattached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "Device Unattached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "Device Unattached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -91,13 +91,13 @@ void EVENT_USB_DeviceUnattached(void)
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application. * enumerated by the host and is now ready to be used by the application.
*/ */
void EVENT_USB_DeviceEnumerationComplete(void) void EVENT_USB_Host_DeviceEnumerationComplete(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
} }
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
void EVENT_USB_HostError(const uint8_t ErrorCode) void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
{ {
USB_ShutDown(); USB_ShutDown();
@ -111,7 +111,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode)
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{ {
puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);

@ -67,11 +67,11 @@
void Mouse_HID_Task(void); void Mouse_HID_Task(void);
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_HostError(const uint8_t ErrorCode); void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_DeviceAttached(void); void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_DeviceUnattached(void); void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
void EVENT_USB_DeviceEnumerationComplete(void); void EVENT_USB_Host_DeviceEnumerationComplete(void);
void ProcessMouseReport(uint8_t* MouseReport); void ProcessMouseReport(uint8_t* MouseReport);

@ -73,7 +73,7 @@ void SetupHardware(void)
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_DeviceAttached(void) void EVENT_USB_Host_DeviceAttached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -82,7 +82,7 @@ void EVENT_USB_DeviceAttached(void)
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process. * stops the library USB task management process.
*/ */
void EVENT_USB_DeviceUnattached(void) void EVENT_USB_Host_DeviceUnattached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -91,13 +91,13 @@ void EVENT_USB_DeviceUnattached(void)
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application. * enumerated by the host and is now ready to be used by the application.
*/ */
void EVENT_USB_DeviceEnumerationComplete(void) void EVENT_USB_Host_DeviceEnumerationComplete(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
} }
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
void EVENT_USB_HostError(uint8_t ErrorCode) void EVENT_USB_Host_HostError(uint8_t ErrorCode)
{ {
USB_ShutDown(); USB_ShutDown();
@ -111,7 +111,7 @@ void EVENT_USB_HostError(uint8_t ErrorCode)
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
void EVENT_USB_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode) void EVENT_USB_Host_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode)
{ {
puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);

@ -70,11 +70,11 @@
#define LEDMASK_USB_BUSY (LEDS_LED2) #define LEDMASK_USB_BUSY (LEDS_LED2)
/* Function Prototypes: */ /* Function Prototypes: */
void EVENT_USB_DeviceAttached(void); void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_DeviceUnattached(void); void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_DeviceEnumerationComplete(void); void EVENT_USB_Host_DeviceEnumerationComplete(void);
void EVENT_USB_HostError(uint8_t ErrorCode); void EVENT_USB_Host_HostError(uint8_t ErrorCode);
void EVENT_USB_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode); void EVENT_USB_Host_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode);
void SetupHardware(void); void SetupHardware(void);

@ -74,7 +74,7 @@ void SetupHardware(void)
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_DeviceAttached(void) void EVENT_USB_Host_DeviceAttached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@ -83,7 +83,7 @@ void EVENT_USB_DeviceAttached(void)
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process. * stops the library USB task management process.
*/ */
void EVENT_USB_DeviceUnattached(void) void EVENT_USB_Host_DeviceUnattached(void)
{ {
puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
@ -92,13 +92,13 @@ void EVENT_USB_DeviceUnattached(void)
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application. * enumerated by the host and is now ready to be used by the application.
*/ */
void EVENT_USB_DeviceEnumerationComplete(void) void EVENT_USB_Host_DeviceEnumerationComplete(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
} }
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
void EVENT_USB_HostError(const uint8_t ErrorCode) void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
{ {
USB_ShutDown(); USB_ShutDown();
@ -112,7 +112,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode)
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{ {
puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);

@ -72,11 +72,11 @@
void StillImage_Task(void); void StillImage_Task(void);
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_HostError(const uint8_t ErrorCode); void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_DeviceAttached(void); void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_DeviceUnattached(void); void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
void EVENT_USB_DeviceEnumerationComplete(void); void EVENT_USB_Host_DeviceEnumerationComplete(void);
void UnicodeToASCII(uint8_t* restrict UnicodeString, char* restrict Buffer); void UnicodeToASCII(uint8_t* restrict UnicodeString, char* restrict Buffer);
void ShowCommandError(uint8_t ErrorCode, bool ResponseCodeError); void ShowCommandError(uint8_t ErrorCode, bool ResponseCodeError);

@ -54,71 +54,17 @@ static void Abort_Program(void)
for (;;); for (;;);
} }
/** Event handler for the USB_VBUSChange event. When fired, the event is logged to the USART. */
void EVENT_USB_VBUSChange(void)
{
puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "VBUS Change\r\n" ESC_FG_WHITE));
}
/** Event handler for the USB_VBUSConnect event. When fired, the event is logged to the USART. */
void EVENT_USB_VBUSConnect(void)
{
puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "VBUS +\r\n" ESC_FG_WHITE));
}
/** Event handler for the USB_VBUSDisconnect event. When fired, the event is logged to the USART. */
void EVENT_USB_VBUSDisconnect(void)
{
puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "VBUS -\r\n" ESC_FG_WHITE));
}
/**
* Event handler for the USB_Connect event. When fired, the event is logged to the USART and the
* USB task started.
*/
void EVENT_USB_Connect(void)
{
puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "USB +\r\n" ESC_FG_WHITE));
}
/**
* Event handler for the USB_Disconnect event. When fired, the event is logged to the USART and the
* USB task stopped.
*/
void EVENT_USB_Disconnect(void)
{
puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "USB -\r\n" ESC_FG_WHITE));
}
/** Event handler for the USB_Suspend event. When fired, the event is logged to the USART. */
void EVENT_USB_Suspend(void)
{
puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "USB Sleep\r\n" ESC_FG_WHITE));
}
/** Event handler for the USB_WakeUp event. When fired, the event is logged to the USART. */
void EVENT_USB_WakeUp(void)
{
puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "USB Wakeup\r\n" ESC_FG_WHITE));
}
/** Event handler for the USB_Reset event. When fired, the event is logged to the USART. */
void EVENT_USB_Reset(void)
{
puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "USB Reset\r\n" ESC_FG_WHITE));
}
/** Event handler for the USB_UIDChange event. When fired, the event is logged to the USART. */ /** Event handler for the USB_UIDChange event. When fired, the event is logged to the USART. */
void EVENT_USB_UIDChange(void) void EVENT_USB_UIDChange(void)
{ {
char* ModeStrPtr; char* ModeStrPtr;
puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "UID Change\r\n")); puts_P(PSTR(ESC_FG_RED EVENT_PREFIX "UID Change\r\n"));
if (USB_CurrentMode == USB_MODE_DEVICE) if (USB_CurrentMode == USB_MODE_DEVICE)
ModeStrPtr = PSTR("HOST");
else if (USB_CurrentMode == USB_MODE_HOST)
ModeStrPtr = PSTR("DEVICE"); ModeStrPtr = PSTR("DEVICE");
else if (USB_CurrentMode == USB_MODE_HOST)
ModeStrPtr = PSTR("HOST");
else else
ModeStrPtr = PSTR("N/A"); ModeStrPtr = PSTR("N/A");
@ -126,7 +72,7 @@ void EVENT_USB_UIDChange(void)
} }
/** /**
* Event handler for the USB_PowerOnFail event. When fired, the event is logged to the USART and the program * Event handler for the USB_InitFailure event. When fired, the event is logged to the USART and the program
* execution aborted. * execution aborted.
*/ */
void EVENT_USB_InitFailure(const uint8_t ErrorCode) void EVENT_USB_InitFailure(const uint8_t ErrorCode)
@ -148,29 +94,38 @@ void EVENT_USB_InitFailure(const uint8_t ErrorCode)
Abort_Program(); Abort_Program();
} }
/** /** Event handler for the USB_Device_Connect event. When fired, the event is logged to the USART. */
* Event handler for the USB_HostError event. When fired, the event is logged to the USART and the program void EVENT_USB_Device_Connect(void)
* execution aborted.
*/
void EVENT_USB_HostError(const uint8_t ErrorCode)
{ {
puts_P(PSTR(ESC_FG_RED EVENT_PREFIX "Host Mode Error\r\n")); puts_P(PSTR(ESC_FG_GREEN EVENT_PREFIX "USB Connect\r\n" ESC_FG_WHITE));
printf_P(PSTR(" -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode); }
Abort_Program(); /** Event handler for the USB_Device_Disconnect event. When fired, the event is logged to the USART. */
void EVENT_USB_Device_Disconnect(void)
{
puts_P(PSTR(ESC_FG_GREEN EVENT_PREFIX "USB Disconnect\r\n" ESC_FG_WHITE));
} }
/** Event handler for the USB_DeviceEnumerationFailed event. When fired, the event is logged to the USART. */ /** Event handler for the USB_Device_Suspend event. When fired, the event is logged to the USART. */
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) void EVENT_USB_Device_Suspend(void)
{ {
puts_P(PSTR(ESC_FG_RED EVENT_PREFIX "Dev Enum Error\r\n")); puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "USB Sleep\r\n" ESC_FG_WHITE));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); }
printf_P(PSTR(" -- Sub Error Code %d\r\n"), SubErrorCode);
printf_P(PSTR(" -- In State %d\r\n" ESC_FG_WHITE), USB_HostState); /** Event handler for the USB_Device_WakeUp event. When fired, the event is logged to the USART. */
void EVENT_USB_Device_WakeUp(void)
{
puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "USB Wakeup\r\n" ESC_FG_WHITE));
}
/** Event handler for the USB_Device_Reset event. When fired, the event is logged to the USART. */
void EVENT_USB_Device_Reset(void)
{
puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "USB Reset\r\n" ESC_FG_WHITE));
} }
/** Event handler for the USB_UnhandledControlPacket event. When fired, the event is logged to the USART. */ /** Event handler for the USB_Device_UnhandledControlRequest event. When fired, the event is logged to the USART. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "Ctrl Request\r\n")); puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "Ctrl Request\r\n"));
printf_P(PSTR(" -- Req Data %d\r\n"), USB_ControlRequest.bRequest); printf_P(PSTR(" -- Req Data %d\r\n"), USB_ControlRequest.bRequest);
@ -178,26 +133,47 @@ void EVENT_USB_UnhandledControlPacket(void)
printf_P(PSTR(" -- Req Length %d\r\n" ESC_FG_WHITE), USB_ControlRequest.wLength); printf_P(PSTR(" -- Req Length %d\r\n" ESC_FG_WHITE), USB_ControlRequest.wLength);
} }
/** Event handler for the USB_ConfigurationChanged event. When fired, the event is logged to the USART. */ /** Event handler for the USB_Device_ConfigurationChanged event. When fired, the event is logged to the USART. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "Configuration Number Changed\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "Configuration Number Changed\r\n" ESC_FG_WHITE));
} }
/** Event handler for the USB_DeviceAttached event. When fired, the event is logged to the USART. */ /**
void EVENT_USB_DeviceAttached(void) * Event handler for the USB_Host_HostError event. When fired, the event is logged to the USART and the program
* execution aborted.
*/
void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
{ {
puts_P(PSTR(ESC_FG_GREEN EVENT_PREFIX "Device +\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_RED EVENT_PREFIX "Host Mode Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode);
Abort_Program();
} }
/** Event handler for the USB_DeviceUnattached event. When fired, the event is logged to the USART. */ /** Event handler for the USB_Host_DeviceEnumerationFailed event. When fired, the event is logged to the USART. */
void EVENT_USB_DeviceUnattached(void) void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{ {
puts_P(PSTR(ESC_FG_GREEN EVENT_PREFIX "Device -\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_RED EVENT_PREFIX "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);
printf_P(PSTR(" -- Sub Error Code %d\r\n"), SubErrorCode);
printf_P(PSTR(" -- In State %d\r\n" ESC_FG_WHITE), USB_HostState);
} }
/** Event handler for the USB_DeviceEnumerationComplete event. When fired, the event is logged to the USART. */ /** Event handler for the USB_Host_DeviceEnumerationComplete event. When fired, the event is logged to the USART. */
void EVENT_USB_DeviceEnumerationComplete(void) void EVENT_USB_Host_DeviceEnumerationComplete(void)
{ {
puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "Device Enumeration Complete\r\n" ESC_FG_WHITE)); puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "Device Enumeration Complete\r\n" ESC_FG_WHITE));
} }
/** Event handler for the USB_Host_DeviceAttached event. When fired, the event is logged to the USART. */
void EVENT_USB_Host_DeviceAttached(void)
{
puts_P(PSTR(ESC_FG_GREEN EVENT_PREFIX "Device Attached\r\n" ESC_FG_WHITE));
}
/** Event handler for the USB_Host_DeviceUnattached event. When fired, the event is logged to the USART. */
void EVENT_USB_Host_DeviceUnattached(void)
{
puts_P(PSTR(ESC_FG_GREEN EVENT_PREFIX "Device Unattached\r\n" ESC_FG_WHITE));
}

@ -54,22 +54,19 @@
static void Abort_Program(void) ATTR_NO_RETURN; static void Abort_Program(void) ATTR_NO_RETURN;
#endif #endif
void EVENT_USB_VBUSChange(void);
void EVENT_USB_VBUSConnect(void);
void EVENT_USB_VBUSDisconnect(void);
void EVENT_USB_Connect(void);
void EVENT_USB_Disconnect(void);
void EVENT_USB_InitFailure(const uint8_t ErrorCode); void EVENT_USB_InitFailure(const uint8_t ErrorCode);
void EVENT_USB_UIDChange(void); void EVENT_USB_UIDChange(void);
void EVENT_USB_HostError(const uint8_t ErrorCode); void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_DeviceAttached(void); void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_DeviceUnattached(void); void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
void EVENT_USB_DeviceEnumerationComplete(void); void EVENT_USB_Host_DeviceEnumerationComplete(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Suspend(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_WakeUp(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Reset(void); void EVENT_USB_Device_Suspend(void);
void EVENT_USB_Device_WakeUp(void);
void EVENT_USB_Device_Reset(void);
#endif #endif

@ -33,7 +33,7 @@
#include "Audio.h" #include "Audio.h"
void Audio_Device_ProcessControlPacket(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)
{ {
if (!(Endpoint_IsSETUPReceived())) if (!(Endpoint_IsSETUPReceived()))
return; return;

@ -97,7 +97,7 @@
/* Function Prototypes: */ /* Function Prototypes: */
/** Configures the endpoints of a given Audio interface, ready for use. This should be linked to the library /** Configures the endpoints of a given Audio interface, ready for use. This should be linked to the library
* \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration containing the * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration containing the
* given Audio interface is selected. * given Audio interface is selected.
* *
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state.
@ -107,11 +107,11 @@
bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo); bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo);
/** Processes incomming control requests from the host, that are directed to the given Audio class interface. This should be /** Processes incomming control requests from the host, that are directed to the given Audio class interface. This should be
* linked to the library \ref EVENT_USB_UnhandledControlPacket() event. * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
* *
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state.
*/ */
void Audio_Device_ProcessControlPacket(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo); void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo);
/** General management task for a given Audio class interface, required for the correct operation of the interface. This should /** General management task for a given Audio class interface, required for the correct operation of the interface. This should
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().

@ -39,7 +39,7 @@ void CDC_Device_Event_Stub(void)
} }
void CDC_Device_ProcessControlPacket(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo) void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo)
{ {
if (!(Endpoint_IsSETUPReceived())) if (!(Endpoint_IsSETUPReceived()))
return; return;

@ -108,8 +108,8 @@
/* Function Prototypes: */ /* Function Prototypes: */
/** Configures the endpoints of a given CDC interface, ready for use. This should be linked to the library /** Configures the endpoints of a given CDC interface, ready for use. This should be linked to the library
* \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration containing the * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration containing
* given CDC interface is selected. * the given CDC interface is selected.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
* *
@ -118,11 +118,11 @@
bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
/** Processes incomming control requests from the host, that are directed to the given CDC class interface. This should be /** Processes incomming control requests from the host, that are directed to the given CDC class interface. This should be
* linked to the library \ref EVENT_USB_UnhandledControlPacket() event. * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
* *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
*/ */
void CDC_Device_ProcessControlPacket(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
/** General management task for a given CDC class interface, required for the correct operation of the interface. This should /** General management task for a given CDC class interface, required for the correct operation of the interface. This should
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().

@ -33,7 +33,7 @@
#include "HID.h" #include "HID.h"
void HID_Device_ProcessControlPacket(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
{ {
if (!(Endpoint_IsSETUPReceived())) if (!(Endpoint_IsSETUPReceived()))
return; return;

@ -95,7 +95,7 @@
/* Function Prototypes: */ /* Function Prototypes: */
/** Configures the endpoints of a given HID interface, ready for use. This should be linked to the library /** Configures the endpoints of a given HID interface, ready for use. This should be linked to the library
* \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration
* containing the given HID interface is selected. * containing the given HID interface is selected.
* *
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state. * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.
@ -105,11 +105,11 @@
bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo); bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo);
/** Processes incomming control requests from the host, that are directed to the given HID class interface. This should be /** Processes incomming control requests from the host, that are directed to the given HID class interface. This should be
* linked to the library \ref EVENT_USB_UnhandledControlPacket() event. * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
* *
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state. * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.
*/ */
void HID_Device_ProcessControlPacket(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo); void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo);
/** General management task for a given HID class interface, required for the correct operation of the interface. This should /** General management task for a given HID class interface, required for the correct operation of the interface. This should
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().

@ -33,7 +33,7 @@
#include "MIDI.h" #include "MIDI.h"
void MIDI_Device_ProcessControlPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)
{ {
} }

@ -86,7 +86,7 @@
/* Function Prototypes: */ /* Function Prototypes: */
/** Configures the endpoints of a given MIDI interface, ready for use. This should be linked to the library /** Configures the endpoints of a given MIDI interface, ready for use. This should be linked to the library
* \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration
* containing the given MIDI interface is selected. * containing the given MIDI interface is selected.
* *
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state.
@ -96,11 +96,11 @@
bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo); bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo);
/** Processes incomming control requests from the host, that are directed to the given MIDI class interface. This should be /** Processes incomming control requests from the host, that are directed to the given MIDI class interface. This should be
* linked to the library \ref EVENT_USB_UnhandledControlPacket() event. * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
* *
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state.
*/ */
void MIDI_Device_ProcessControlPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo); void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo);
/** General management task for a given MIDI class interface, required for the correct operation of the interface. This should /** General management task for a given MIDI class interface, required for the correct operation of the interface. This should
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().

@ -36,7 +36,7 @@
static USB_ClassInfo_MS_Device_t* CallbackMSInterfaceInfo; static USB_ClassInfo_MS_Device_t* CallbackMSInterfaceInfo;
void MS_Device_ProcessControlPacket(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{ {
if (!(Endpoint_IsSETUPReceived())) if (!(Endpoint_IsSETUPReceived()))
return; return;

@ -95,7 +95,7 @@
/* Function Prototypes: */ /* Function Prototypes: */
/** Configures the endpoints of a given Mass Storage interface, ready for use. This should be linked to the library /** Configures the endpoints of a given Mass Storage interface, ready for use. This should be linked to the library
* \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration
* containing the given Mass Storage interface is selected. * containing the given Mass Storage interface is selected.
* *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state. * \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state.
@ -105,11 +105,11 @@
bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo); bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
/** Processes incomming control requests from the host, that are directed to the given Mass Storage class interface. This should be /** Processes incomming control requests from the host, that are directed to the given Mass Storage class interface. This should be
* linked to the library \ref EVENT_USB_UnhandledControlPacket() event. * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
* *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state. * \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state.
*/ */
void MS_Device_ProcessControlPacket(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo); void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
/** General management task for a given Mass Storage class interface, required for the correct operation of the interface. This should /** General management task for a given Mass Storage class interface, required for the correct operation of the interface. This should
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().

@ -65,7 +65,7 @@ static const uint32_t PROGMEM AdapterSupportedOIDList[] =
OID_802_3_XMIT_MORE_COLLISIONS, OID_802_3_XMIT_MORE_COLLISIONS,
}; };
void RNDIS_Device_ProcessControlPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo)
{ {
if (!(Endpoint_IsSETUPReceived())) if (!(Endpoint_IsSETUPReceived()))
return; return;

@ -103,7 +103,7 @@
/* Function Prototypes: */ /* Function Prototypes: */
/** Configures the endpoints of a given RNDIS interface, ready for use. This should be linked to the library /** Configures the endpoints of a given RNDIS interface, ready for use. This should be linked to the library
* \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration
* containing the given HID interface is selected. * containing the given HID interface is selected.
* *
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state. * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state.
@ -113,11 +113,11 @@
bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo); bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo);
/** Processes incomming control requests from the host, that are directed to the given RNDIS class interface. This should be /** Processes incomming control requests from the host, that are directed to the given RNDIS class interface. This should be
* linked to the library \ref EVENT_USB_UnhandledControlPacket() event. * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
* *
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state. * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state.
*/ */
void RNDIS_Device_ProcessControlPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo); void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo);
/** General management task for a given HID class interface, required for the correct operation of the interface. This should /** General management task for a given HID class interface, required for the correct operation of the interface. This should
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().

@ -62,67 +62,7 @@
/* Public Interface - May be used in end-application: */ /* Public Interface - May be used in end-application: */
/* Pseudo-Functions for Doxygen: */ /* Pseudo-Functions for Doxygen: */
#if !defined(INCLUDE_FROM_EVENTS_C) || defined(__DOXYGEN__) #if !defined(INCLUDE_FROM_EVENTS_C) || defined(__DOXYGEN__)
/** Event for VBUS level change. This event fires when the VBUS line of the USB AVR changes from /** Event for USB stack initialization failure. This event fires when the USB interface fails to
* high to low or vice-versa, before the new VBUS level is sampled and the appropriate action
* taken.
*
* \note This event is only available on USB AVR models which support VBUS notification interrupts.
*/
void EVENT_USB_VBUSChange(void);
/** Event for VBUS attachment. On the AVR models with a dedicated VBUS pin, this event fires when
* the VBUS line of the USB AVR changes from low to high (after the VBUS events have been handled),
* signalling the attachment of the USB device to a host, before the enumeration process has begun.
*
* \note This event is only available on USB AVR models which support VBUS notification interrupts.
*/
void EVENT_USB_VBUSConnect(void);
/** Event for VBUS attachment. On the AVR models with a dedicated VBUS pin, this event fires when
* the VBUS line of the USB AVR changes from high to low (after the VBUS events have been handled),
* signalling the detatchment of the USB device from a host, regardless of its enumeration state.
*
* \note This event is only available on USB AVR models which support VBUS notification interrupts.
*/
void EVENT_USB_VBUSDisconnect(void);
/** Event for USB device connection. This event fires when the AVR is in USB host mode and a device
* has been attached (but not yet fully enumerated), or when in device mode and the device is connected
* to a host, beginning the enumeration process.
*
* When in device mode, this can be used to programmatically start the USB management task to reduce
* CPU usage.
*
* \note For the smaller USB AVRs (AT90USBXX2) with limited USB controllers, VBUS is not available to the USB controller.
* this means that the current connection state is derived from the bus suspension and wake up events by default,
* which is not always accurate (host may suspend the bus while still connected). If the actual connection state
* needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by
* passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection
* and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually.
*
* \see USBTask.h for more information on the USB management task and reducing CPU usage.
*/
void EVENT_USB_Connect(void);
/** Event for USB device disconnection. This event fires when the AVR is in USB host mode and an
* attached and enumerated device has been disconnected, or when in device mode and the device is
* disconnected from the host.
*
* When in device mode, this can be used to programmatically stop the USB management task to reduce
* CPU usage.
*
* \note For the smaller USB AVRs (AT90USBXX2) with limited USB controllers, VBUS is not available to the USB controller.
* this means that the current connection state is derived from the bus suspension and wake up events by default,
* which is not always accurate (host may suspend the bus while still connected). If the actual connection state
* needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by
* passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection
* and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually.
*
* \see USBTask.h for more information on the USB management task and reducing CPU usage.
*/
void EVENT_USB_Disconnect(void);
/** Event for USB initialization failure. This event fires when the USB interface fails to
* initialize correctly due to a hardware or software fault. * initialize correctly due to a hardware or software fault.
* *
* \note This event only exists on USB AVR models which support dual role modes. * \note This event only exists on USB AVR models which support dual role modes.
@ -133,8 +73,8 @@
/** Event for USB mode pin level change. This event fires when the USB interface is set to dual role /** Event for USB mode pin level change. This event fires when the USB interface is set to dual role
* mode, and the UID pin level has changed to indicate a new mode (device or host). This event fires * mode, and the UID pin level has changed to indicate a new mode (device or host). This event fires
* before the mode is switched to the newly indicated mode but after the \ref EVENT_USB_Disconnect event * before the mode is switched to the newly indicated mode but after the \ref EVENT_USB_Device_Disconnect
* has fired (if connected before the role change). * event has fired (if connected before the role change).
* *
* \note This event only exists on USB AVR models which support dual role modes. * \note This event only exists on USB AVR models which support dual role modes.
* *
@ -153,12 +93,12 @@
* \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see * \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see
* \ref Group_USBManagement documentation). * \ref Group_USBManagement documentation).
*/ */
void EVENT_USB_HostError(const uint8_t ErrorCode); void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
/** Event for USB device attachment. This event fires when a the USB interface is in host mode, and /** Event for USB device attachment. This event fires when a the USB interface is in host mode, and
* a USB device has been connected to the USB interface. This is interrupt driven, thus fires before * a USB device has been connected to the USB interface. This is interrupt driven, thus fires before
* the standard \ref EVENT_USB_Connect event and so can be used to programmatically start the USB management * the standard \ref EVENT_USB_Device_Connect event and so can be used to programmatically start the USB
* task to reduce CPU consumption. * management task to reduce CPU consumption.
* *
* \note This event only exists on USB AVR models which supports host mode. * \note This event only exists on USB AVR models which supports host mode.
* *
@ -167,7 +107,7 @@
* *
* \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage. * \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage.
*/ */
void EVENT_USB_DeviceAttached(void); void EVENT_USB_Host_DeviceAttached(void);
/** Event for USB device removal. This event fires when a the USB interface is in host mode, and /** Event for USB device removal. This event fires when a the USB interface is in host mode, and
* a USB device has been removed the USB interface whether or not it has been enumerated. This * a USB device has been removed the USB interface whether or not it has been enumerated. This
@ -180,7 +120,7 @@
* *
* \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage. * \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage.
*/ */
void EVENT_USB_DeviceUnattached(void); void EVENT_USB_Host_DeviceUnattached(void);
/** Event for USB device enumeration failure. This event fires when a the USB interface is /** Event for USB device enumeration failure. This event fires when a the USB interface is
* in host mode, and an attached USB device has failed to enumerate completely. * in host mode, and an attached USB device has failed to enumerate completely.
@ -197,14 +137,41 @@
* \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see * \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see
* \ref Group_USBManagement documentation). * \ref Group_USBManagement documentation).
*/ */
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
/** Event for USB device enumeration completion. This event fires when a the USB interface is /** Event for USB device enumeration completion. This event fires when a the USB interface is
* in host mode and an attached USB device has been completely enumerated and is ready to be * in host mode and an attached USB device has been completely enumerated and is ready to be
* controlled by the user application, or when the library is in device mode, and the Host * controlled by the user application.
* has finished enumerating the device.
*/ */
void EVENT_USB_DeviceEnumerationComplete(void); void EVENT_USB_Host_DeviceEnumerationComplete(void);
/** Event for USB device connection. This event fires when the AVR in device mode and the device is connected
* to a host, beginning the enumeration process, measured by a rising level on the AVR's VBUS pin.
*
* \note For the smaller USB AVRs (AT90USBXX2) with limited USB controllers, VBUS is not available to the USB controller.
* this means that the current connection state is derived from the bus suspension and wake up events by default,
* which is not always accurate (host may suspend the bus while still connected). If the actual connection state
* needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by
* passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection
* and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually.
*
* \see USBTask.h for more information on the USB management task and reducing CPU usage.
*/
void EVENT_USB_Device_Connect(void);
/** Event for USB device disconnection. This event fires when the AVR in device mode and the device is disconnected
* from a host, measured by a falling level on the AVR's VBUS pin.
*
* \note For the smaller USB AVRs (AT90USBXX2) with limited USB controllers, VBUS is not available to the USB controller.
* this means that the current connection state is derived from the bus suspension and wake up events by default,
* which is not always accurate (host may suspend the bus while still connected). If the actual connection state
* needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by
* passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection
* and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually.
*
* \see USBTask.h for more information on the USB management task and reducing CPU usage.
*/
void EVENT_USB_Device_Disconnect(void);
/** Event for unhandled control requests. This event fires when a the USB host issues a control /** Event for unhandled control requests. This event fires when a the USB host issues a control
* request to the control endpoint (address 0) that the library does not handle. This may either * request to the control endpoint (address 0) that the library does not handle. This may either
@ -220,7 +187,7 @@
* request SETUP parameters into the \ref USB_ControlRequest structure which should then be used * request SETUP parameters into the \ref USB_ControlRequest structure which should then be used
* by the application to determine how to handle the issued request. * by the application to determine how to handle the issued request.
*/ */
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
/** Event for USB configuration number changed. This event fires when a the USB host changes the /** Event for USB configuration number changed. This event fires when a the USB host changes the
* selected configuration number while in device mode. This event should be hooked in device * selected configuration number while in device mode. This event should be hooked in device
@ -231,7 +198,7 @@
* \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
* \ref Group_USBManagement documentation). * \ref Group_USBManagement documentation).
*/ */
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
/** Event for USB suspend. This event fires when a the USB host suspends the device by halting its /** Event for USB suspend. This event fires when a the USB host suspends the device by halting its
* transmission of Start Of Frame pulses to the device. This is generally hooked in order to move * transmission of Start Of Frame pulses to the device. This is generally hooked in order to move
@ -242,9 +209,9 @@
* \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
* \ref Group_USBManagement documentation). * \ref Group_USBManagement documentation).
* *
* \see \ref EVENT_USB_WakeUp() event for accompanying Wake Up event. * \see \ref EVENT_USB_Device_WakeUp() event for accompanying Wake Up event.
*/ */
void EVENT_USB_Suspend(void); void EVENT_USB_Device_Suspend(void);
/** Event for USB wake up. This event fires when a the USB interface is suspended while in device /** Event for USB wake up. This event fires when a the USB interface is suspended while in device
* mode, and the host wakes up the device by supplying Start Of Frame pulses. This is generally * mode, and the host wakes up the device by supplying Start Of Frame pulses. This is generally
@ -255,9 +222,9 @@
* \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
* \ref Group_USBManagement documentation). * \ref Group_USBManagement documentation).
* *
* \see \ref EVENT_USB_Suspend() event for accompanying Suspend event. * \see \ref EVENT_USB_Device_Suspend() event for accompanying Suspend event.
*/ */
void EVENT_USB_WakeUp(void); void EVENT_USB_Device_WakeUp(void);
/** Event for USB interface reset. This event fires when the USB interface is in device mode, and /** Event for USB interface reset. This event fires when the USB interface is in device mode, and
* a the USB host requests that the device reset its interface. This event fires after the control * a the USB host requests that the device reset its interface. This event fires after the control
@ -266,7 +233,7 @@
* \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
* \ref Group_USBManagement documentation). * \ref Group_USBManagement documentation).
*/ */
void EVENT_USB_Reset(void); void EVENT_USB_Device_Reset(void);
#endif #endif
/* Private Interface - For use in library only: */ /* Private Interface - For use in library only: */
@ -274,35 +241,30 @@
/* Function Prototypes: */ /* Function Prototypes: */
#if defined(INCLUDE_FROM_EVENTS_C) #if defined(INCLUDE_FROM_EVENTS_C)
void USB_Event_Stub(void) ATTR_CONST; void USB_Event_Stub(void) ATTR_CONST;
#if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
void EVENT_USB_VBUSChange(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_VBUSConnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_VBUSDisconnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
#endif
void EVENT_USB_Connect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_Disconnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_DeviceEnumerationComplete(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
#if defined(USB_CAN_BE_BOTH) #if defined(USB_CAN_BE_BOTH)
void EVENT_USB_InitFailure(const uint8_t ErrorCode) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); void EVENT_USB_InitFailure(const uint8_t ErrorCode) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_UIDChange(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); void EVENT_USB_UIDChange(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
#endif #endif
#if defined(USB_CAN_BE_HOST) #if defined(USB_CAN_BE_HOST)
void EVENT_USB_HostError(const uint8_t ErrorCode) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); void EVENT_USB_Host_HostError(const uint8_t ErrorCode) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_DeviceAttached(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); void EVENT_USB_Host_DeviceAttached(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_DeviceUnattached(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); void EVENT_USB_Host_DeviceUnattached(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) void EVENT_USB_Host_DeviceEnumerationComplete(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
#endif #endif
void EVENT_USB_UnhandledControlPacket(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); #if defined(USB_CAN_BE_DEVICE)
void EVENT_USB_ConfigurationChanged(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); void EVENT_USB_Device_Connect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_Suspend(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); void EVENT_USB_Device_Disconnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_WakeUp(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); void EVENT_USB_Device_UnhandledControlRequest(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_Reset(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); void EVENT_USB_Device_ConfigurationChanged(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_Device_Suspend(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_Device_WakeUp(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_Device_Reset(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
#endif
#endif #endif
#endif #endif

@ -160,41 +160,41 @@
{ {
REQ_GetStatus = 0, /**< Implemented in the library for device, endpoint and interface REQ_GetStatus = 0, /**< Implemented in the library for device, endpoint and interface
* recipients. Passed to the user application for other recipients * recipients. Passed to the user application for other recipients
* via the \ref EVENT_USB_UnhandledControlPacket() event when received in * via the \ref EVENT_USB_Device_UnhandledControlRequest() event when received in
* device mode. */ * device mode. */
REQ_ClearFeature = 1, /**< Implemented in the library for device, endpoint and interface REQ_ClearFeature = 1, /**< Implemented in the library for device, endpoint and interface
* recipients. Passed to the user application for other recipients * recipients. Passed to the user application for other recipients
* via the \ref EVENT_USB_UnhandledControlPacket() event when received in * via the \ref EVENT_USB_Device_UnhandledControlRequest() event when received in
* device mode. */ * device mode. */
REQ_SetFeature = 3, /**< Implemented in the library for device, endpoint and interface REQ_SetFeature = 3, /**< Implemented in the library for device, endpoint and interface
* recipients. Passed to the user application for other recipients * recipients. Passed to the user application for other recipients
* via the \ref EVENT_USB_UnhandledControlPacket() event when received in * via the \ref EVENT_USB_Device_UnhandledControlRequest() event when received in
* device mode. */ * device mode. */
REQ_SetAddress = 5, /**< Implemented in the library for the device recipient. Passed REQ_SetAddress = 5, /**< Implemented in the library for the device recipient. Passed
* to the user application for other recipients via the * to the user application for other recipients via the
* \ref EVENT_USB_UnhandledControlPacket() event when received in * \ref EVENT_USB_Device_UnhandledControlRequest() event when received in
* device mode. */ * device mode. */
REQ_GetDescriptor = 6, /**< Implemented in the library for all recipients and all request REQ_GetDescriptor = 6, /**< Implemented in the library for all recipients and all request
* types. */ * types. */
REQ_SetDescriptor = 7, /**< Not implemented in the library, passed to the user application REQ_SetDescriptor = 7, /**< Not implemented in the library, passed to the user application
* via the \ref EVENT_USB_UnhandledControlPacket() event when received in * via the \ref EVENT_USB_Device_UnhandledControlRequest() event when received in
* device mode. */ * device mode. */
REQ_GetConfiguration = 8, /**< Implemented in the library for the device recipient. Passed REQ_GetConfiguration = 8, /**< Implemented in the library for the device recipient. Passed
* to the user application for other recipients via the * to the user application for other recipients via the
* \ref EVENT_USB_UnhandledControlPacket() event when received in * \ref EVENT_USB_Device_UnhandledControlRequest() event when received in
* device mode. */ * device mode. */
REQ_SetConfiguration = 9, /**< Implemented in the library for the device recipient. Passed REQ_SetConfiguration = 9, /**< Implemented in the library for the device recipient. Passed
* to the user application for other recipients via the * to the user application for other recipients via the
* \ref EVENT_USB_UnhandledControlPacket() event when received in * \ref EVENT_USB_Device_UnhandledControlRequest() event when received in
* device mode. */ * device mode. */
REQ_GetInterface = 10, /**< Not implemented in the library, passed to the user application REQ_GetInterface = 10, /**< Not implemented in the library, passed to the user application
* via the \ref EVENT_USB_UnhandledControlPacket() event when received in * via the \ref EVENT_USB_Device_UnhandledControlRequest() event when received in
* device mode. */ * device mode. */
REQ_SetInterface = 11, /**< Not implemented in the library, passed to the user application REQ_SetInterface = 11, /**< Not implemented in the library, passed to the user application
* via the \ref EVENT_USB_UnhandledControlPacket() event when received in * via the \ref EVENT_USB_Device_UnhandledControlRequest() event when received in
* device mode. */ * device mode. */
REQ_SynchFrame = 12, /**< Not implemented in the library, passed to the user application REQ_SynchFrame = 12, /**< Not implemented in the library, passed to the user application
* via the \ref EVENT_USB_UnhandledControlPacket() event when received in * via the \ref EVENT_USB_Device_UnhandledControlRequest() event when received in
* device mode. */ * device mode. */
}; };

@ -72,36 +72,15 @@ ISR(USB_GEN_vect, ISR_BLOCK)
{ {
USB_INT_Clear(USB_INT_VBUS); USB_INT_Clear(USB_INT_VBUS);
EVENT_USB_VBUSChange();
if (USB_VBUS_GetStatus()) if (USB_VBUS_GetStatus())
{ {
EVENT_USB_VBUSConnect();
if (USB_DeviceState != DEVICE_STATE_Unattached)
EVENT_USB_Disconnect();
USB_ResetInterface();
USB_DeviceState = DEVICE_STATE_Powered; USB_DeviceState = DEVICE_STATE_Powered;
EVENT_USB_Connect(); EVENT_USB_Device_Connect();
} }
else else
{ {
USB_DeviceState = DEVICE_STATE_Unattached; USB_DeviceState = DEVICE_STATE_Unattached;
EVENT_USB_Disconnect(); EVENT_USB_Device_Disconnect();
USB_Detach();
USB_CLK_Freeze();
if (!(USB_Options & USB_OPT_MANUAL_PLL))
USB_PLL_Off();
USB_REG_Off();
EVENT_USB_VBUSDisconnect();
USB_INT_Clear(USB_INT_VBUS);
} }
} }
#endif #endif
@ -120,10 +99,10 @@ ISR(USB_GEN_vect, ISR_BLOCK)
#if defined(USB_SERIES_2_AVR) && !defined(NO_LIMITED_CONTROLLER_CONNECT) #if defined(USB_SERIES_2_AVR) && !defined(NO_LIMITED_CONTROLLER_CONNECT)
USB_DeviceState = DEVICE_STATE_Unattached; USB_DeviceState = DEVICE_STATE_Unattached;
EVENT_USB_Disconnect(); EVENT_USB_Device_Disconnect();
#else #else
USB_DeviceState = DEVICE_STATE_Suspended; USB_DeviceState = DEVICE_STATE_Suspended;
EVENT_USB_Suspend(); EVENT_USB_Device_Suspend();
#endif #endif
} }
@ -143,11 +122,11 @@ ISR(USB_GEN_vect, ISR_BLOCK)
USB_INT_Enable(USB_INT_SUSPEND); USB_INT_Enable(USB_INT_SUSPEND);
#if defined(USB_SERIES_2_AVR) && !defined(NO_LIMITED_CONTROLLER_CONNECT) #if defined(USB_SERIES_2_AVR) && !defined(NO_LIMITED_CONTROLLER_CONNECT)
USB_DeviceState = DEVICE_STATE_Powered; USB_DeviceState = (USB_ConfigurationNumber) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered;
EVENT_USB_Connect(); EVENT_USB_Device_Connect();
#else #else
USB_DeviceState = (USB_ConfigurationNumber) ? DEVICE_STATE_Configured : DEVICE_STATE_Addressed; USB_DeviceState = (USB_ConfigurationNumber) ? DEVICE_STATE_Configured : DEVICE_STATE_Addressed;
EVENT_USB_WakeUp(); EVENT_USB_Device_WakeUp();
#endif #endif
} }
@ -172,7 +151,7 @@ ISR(USB_GEN_vect, ISR_BLOCK)
USB_INT_Enable(USB_INT_ENDPOINT_SETUP); USB_INT_Enable(USB_INT_ENDPOINT_SETUP);
#endif #endif
EVENT_USB_Reset(); EVENT_USB_Device_Reset();
} }
#endif #endif
@ -183,8 +162,7 @@ ISR(USB_GEN_vect, ISR_BLOCK)
USB_INT_Clear(USB_INT_DCONNI); USB_INT_Clear(USB_INT_DCONNI);
USB_INT_Disable(USB_INT_DDISCI); USB_INT_Disable(USB_INT_DDISCI);
EVENT_USB_DeviceUnattached(); EVENT_USB_Host_DeviceUnattached();
EVENT_USB_Disconnect();
USB_ResetInterface(); USB_ResetInterface();
} }
@ -196,8 +174,8 @@ ISR(USB_GEN_vect, ISR_BLOCK)
USB_Host_VBUS_Manual_Off(); USB_Host_VBUS_Manual_Off();
USB_Host_VBUS_Auto_Off(); USB_Host_VBUS_Auto_Off();
EVENT_USB_HostError(HOST_ERROR_VBusVoltageDip); EVENT_USB_Host_HostError(HOST_ERROR_VBusVoltageDip);
EVENT_USB_DeviceUnattached(); EVENT_USB_Host_DeviceUnattached();
USB_HostState = HOST_STATE_Unattached; USB_HostState = HOST_STATE_Unattached;
} }
@ -207,7 +185,7 @@ ISR(USB_GEN_vect, ISR_BLOCK)
USB_INT_Clear(USB_INT_SRPI); USB_INT_Clear(USB_INT_SRPI);
USB_INT_Disable(USB_INT_SRPI); USB_INT_Disable(USB_INT_SRPI);
EVENT_USB_DeviceAttached(); EVENT_USB_Host_DeviceAttached();
USB_INT_Enable(USB_INT_DDISCI); USB_INT_Enable(USB_INT_DDISCI);
@ -218,11 +196,8 @@ ISR(USB_GEN_vect, ISR_BLOCK)
{ {
USB_INT_Clear(USB_INT_BCERRI); USB_INT_Clear(USB_INT_BCERRI);
EVENT_USB_DeviceEnumerationFailed(HOST_ENUMERROR_NoDeviceDetected, 0); EVENT_USB_Host_DeviceEnumerationFailed(HOST_ENUMERROR_NoDeviceDetected, 0);
EVENT_USB_DeviceUnattached(); EVENT_USB_Host_DeviceUnattached();
if (USB_HostState != HOST_STATE_Unattached)
EVENT_USB_Disconnect();
USB_ResetInterface(); USB_ResetInterface();
} }
@ -237,15 +212,11 @@ ISR(USB_GEN_vect, ISR_BLOCK)
EVENT_USB_Disconnect(); EVENT_USB_Disconnect();
if (USB_HostState != HOST_STATE_Unattached) if (USB_HostState != HOST_STATE_Unattached)
{ EVENT_USB_Host_DeviceUnattached();
EVENT_USB_Disconnect();
EVENT_USB_DeviceUnattached();
}
EVENT_USB_Disconnect();
EVENT_USB_UIDChange();
USB_CurrentMode = USB_GetUSBModeFromUID();
EVENT_USB_UIDChange();
USB_ResetInterface(); USB_ResetInterface();
} }
#endif #endif

@ -68,7 +68,7 @@ static void USB_DeviceTask(void)
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
if (Endpoint_IsSETUPReceived()) if (Endpoint_IsSETUPReceived())
USB_Device_ProcessControlPacket(); USB_Device_ProcessControlRequest();
Endpoint_SelectEndpoint(PrevEndpoint); Endpoint_SelectEndpoint(PrevEndpoint);
} }

@ -65,7 +65,7 @@
extern volatile bool USB_IsInitialized; extern volatile bool USB_IsInitialized;
/** Structure containing the last received Control request when in Device mode (for use in user-applications /** Structure containing the last received Control request when in Device mode (for use in user-applications
* inside of the \ref EVENT_USB_UnhandledControlPacket() event, or for filling up with a control request to issue when * inside of the \ref EVENT_USB_Device_UnhandledControlRequest() event, or for filling up with a control request to issue when
* in Host mode before calling \ref USB_Host_SendControlRequest(). * in Host mode before calling \ref USB_Host_SendControlRequest().
* *
* \ingroup Group_USBManagement * \ingroup Group_USBManagement
@ -108,7 +108,7 @@
* *
* This value should not be altered by the user application as it is handled automatically by the * This value should not be altered by the user application as it is handled automatically by the
* library. The only exception to this rule is if the NO_LIMITED_CONTROLLER_CONNECT token is used * library. The only exception to this rule is if the NO_LIMITED_CONTROLLER_CONNECT token is used
* (see \ref EVENT_USB_Connect() and \ref EVENT_USB_Disconnect() events). * (see \ref EVENT_USB_Device_Connect() and \ref EVENT_USB_Device_Disconnect() events).
* *
* To reduce program size and speed up checks of this global, it can be placed into one of the AVR's * To reduce program size and speed up checks of this global, it can be placed into one of the AVR's
* GPIOR hardware registers instead of RAM by defining the DEVICE_STATE_AS_GPIOR token to a value * GPIOR hardware registers instead of RAM by defining the DEVICE_STATE_AS_GPIOR token to a value
@ -142,12 +142,12 @@
* The USB task must be serviced within 30ms while in device mode, or within 1ms while in host mode. * The USB task must be serviced within 30ms while in device mode, or within 1ms while in host mode.
* The task may be serviced at all times, or (for minimum CPU consumption): * The task may be serviced at all times, or (for minimum CPU consumption):
* *
* - In device mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_Connect() event * - In device mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_Device_Connect()
* and disabled again on the firing of the \ref EVENT_USB_Disconnect() event. * event and disabled again on the firing of the \ref EVENT_USB_Device_Disconnect() event.
* *
* - In host mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_DeviceAttached() * - In host mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_Host_DeviceAttached()
* event and disabled again on the firing of the \ref EVENT_USB_DeviceEnumerationComplete() or * event and disabled again on the firing of the \ref EVENT_USB_Host_DeviceEnumerationComplete() or
* \ref EVENT_USB_DeviceEnumerationFailed() events. * \ref EVENT_USB_Host_DeviceEnumerationFailed() events.
* *
* If in device mode (only), the control endpoint can instead be managed via interrupts entirely by the library * If in device mode (only), the control endpoint can instead be managed via interrupts entirely by the library
* by defining the INTERRUPT_CONTROL_ENDPOINT token and passing it to the compiler via the -D switch. * by defining the INTERRUPT_CONTROL_ENDPOINT token and passing it to the compiler via the -D switch.

@ -39,7 +39,7 @@ uint8_t USB_ConfigurationNumber;
bool USB_RemoteWakeupEnabled; bool USB_RemoteWakeupEnabled;
bool USB_CurrentlySelfPowered; bool USB_CurrentlySelfPowered;
void USB_Device_ProcessControlPacket(void) void USB_Device_ProcessControlRequest(void)
{ {
bool RequestHandled = false; bool RequestHandled = false;
uint8_t* RequestHeader = (uint8_t*)&USB_ControlRequest; uint8_t* RequestHeader = (uint8_t*)&USB_ControlRequest;
@ -106,7 +106,7 @@ void USB_Device_ProcessControlPacket(void)
} }
if (!(RequestHandled)) if (!(RequestHandled))
EVENT_USB_UnhandledControlPacket(); EVENT_USB_Device_UnhandledControlRequest();
if (Endpoint_IsSETUPReceived()) if (Endpoint_IsSETUPReceived())
{ {
@ -139,8 +139,6 @@ static void USB_Device_SetAddress(void)
static void USB_Device_SetConfiguration(void) static void USB_Device_SetConfiguration(void)
{ {
bool AlreadyConfigured = (USB_ConfigurationNumber != 0);
#if defined(FIXED_NUM_CONFIGURATIONS) #if defined(FIXED_NUM_CONFIGURATIONS)
if ((uint8_t)USB_ControlRequest.wValue > FIXED_NUM_CONFIGURATIONS) if ((uint8_t)USB_ControlRequest.wValue > FIXED_NUM_CONFIGURATIONS)
return; return;
@ -195,18 +193,11 @@ static void USB_Device_SetConfiguration(void)
Endpoint_ClearIN(); Endpoint_ClearIN();
if (USB_ConfigurationNumber) if (USB_ConfigurationNumber)
{ USB_DeviceState = DEVICE_STATE_Configured;
USB_DeviceState = DEVICE_STATE_Configured;
if (!(AlreadyConfigured))
EVENT_USB_DeviceEnumerationComplete();
}
else else
{ USB_DeviceState = DEVICE_STATE_Addressed;
USB_DeviceState = DEVICE_STATE_Addressed;
}
EVENT_USB_ConfigurationChanged(); EVENT_USB_Device_ConfigurationChanged();
} }
void USB_Device_GetConfiguration(void) void USB_Device_GetConfiguration(void)

@ -113,7 +113,7 @@
#endif #endif
/* Function Prototypes: */ /* Function Prototypes: */
void USB_Device_ProcessControlPacket(void); void USB_Device_ProcessControlRequest(void);
#if defined(INCLUDE_FROM_DEVCHAPTER9_C) #if defined(INCLUDE_FROM_DEVCHAPTER9_C)
static void USB_Device_SetAddress(void); static void USB_Device_SetAddress(void);

@ -92,8 +92,6 @@ void USB_Host_ProcessNextHostState(void)
USB_INT_Clear(USB_INT_VBERRI); USB_INT_Clear(USB_INT_VBERRI);
USB_INT_Enable(USB_INT_VBERRI); USB_INT_Enable(USB_INT_VBERRI);
EVENT_USB_Connect();
USB_Host_ResumeBus(); USB_Host_ResumeBus();
Pipe_ClearPipes(); Pipe_ClearPipes();
@ -185,19 +183,18 @@ void USB_Host_ProcessNextHostState(void)
case HOST_STATE_Default_PostAddressSet: case HOST_STATE_Default_PostAddressSet:
USB_Host_SetDeviceAddress(USB_HOST_DEVICEADDRESS); USB_Host_SetDeviceAddress(USB_HOST_DEVICEADDRESS);
EVENT_USB_DeviceEnumerationComplete(); EVENT_USB_Host_DeviceEnumerationComplete();
USB_HostState = HOST_STATE_Addressed; USB_HostState = HOST_STATE_Addressed;
break; break;
} }
if ((ErrorCode != HOST_ENUMERROR_NoError) && (USB_HostState != HOST_STATE_Unattached)) if ((ErrorCode != HOST_ENUMERROR_NoError) && (USB_HostState != HOST_STATE_Unattached))
{ {
EVENT_USB_DeviceEnumerationFailed(ErrorCode, SubErrorCode); EVENT_USB_Host_DeviceEnumerationFailed(ErrorCode, SubErrorCode);
USB_Host_VBUS_Auto_Off(); USB_Host_VBUS_Auto_Off();
EVENT_USB_DeviceUnattached(); EVENT_USB_Host_DeviceUnattached();
EVENT_USB_Disconnect();
USB_ResetInterface(); USB_ResetInterface();
} }

@ -312,7 +312,7 @@
*/ */
}; };
/** Enum for the error codes for the \ref EVENT_USB_HostError() event. /** Enum for the error codes for the \ref EVENT_USB_Host_HostError() event.
* *
* \see \ref Group_Events for more information on this event. * \see \ref Group_Events for more information on this event.
*/ */
@ -326,14 +326,14 @@
*/ */
}; };
/** Enum for the error codes for the \ref EVENT_USB_DeviceEnumerationFailed() event. /** Enum for the error codes for the \ref EVENT_USB_Host_DeviceEnumerationFailed() event.
* *
* \see \ref Group_Events for more information on this event. * \see \ref Group_Events for more information on this event.
*/ */
enum USB_Host_EnumerationErrorCodes_t enum USB_Host_EnumerationErrorCodes_t
{ {
HOST_ENUMERROR_NoError = 0, /**< No error occurred. Used internally, this is not a valid HOST_ENUMERROR_NoError = 0, /**< No error occurred. Used internally, this is not a valid
* ErrorCode parameter value for the \ref EVENT_USB_DeviceEnumerationFailed() * ErrorCode parameter value for the \ref EVENT_USB_Host_DeviceEnumerationFailed()
* event. * event.
*/ */
HOST_ENUMERROR_WaitStage = 1, /**< One of the delays between enumeration steps failed HOST_ENUMERROR_WaitStage = 1, /**< One of the delays between enumeration steps failed

@ -108,16 +108,6 @@ void USB_Init(
void USB_ShutDown(void) void USB_ShutDown(void)
{ {
#if defined(USB_CAN_BE_DEVICE)
if (USB_DeviceState != DEVICE_STATE_Unattached)
EVENT_USB_Disconnect();
#endif
#if defined(USB_CAN_BE_HOST)
if (USB_HostState != HOST_STATE_Unattached)
EVENT_USB_Disconnect();
#endif
USB_ResetInterface(); USB_ResetInterface();
USB_Detach(); USB_Detach();
USB_Controller_Disable(); USB_Controller_Disable();
@ -191,8 +181,6 @@ void USB_ResetInterface(void)
USB_Device_SetLowSpeed(); USB_Device_SetLowSpeed();
else else
USB_Device_SetFullSpeed(); USB_Device_SetFullSpeed();
USB_INT_Enable(USB_INT_VBUS);
} }
#endif #endif
@ -204,11 +192,11 @@ void USB_ResetInterface(void)
if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DeviceDescriptorPtr) != NO_DESCRIPTOR) if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DeviceDescriptorPtr) != NO_DESCRIPTOR)
{ {
#if defined(USE_RAM_DESCRIPTORS) #if defined(USE_RAM_DESCRIPTORS)
USB_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size; USB_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size;
#elif defined(USE_EEPROM_DESCRIPTORS) #elif defined(USE_EEPROM_DESCRIPTORS)
USB_ControlEndpointSize = eeprom_read_byte(&DeviceDescriptorPtr->Endpoint0Size); USB_ControlEndpointSize = eeprom_read_byte(&DeviceDescriptorPtr->Endpoint0Size);
#else #else
USB_ControlEndpointSize = pgm_read_byte(&DeviceDescriptorPtr->Endpoint0Size); USB_ControlEndpointSize = pgm_read_byte(&DeviceDescriptorPtr->Endpoint0Size);
#endif #endif
} }
} }
@ -216,13 +204,19 @@ void USB_ResetInterface(void)
USB_Attach(); USB_Attach();
#if defined(USB_DEVICE_ONLY) #if defined(USB_DEVICE_ONLY)
USB_INT_Clear(USB_INT_SUSPEND);
USB_INT_Enable(USB_INT_SUSPEND); USB_INT_Enable(USB_INT_SUSPEND);
USB_INT_Clear(USB_INT_EORSTI);
USB_INT_Enable(USB_INT_EORSTI); USB_INT_Enable(USB_INT_EORSTI);
#if defined(CONTROL_ONLY_DEVICE)
UENUM = ENDPOINT_CONTROLEP; #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
#endif USB_INT_Enable(USB_INT_VBUS);
#endif
#if defined(CONTROL_ONLY_DEVICE)
UENUM = ENDPOINT_CONTROLEP;
#endif
#elif defined(USB_HOST_ONLY) #elif defined(USB_HOST_ONLY)
USB_Host_HostMode_On(); USB_Host_HostMode_On();
@ -237,9 +231,15 @@ void USB_ResetInterface(void)
#else #else
if (USB_CurrentMode == USB_MODE_DEVICE) if (USB_CurrentMode == USB_MODE_DEVICE)
{ {
USB_INT_Clear(USB_INT_SUSPEND);
USB_INT_Enable(USB_INT_SUSPEND); USB_INT_Enable(USB_INT_SUSPEND);
USB_INT_Clear(USB_INT_EORSTI);
USB_INT_Enable(USB_INT_EORSTI); USB_INT_Enable(USB_INT_EORSTI);
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
USB_INT_Enable(USB_INT_VBUS);
#endif
#if defined(CONTROL_ONLY_DEVICE) #if defined(CONTROL_ONLY_DEVICE)
UENUM = ENDPOINT_CONTROLEP; UENUM = ENDPOINT_CONTROLEP;
#endif #endif

@ -191,7 +191,7 @@
#endif #endif
/** Detaches the device from the USB bus. This has the effect of removing the device from any /** Detaches the device from the USB bus. This has the effect of removing the device from any
* host if, ceasing USB communications. If no host is present, this prevents any host from * attached host, ceasing USB communications. If no host is present, this prevents any host from
* enumerating the device once attached until \ref USB_Attach() is called. * enumerating the device once attached until \ref USB_Attach() is called.
*/ */
#define USB_Detach() MACROS{ UDCON |= (1 << DETACH); }MACROE #define USB_Detach() MACROS{ UDCON |= (1 << DETACH); }MACROE
@ -342,7 +342,7 @@
#define USB_Controller_Enable() MACROS{ USBCON |= (1 << USBE); }MACROE #define USB_Controller_Enable() MACROS{ USBCON |= (1 << USBE); }MACROE
#define USB_Controller_Disable() MACROS{ USBCON &= ~(1 << USBE); }MACROE #define USB_Controller_Disable() MACROS{ USBCON &= ~(1 << USBE); }MACROE
#define USB_Controller_Reset() MACROS{ uint8_t Temp = USBCON; USBCON = (Temp & ~(1 << USBE)); \ #define USB_Controller_Reset() MACROS{ const uint8_t Temp = USBCON; USBCON = (Temp & ~(1 << USBE)); \
USBCON = (Temp | (1 << USBE)); }MACROE USBCON = (Temp | (1 << USBE)); }MACROE
/* Inline Functions: */ /* Inline Functions: */

@ -60,6 +60,8 @@
* - AudioOutput demos now always output to board LEDs, regardless of output mode (removed AUDIO_OUT_LEDS project option) * - AudioOutput demos now always output to board LEDs, regardless of output mode (removed AUDIO_OUT_LEDS project option)
* - Removed SINGLE_DEVICE_CONFIGURATION compile time option in favour of the new FIXED_NUM_CONFIGURATIONS option so that the exact number * - Removed SINGLE_DEVICE_CONFIGURATION compile time option in favour of the new FIXED_NUM_CONFIGURATIONS option so that the exact number
* of device configurations can be defined statically * of device configurations can be defined statically
* - Removed VBUS events, as they are already exposed to the user application via the regular device connection and disconnection events
* - Renamed and altered existing events to properly seperate out Host and Device mode events
* *
* <b>Fixed:</b> * <b>Fixed:</b>
* - Changed bootloaders to use FLASHEND rather than the existence of RAMPZ to determine if far FLASH pointers are needed to fix * - Changed bootloaders to use FLASHEND rather than the existence of RAMPZ to determine if far FLASH pointers are needed to fix

@ -172,8 +172,8 @@
* VBUS events, the library attempts to determine the connection state via the bus suspension and wake up events instead. This however may be * VBUS events, the library attempts to determine the connection state via the bus suspension and wake up events instead. This however may be
* slightly inaccurate due to the possibility of the host suspending the bus while the device is still connected. If accurate connection status is * slightly inaccurate due to the possibility of the host suspending the bus while the device is still connected. If accurate connection status is
* required, the VBUS line of the USB connector should be routed to an AVR pin to detect its level, so that the USB_DeviceState global * required, the VBUS line of the USB connector should be routed to an AVR pin to detect its level, so that the USB_DeviceState global
* can be accurately set and the USB_Connect and USB_Disconnect events manually raised by the RAISE_EVENT macro. When defined, this token disables * can be accurately set and the \ref EVENT_USB_Device_Connect() and \ref EVENT_USB_Device_Disconnect() events manually raised by the RAISE_EVENT macro.
* the library's auto-detection of the connection state by the aforementioned suspension and wake up events. * When defined, this token disables the library's auto-detection of the connection state by the aforementioned suspension and wake up events.
* *
* <b>INTERRUPT_CONTROL_ENDPOINT</b> - ( \ref Group_USBManagement ) \n * <b>INTERRUPT_CONTROL_ENDPOINT</b> - ( \ref Group_USBManagement ) \n
* Some applications prefer to not call the USB_USBTask() management task reguarly while in device mode, as it can complicate code significantly. * Some applications prefer to not call the USB_USBTask() management task reguarly while in device mode, as it can complicate code significantly.

@ -39,6 +39,8 @@
* state. * state.
* - The USB_IsConnected global has been removed, as it is too vague for general use. Test \ref USB_HostState explicitly to ensure the host is * - The USB_IsConnected global has been removed, as it is too vague for general use. Test \ref USB_HostState explicitly to ensure the host is
* in the desired state instead. * in the desired state instead.
* - The USB event names have been changed and their firing conditions changed to properly seperate out Host mode events from Device mode
* events. See the \ref Group_Events page for details on the new event names and firing conditions.
* *
* <b>Device Mode</b> * <b>Device Mode</b>
* - The \ref CALLBACK_USB_GetDescriptor() function now takes an extra parameter to specify the descriptor's memory space so that * - The \ref CALLBACK_USB_GetDescriptor() function now takes an extra parameter to specify the descriptor's memory space so that
@ -47,7 +49,9 @@
* - The USB_IsSuspended global has been removed - test \ref USB_DeviceState against \ref DEVICE_STATE_Suspended instead. * - The USB_IsSuspended global has been removed - test \ref USB_DeviceState against \ref DEVICE_STATE_Suspended instead.
* - The USB_IsConnected global has been removed, as it is too vague for general use. Test \ref USB_DeviceState explicitly to ensure the device * - The USB_IsConnected global has been removed, as it is too vague for general use. Test \ref USB_DeviceState explicitly to ensure the device
* is in the desired state instead. * is in the desired state instead.
* * - The VBUS events have been removed, as they are already exposed to the user via the USB_Connect and USB_Disconnect events.
* - The USB event names have been changed and their firing conditions changed to properly seperate out Host mode events from Device mode
* events. See the \ref Group_Events page for details on the new event names and firing conditions. *
* *
* \section Sec_Migration090605 Migrating from 090510 to 090605 * \section Sec_Migration090605 Migrating from 090510 to 090605
* *

@ -155,21 +155,21 @@ void SetupHardware(void)
} }
/** Event handler for the library USB Connection event. */ /** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void) void EVENT_USB_Device_Connect(void)
{ {
PingPongMSRemaining = PING_PONG_LED_PULSE_MS; PingPongMSRemaining = PING_PONG_LED_PULSE_MS;
LEDs_SetAllLEDs(LEDMASK_TX); LEDs_SetAllLEDs(LEDMASK_TX);
} }
/** Event handler for the library USB Disconnection event. */ /** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void) void EVENT_USB_Device_Disconnect(void)
{ {
PingPongMSRemaining = 0; PingPongMSRemaining = 0;
LEDs_TurnOffLEDs(LEDMASK_BUSY); LEDs_TurnOffLEDs(LEDMASK_BUSY);
} }
/** Event handler for the library USB Configuration Changed event. */ /** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
PingPongMSRemaining = 0; PingPongMSRemaining = 0;
LEDs_TurnOffLEDs(LEDMASK_BUSY); LEDs_TurnOffLEDs(LEDMASK_BUSY);
@ -178,10 +178,10 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_TurnOnLEDs(LEDMASK_ERROR); LEDs_TurnOnLEDs(LEDMASK_ERROR);
} }
/** Event handler for the library USB Unhandled Control Packet event. */ /** Event handler for the library USB Unhandled Control Request event. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
CDC_Device_ProcessControlPacket(&VirtualSerial_CDC_Interface); CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
} }
/** Event handler for the CDC Class driver Line Encoding Changed event. /** Event handler for the CDC Class driver Line Encoding Changed event.

@ -64,10 +64,10 @@
/* Function Prototypes: */ /* Function Prototypes: */
void SetupHardware(void); void SetupHardware(void);
void EVENT_USB_Connect(void); void EVENT_USB_Device_Connect(void);
void EVENT_USB_Disconnect(void); void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);

@ -145,15 +145,15 @@ void ReadMagstripeData(void)
} }
/** Event handler for the library USB Configuration Changed event. */ /** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_Device_ConfigurationChanged(void)
{ {
HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface); HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface);
} }
/** Event handler for the library USB Unhandled Control Packet event. */ /** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
HID_Device_ProcessControlPacket(&Keyboard_HID_Interface); HID_Device_ProcessControlRequest(&Keyboard_HID_Interface);
} }
/** Timer 0 CTC ISR, firing once each millisecond to keep track of elapsed idle time in the HID interface. */ /** Timer 0 CTC ISR, firing once each millisecond to keep track of elapsed idle time in the HID interface. */

@ -82,8 +82,8 @@
void SetupHardware(void); void SetupHardware(void);
void ReadMagstripeData(void); void ReadMagstripeData(void);
void EVENT_USB_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void); void EVENT_USB_Device_UnhandledControlRequest(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
void* ReportData, uint16_t* ReportSize); void* ReportData, uint16_t* ReportSize);

@ -186,7 +186,7 @@ void Send_Command(uint8_t* Command)
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process. * starts the library USB task to begin the enumeration and USB management process.
*/ */
void EVENT_USB_DeviceAttached(void) void EVENT_USB_Host_DeviceAttached(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
} }
@ -194,7 +194,7 @@ void EVENT_USB_DeviceAttached(void)
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process. * stops the library USB task management process.
*/ */
void EVENT_USB_DeviceUnattached(void) void EVENT_USB_Host_DeviceUnattached(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} }
@ -202,13 +202,13 @@ void EVENT_USB_DeviceUnattached(void)
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application. * enumerated by the host and is now ready to be used by the application.
*/ */
void EVENT_USB_DeviceEnumerationComplete(void) void EVENT_USB_Host_DeviceEnumerationComplete(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
} }
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
void EVENT_USB_HostError(const uint8_t ErrorCode) void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
{ {
USB_ShutDown(); USB_ShutDown();
@ -219,7 +219,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode)
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }

@ -87,11 +87,11 @@
void HID_Host_Task(void); void HID_Host_Task(void);
void EVENT_USB_HostError(const uint8_t ErrorCode); void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_DeviceAttached(void); void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_DeviceUnattached(void); void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
void EVENT_USB_DeviceEnumerationComplete(void); void EVENT_USB_Host_DeviceEnumerationComplete(void);
void DiscardNextReport(void); void DiscardNextReport(void);
void WriteNextReport(uint8_t* ReportOUTData, uint16_t ReportLength); void WriteNextReport(uint8_t* ReportOUTData, uint16_t ReportLength);

Loading…
Cancel
Save