Commit c5038f1b authored by Dean Camera's avatar Dean Camera
Browse files

Renamed all library events to properly seperate out Device and Host mode...

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.
parent 357ccc57
......@@ -119,7 +119,7 @@ void ResetHardware(void)
/** Event handler for the USB_Disconnect event. This indicates that the bootloader should exit and the user
* application started.
*/
void EVENT_USB_Disconnect(void)
void EVENT_USB_Device_Disconnect(void)
{
/* Upon disconnection, run user application */
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
* 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 */
Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,
......@@ -144,11 +144,11 @@ void EVENT_USB_ConfigurationChanged(void)
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
* for the application.
*/
void EVENT_USB_UnhandledControlPacket(void)
void EVENT_USB_Device_UnhandledControlRequest(void)
{
uint8_t* LineCodingData = (uint8_t*)&LineCoding;
......
......@@ -118,9 +118,9 @@
void SetupHardware(void);
void ResetHardware(void);
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
#if defined(INCLUDE_FROM_BOOTLOADERCDC_C) || defined(__DOXYGEN__)
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
* application started.
*/
void EVENT_USB_Disconnect(void)
void EVENT_USB_Device_Disconnect(void)
{
/* Upon disconnection, run user application */
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
* 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 */
SentCommand.DataSize = USB_ControlRequest.wLength;
......
......@@ -191,8 +191,8 @@
void SetupHardware(void);
void ResetHardware(void);
void EVENT_USB_Disconnect(void);
void EVENT_USB_UnhandledControlPacket(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
#if defined(INCLUDE_FROM_BOOTLOADER_C)
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
* 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 */
Endpoint_ConfigureEndpoint(HID_EPNUM, EP_TYPE_INTERRUPT,
......@@ -92,11 +92,11 @@ void EVENT_USB_ConfigurationChanged(void)
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
* 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 */
switch (USB_ControlRequest.bRequest)
......
......@@ -64,7 +64,7 @@
/* Function Prototypes: */
void SetupHardware(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
#endif
......@@ -47,7 +47,7 @@
* 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/.
*
* 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
* compatible with no changes.
......
......@@ -112,7 +112,7 @@ void ProcessNextSample(void)
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
void EVENT_USB_Device_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
......@@ -123,7 +123,7 @@ void EVENT_USB_Connect(void)
}
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
void EVENT_USB_Device_Disconnect(void)
{
/* Stop the sample reload timer */
TCCR0B = 0;
......@@ -132,7 +132,7 @@ void EVENT_USB_Disconnect(void)
}
/** 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);
......@@ -140,8 +140,8 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
/** Event handler for the library USB Unhandled Control Request event. */
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 ProcessNextSample(void);
void EVENT_USB_Connect(void);
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
#endif
......@@ -140,7 +140,7 @@ void ProcessNextSample(void)
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
void EVENT_USB_Device_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
......@@ -169,7 +169,7 @@ void EVENT_USB_Connect(void)
}
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
void EVENT_USB_Device_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
......@@ -194,7 +194,7 @@ void EVENT_USB_Disconnect(void)
}
/** 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);
......@@ -202,8 +202,8 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
/** Event handler for the library USB Unhandled Control Request event. */
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 ProcessNextSample(void);
void EVENT_USB_Connect(void);
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
#endif
......@@ -155,19 +155,19 @@ void CheckJoystickMovement(void)
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
void EVENT_USB_Device_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
void EVENT_USB_Device_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
/** 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);
......@@ -175,8 +175,8 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
/** Event handler for the library USB Unhandled Control Request event. */
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 CheckJoystickMovement(void);
void EVENT_USB_Connect(void);
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
#endif
......@@ -163,19 +163,19 @@ void CheckJoystickMovement(void)
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
void EVENT_USB_Device_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
void EVENT_USB_Device_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
/** 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);
......@@ -186,9 +186,9 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
/** Event handler for the library USB Unhandled Control Request event. */
void EVENT_USB_Device_UnhandledControlRequest(void)
{
CDC_Device_ProcessControlPacket(&VirtualSerial1_CDC_Interface);
CDC_Device_ProcessControlPacket(&VirtualSerial2_CDC_Interface);
CDC_Device_ProcessControlRequest(&VirtualSerial1_CDC_Interface);
CDC_Device_ProcessControlRequest(&VirtualSerial2_CDC_Interface);
}
......@@ -67,9 +67,9 @@
void SetupHardware(void);
void CheckJoystickMovement(void);
void EVENT_USB_Connect(void);
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
#endif
......@@ -103,19 +103,19 @@ void SetupHardware(void)
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
void EVENT_USB_Device_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
void EVENT_USB_Device_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
/** 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);
......@@ -123,10 +123,10 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
/** Event handler for the library USB Unhandled Control Request event. */
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. */
......
......@@ -67,10 +67,10 @@
/* Function Prototypes: */
void SetupHardware(void);
void EVENT_USB_Connect(void);
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
void* ReportData, uint16_t* ReportSize);
......
......@@ -97,19 +97,19 @@ void SetupHardware(void)
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
void EVENT_USB_Device_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
void EVENT_USB_Device_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
/** 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);
......@@ -117,10 +117,10 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
/** Event handler for the library USB Unhandled Control Request event. */
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. */
......
......@@ -78,10 +78,10 @@
/* Function Prototypes: */
void SetupHardware(void);
void EVENT_USB_Connect(void);
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
void* ReportData, uint16_t* ReportSize);
......
......@@ -98,19 +98,19 @@ void SetupHardware()
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
void EVENT_USB_Device_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
void EVENT_USB_Device_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
/** 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);
......@@ -118,10 +118,10 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
/** Event handler for the library USB Unhandled Control Request event. */
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. */
......
......@@ -81,10 +81,10 @@
/* Function Prototypes: */
void SetupHardware(void);
void EVENT_USB_Connect(void);
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
void* ReportData, uint16_t* ReportSize);
......
......@@ -121,19 +121,19 @@ void SetupHardware()
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
void EVENT_USB_Device_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
void EVENT_USB_Device_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
/** 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);
......@@ -144,11 +144,11 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
/** Event handler for the library USB Unhandled Control Request event. */
void EVENT_USB_Device_UnhandledControlRequest(void)
{
HID_Device_ProcessControlPacket(&Keyboard_HID_Interface);
HID_Device_ProcessControlPacket(&Mouse_HID_Interface);
HID_Device_ProcessControlRequest(&Keyboard_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. */
......
......@@ -85,10 +85,10 @@
/* Function Prototypes: */
void SetupHardware(void);
void EVENT_USB_Connect(void);
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
void* ReportData, uint16_t* ReportSize);
......
......@@ -157,19 +157,19 @@ void CheckJoystickMovement(void)
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
void EVENT_USB_Device_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
void EVENT_USB_Device_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
/** 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);
......@@ -177,8 +177,8 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
/** Event handler for the library USB Unhandled Control Request event. */
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 CheckJoystickMovement(void);
void EVENT_USB_Connect(void);