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
......@@ -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);
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
......@@ -92,19 +92,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);
......@@ -112,10 +112,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)
{
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.
......
......@@ -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_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* MSInterfaceInfo);
......
......@@ -96,20 +96,20 @@ void SetupHardware(void)
TIMSK0 = (1 << OCIE0A);
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
/** Event handler for the library USB WakeUp event. */
void EVENT_USB_Device_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
/** Event handler for the library USB Suspend event. */
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_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. */
......
......@@ -80,10 +80,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_Device_Connect(void);
void EVENT_USB_Device_Device_Disconnect(void);
void EVENT_USB_Device_Device_ConfigurationChanged(void);
void EVENT_USB_Device_Device_UnhandledControlRequest(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
void* ReportData, uint16_t* ReportSize);
......
......@@ -107,19 +107,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);
......@@ -127,8 +127,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)
{
RNDIS_Device_ProcessControlPacket(&Ethernet_RNDIS_Interface);
RNDIS_Device_ProcessControlRequest(&Ethernet_RNDIS_Interface);
}
......@@ -76,9 +76,9 @@
/* 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);
#endif
......@@ -116,19 +116,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);
......@@ -136,10 +136,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_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
......
......@@ -69,10 +69,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);
void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
......
......@@ -82,17 +82,17 @@ void SetupHardware(void)
SerialStream_Init(9600, false);
}
void EVENT_USB_Connect(void)
void EVENT_USB_Device_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
void EVENT_USB_Disconnect(void)
void EVENT_USB_Device_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
void EVENT_USB_ConfigurationChanged(void)
void EVENT_USB_Device_ConfigurationChanged(void)
{
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 */
switch (USB_ControlRequest.bRequest)
......
......@@ -65,9 +65,9 @@
void SetupHardware(void);
void SideShow_Task(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
......@@ -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
* configures the sample update and PWM timers.
*/
void EVENT_USB_Connect(void)
void EVENT_USB_Device_Connect(void)
{
/* Indicate 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
* 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 */
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
* 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 */
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
* 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 */
switch (USB_ControlRequest.bRequest)
......
......@@ -74,9 +74,9 @@
void SetupHardware(void);
void USB_Audio_Task(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
......@@ -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
* configures the sample update and PWM timers.
*/
void EVENT_USB_Connect(void)
void EVENT_USB_Device_Connect(void)
{
/* Indicate 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
* 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 */
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
* 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 */
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
* 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 */
switch (USB_ControlRequest.bRequest)
......
......@@ -65,9 +65,9 @@
void SetupHardware(void);
void USB_Audio_Task(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
......@@ -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
* 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 */
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
* 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 */
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
* 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 */
LEDs_SetAllLEDs(LEDMASK_USB_READY);
......@@ -187,13 +187,16 @@ void EVENT_USB_ConfigurationChanged(void)
{
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,
* 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 */
switch (USB_ControlRequest.bRequest)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment