forked from mfulz_github/qmk_firmware
Error status LEDs shown when device endpoint configuration fails to complete.
MIDI device demo no longer blocks if a note change event is sent while the endpoint is not ready.
This commit is contained in:
parent
ac70ddd0a1
commit
e6881fd166
|
@ -109,13 +109,16 @@ void EVENT_USB_Disconnect(void)
|
||||||
*/
|
*/
|
||||||
void EVENT_USB_ConfigurationChanged(void)
|
void EVENT_USB_ConfigurationChanged(void)
|
||||||
{
|
{
|
||||||
/* Setup audio stream endpoint */
|
|
||||||
Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS,
|
|
||||||
ENDPOINT_DIR_IN, AUDIO_STREAM_EPSIZE,
|
|
||||||
ENDPOINT_BANK_DOUBLE);
|
|
||||||
|
|
||||||
/* Indicate USB connected and ready */
|
/* Indicate USB connected and ready */
|
||||||
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||||
|
|
||||||
|
/* Setup audio stream endpoint */
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS,
|
||||||
|
ENDPOINT_DIR_IN, AUDIO_STREAM_EPSIZE,
|
||||||
|
ENDPOINT_BANK_DOUBLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
||||||
|
|
|
@ -136,13 +136,16 @@ void EVENT_USB_Disconnect(void)
|
||||||
*/
|
*/
|
||||||
void EVENT_USB_ConfigurationChanged(void)
|
void EVENT_USB_ConfigurationChanged(void)
|
||||||
{
|
{
|
||||||
/* Setup audio stream endpoint */
|
|
||||||
Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS,
|
|
||||||
ENDPOINT_DIR_OUT, AUDIO_STREAM_EPSIZE,
|
|
||||||
ENDPOINT_BANK_DOUBLE);
|
|
||||||
|
|
||||||
/* Indicate USB connected and ready */
|
/* Indicate USB connected and ready */
|
||||||
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||||
|
|
||||||
|
/* Setup audio stream endpoint */
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS,
|
||||||
|
ENDPOINT_DIR_OUT, AUDIO_STREAM_EPSIZE,
|
||||||
|
ENDPOINT_BANK_DOUBLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
||||||
|
|
|
@ -105,21 +105,30 @@ void EVENT_USB_Disconnect(void)
|
||||||
*/
|
*/
|
||||||
void EVENT_USB_ConfigurationChanged(void)
|
void EVENT_USB_ConfigurationChanged(void)
|
||||||
{
|
{
|
||||||
/* Setup CDC Notification, Rx and Tx Endpoints */
|
|
||||||
Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,
|
|
||||||
ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK,
|
|
||||||
ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK,
|
|
||||||
ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
/* Indicate USB connected and ready */
|
/* Indicate USB connected and ready */
|
||||||
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||||
|
|
||||||
|
/* Setup CDC Notification, Rx and Tx Endpoints */
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,
|
||||||
|
ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK,
|
||||||
|
ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK,
|
||||||
|
ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
||||||
|
|
|
@ -116,35 +116,53 @@ void EVENT_USB_Disconnect(void)
|
||||||
* 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_ConfigurationChanged(void)
|
||||||
{
|
{
|
||||||
/* Setup CDC Notification, Rx and Tx Endpoints for the first CDC */
|
|
||||||
Endpoint_ConfigureEndpoint(CDC1_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,
|
|
||||||
ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
Endpoint_ConfigureEndpoint(CDC1_TX_EPNUM, EP_TYPE_BULK,
|
|
||||||
ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
Endpoint_ConfigureEndpoint(CDC1_RX_EPNUM, EP_TYPE_BULK,
|
|
||||||
ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
/* Setup CDC Notification, Rx and Tx Endpoints for the second CDC */
|
|
||||||
Endpoint_ConfigureEndpoint(CDC2_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,
|
|
||||||
ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
Endpoint_ConfigureEndpoint(CDC2_TX_EPNUM, EP_TYPE_BULK,
|
|
||||||
ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
Endpoint_ConfigureEndpoint(CDC2_RX_EPNUM, EP_TYPE_BULK,
|
|
||||||
ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
/* Indicate USB connected and ready */
|
/* Indicate USB connected and ready */
|
||||||
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||||
|
|
||||||
|
/* Setup CDC Notification, Rx and Tx Endpoints for the first CDC */
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(CDC1_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,
|
||||||
|
ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(CDC1_TX_EPNUM, EP_TYPE_BULK,
|
||||||
|
ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(CDC1_RX_EPNUM, EP_TYPE_BULK,
|
||||||
|
ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Setup CDC Notification, Rx and Tx Endpoints for the second CDC */
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(CDC2_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,
|
||||||
|
ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(CDC2_TX_EPNUM, EP_TYPE_BULK,
|
||||||
|
ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(CDC2_RX_EPNUM, EP_TYPE_BULK,
|
||||||
|
ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
||||||
|
|
|
@ -94,18 +94,24 @@ void EVENT_USB_Disconnect(void)
|
||||||
*/
|
*/
|
||||||
void EVENT_USB_ConfigurationChanged(void)
|
void EVENT_USB_ConfigurationChanged(void)
|
||||||
{
|
{
|
||||||
/* Setup Generic IN Report Endpoint */
|
|
||||||
Endpoint_ConfigureEndpoint(GENERIC_IN_EPNUM, EP_TYPE_INTERRUPT,
|
|
||||||
ENDPOINT_DIR_IN, GENERIC_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
/* Setup Generic OUT Report Endpoint */
|
|
||||||
Endpoint_ConfigureEndpoint(GENERIC_OUT_EPNUM, EP_TYPE_INTERRUPT,
|
|
||||||
ENDPOINT_DIR_OUT, GENERIC_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
/* Indicate USB connected and ready */
|
/* Indicate USB connected and ready */
|
||||||
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||||
|
|
||||||
|
/* Setup Generic IN Report Endpoint */
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(GENERIC_IN_EPNUM, EP_TYPE_INTERRUPT,
|
||||||
|
ENDPOINT_DIR_IN, GENERIC_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Setup Generic OUT Report Endpoint */
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(GENERIC_OUT_EPNUM, EP_TYPE_INTERRUPT,
|
||||||
|
ENDPOINT_DIR_OUT, GENERIC_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
||||||
|
|
|
@ -92,13 +92,16 @@ void EVENT_USB_Disconnect(void)
|
||||||
*/
|
*/
|
||||||
void EVENT_USB_ConfigurationChanged(void)
|
void EVENT_USB_ConfigurationChanged(void)
|
||||||
{
|
{
|
||||||
/* Setup Joystick Report Endpoint */
|
|
||||||
Endpoint_ConfigureEndpoint(JOYSTICK_EPNUM, EP_TYPE_INTERRUPT,
|
|
||||||
ENDPOINT_DIR_IN, JOYSTICK_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
/* Indicate USB connected and ready */
|
/* Indicate USB connected and ready */
|
||||||
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||||
|
|
||||||
|
/* Setup Joystick Report Endpoint */
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(JOYSTICK_EPNUM, EP_TYPE_INTERRUPT,
|
||||||
|
ENDPOINT_DIR_IN, JOYSTICK_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
||||||
|
|
|
@ -118,19 +118,25 @@ void EVENT_USB_Disconnect(void)
|
||||||
* 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_ConfigurationChanged(void)
|
||||||
{
|
{
|
||||||
/* Setup Keyboard Keycode Report Endpoint */
|
|
||||||
Endpoint_ConfigureEndpoint(KEYBOARD_EPNUM, EP_TYPE_INTERRUPT,
|
|
||||||
ENDPOINT_DIR_IN, KEYBOARD_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
/* Setup Keyboard LED Report Endpoint */
|
|
||||||
Endpoint_ConfigureEndpoint(KEYBOARD_LEDS_EPNUM, EP_TYPE_INTERRUPT,
|
|
||||||
ENDPOINT_DIR_OUT, KEYBOARD_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
/* Indicate USB connected and ready */
|
/* Indicate USB connected and ready */
|
||||||
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||||
|
|
||||||
|
/* Setup Keyboard Keycode Report Endpoint */
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(KEYBOARD_EPNUM, EP_TYPE_INTERRUPT,
|
||||||
|
ENDPOINT_DIR_IN, KEYBOARD_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Setup Keyboard LED Report Endpoint */
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(KEYBOARD_LEDS_EPNUM, EP_TYPE_INTERRUPT,
|
||||||
|
ENDPOINT_DIR_OUT, KEYBOARD_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
||||||
|
|
|
@ -100,23 +100,32 @@ void EVENT_USB_Disconnect(void)
|
||||||
*/
|
*/
|
||||||
void EVENT_USB_ConfigurationChanged(void)
|
void EVENT_USB_ConfigurationChanged(void)
|
||||||
{
|
{
|
||||||
/* Setup Keyboard Report Endpoint */
|
|
||||||
Endpoint_ConfigureEndpoint(KEYBOARD_IN_EPNUM, EP_TYPE_INTERRUPT,
|
|
||||||
ENDPOINT_DIR_IN, HID_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
/* Setup Keyboard LED Report Endpoint */
|
|
||||||
Endpoint_ConfigureEndpoint(KEYBOARD_OUT_EPNUM, EP_TYPE_INTERRUPT,
|
|
||||||
ENDPOINT_DIR_OUT, HID_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
/* Setup Mouse Report Endpoint */
|
|
||||||
Endpoint_ConfigureEndpoint(MOUSE_IN_EPNUM, EP_TYPE_INTERRUPT,
|
|
||||||
ENDPOINT_DIR_IN, HID_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
/* Indicate USB connected and ready */
|
/* Indicate USB connected and ready */
|
||||||
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||||
|
|
||||||
|
/* Setup Keyboard Report Endpoint */
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(KEYBOARD_IN_EPNUM, EP_TYPE_INTERRUPT,
|
||||||
|
ENDPOINT_DIR_IN, HID_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Setup Keyboard LED Report Endpoint */
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(KEYBOARD_OUT_EPNUM, EP_TYPE_INTERRUPT,
|
||||||
|
ENDPOINT_DIR_OUT, HID_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Setup Mouse Report Endpoint */
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(MOUSE_IN_EPNUM, EP_TYPE_INTERRUPT,
|
||||||
|
ENDPOINT_DIR_IN, HID_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
||||||
|
|
|
@ -90,17 +90,23 @@ void EVENT_USB_Disconnect(void)
|
||||||
*/
|
*/
|
||||||
void EVENT_USB_ConfigurationChanged(void)
|
void EVENT_USB_ConfigurationChanged(void)
|
||||||
{
|
{
|
||||||
/* Setup MIDI stream endpoints */
|
|
||||||
Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK,
|
|
||||||
ENDPOINT_DIR_OUT, MIDI_STREAM_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPNUM, EP_TYPE_BULK,
|
|
||||||
ENDPOINT_DIR_IN, MIDI_STREAM_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
/* Indicate USB connected and ready */
|
/* Indicate USB connected and ready */
|
||||||
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||||
|
|
||||||
|
/* Setup MIDI stream endpoints */
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK,
|
||||||
|
ENDPOINT_DIR_OUT, MIDI_STREAM_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPNUM, EP_TYPE_BULK,
|
||||||
|
ENDPOINT_DIR_IN, MIDI_STREAM_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Task to handle the generation of MIDI note change events in response to presses of the board joystick, and send them
|
/** Task to handle the generation of MIDI note change events in response to presses of the board joystick, and send them
|
||||||
|
@ -159,8 +165,9 @@ void MIDI_Task(void)
|
||||||
*/
|
*/
|
||||||
void SendMIDINoteChange(const uint8_t Pitch, const bool OnOff, const uint8_t CableID, const uint8_t Channel)
|
void SendMIDINoteChange(const uint8_t Pitch, const bool OnOff, const uint8_t CableID, const uint8_t Channel)
|
||||||
{
|
{
|
||||||
/* Wait until endpoint ready for more data */
|
/* If endpoint ready for more data, abort */
|
||||||
while (!(Endpoint_IsReadWriteAllowed()));
|
if (!(Endpoint_IsReadWriteAllowed()))
|
||||||
|
return;
|
||||||
|
|
||||||
/* Check if the message should be a Note On or Note Off command */
|
/* Check if the message should be a Note On or Note Off command */
|
||||||
uint8_t Command = ((OnOff)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
|
uint8_t Command = ((OnOff)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
|
||||||
|
|
|
@ -106,17 +106,23 @@ void EVENT_USB_Disconnect(void)
|
||||||
*/
|
*/
|
||||||
void EVENT_USB_ConfigurationChanged(void)
|
void EVENT_USB_ConfigurationChanged(void)
|
||||||
{
|
{
|
||||||
/* Setup Mass Storage In and Out Endpoints */
|
|
||||||
Endpoint_ConfigureEndpoint(MASS_STORAGE_IN_EPNUM, EP_TYPE_BULK,
|
|
||||||
ENDPOINT_DIR_IN, MASS_STORAGE_IO_EPSIZE,
|
|
||||||
ENDPOINT_BANK_DOUBLE);
|
|
||||||
|
|
||||||
Endpoint_ConfigureEndpoint(MASS_STORAGE_OUT_EPNUM, EP_TYPE_BULK,
|
|
||||||
ENDPOINT_DIR_OUT, MASS_STORAGE_IO_EPSIZE,
|
|
||||||
ENDPOINT_BANK_DOUBLE);
|
|
||||||
|
|
||||||
/* Indicate USB connected and ready */
|
/* Indicate USB connected and ready */
|
||||||
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||||
|
|
||||||
|
/* Setup Mass Storage In and Out Endpoints */
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(MASS_STORAGE_IN_EPNUM, EP_TYPE_BULK,
|
||||||
|
ENDPOINT_DIR_IN, MASS_STORAGE_IO_EPSIZE,
|
||||||
|
ENDPOINT_BANK_DOUBLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(MASS_STORAGE_OUT_EPNUM, EP_TYPE_BULK,
|
||||||
|
ENDPOINT_DIR_OUT, MASS_STORAGE_IO_EPSIZE,
|
||||||
|
ENDPOINT_BANK_DOUBLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
||||||
|
|
|
@ -119,13 +119,16 @@ void EVENT_USB_Disconnect(void)
|
||||||
*/
|
*/
|
||||||
void EVENT_USB_ConfigurationChanged(void)
|
void EVENT_USB_ConfigurationChanged(void)
|
||||||
{
|
{
|
||||||
/* Setup Mouse Report Endpoint */
|
|
||||||
Endpoint_ConfigureEndpoint(MOUSE_EPNUM, EP_TYPE_INTERRUPT,
|
|
||||||
ENDPOINT_DIR_IN, MOUSE_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
/* Indicate USB connected and ready */
|
/* Indicate USB connected and ready */
|
||||||
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||||
|
|
||||||
|
/* Setup Mouse Report Endpoint */
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(MOUSE_EPNUM, EP_TYPE_INTERRUPT,
|
||||||
|
ENDPOINT_DIR_IN, MOUSE_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
||||||
|
|
|
@ -99,21 +99,30 @@ void EVENT_USB_Disconnect(void)
|
||||||
*/
|
*/
|
||||||
void EVENT_USB_ConfigurationChanged(void)
|
void EVENT_USB_ConfigurationChanged(void)
|
||||||
{
|
{
|
||||||
/* Setup CDC Notification, Rx and Tx Endpoints */
|
|
||||||
Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK,
|
|
||||||
ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK,
|
|
||||||
ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,
|
|
||||||
ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
/* Indicate USB connected and ready */
|
/* Indicate USB connected and ready */
|
||||||
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||||
|
|
||||||
|
/* Setup CDC Notification, Rx and Tx Endpoints */
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK,
|
||||||
|
ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK,
|
||||||
|
ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,
|
||||||
|
ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
||||||
|
|
|
@ -113,21 +113,30 @@ void EVENT_USB_Disconnect(void)
|
||||||
*/
|
*/
|
||||||
void EVENT_USB_ConfigurationChanged(void)
|
void EVENT_USB_ConfigurationChanged(void)
|
||||||
{
|
{
|
||||||
/* Setup CDC Notification, Rx and Tx Endpoints */
|
|
||||||
Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,
|
|
||||||
ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK,
|
|
||||||
ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK,
|
|
||||||
ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,
|
|
||||||
ENDPOINT_BANK_SINGLE);
|
|
||||||
|
|
||||||
/* Indicate USB connected and ready */
|
/* Indicate USB connected and ready */
|
||||||
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||||
|
|
||||||
|
/* Setup CDC Notification, Rx and Tx Endpoints */
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,
|
||||||
|
ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK,
|
||||||
|
ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK,
|
||||||
|
ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,
|
||||||
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
- Convert Host mode demos to class drivers
|
- Convert Host mode demos to class drivers
|
||||||
- Convert Host mode demos to schedulerless
|
- Convert Host mode demos to schedulerless
|
||||||
- Add standardized descriptor names to class driver structures, controlled by USE_NONSTANDARD_DESCRIPTOR_NAMES
|
- Add standardized descriptor names to class driver structures, controlled by USE_NONSTANDARD_DESCRIPTOR_NAMES
|
||||||
- Device demos error if endpoint config fail
|
|
||||||
============================
|
============================
|
||||||
|
|
||||||
/** \page Page_ChangeLog Project Changelog
|
/** \page Page_ChangeLog Project Changelog
|
||||||
|
@ -23,6 +22,8 @@
|
||||||
* - Added new class drivers and matching demos to the library for rapid application development
|
* - Added new class drivers and matching demos to the library for rapid application development
|
||||||
* - Added incomplete device and host mode demos for later enhancement
|
* - Added incomplete device and host mode demos for later enhancement
|
||||||
* - Changed bootloaders to use FLASHEND rather than the existence of RAMPZ to determine if far FLASH pointers are needed
|
* - Changed bootloaders to use FLASHEND rather than the existence of RAMPZ to determine if far FLASH pointers are needed
|
||||||
|
* - Error status LEDs shown when device endpoint configuration fails to complete
|
||||||
|
* - MIDI device demo no longer blocks if a note change event is sent while the endpoint is not ready
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* \section Sec_ChangeLog090605 Version 090605
|
* \section Sec_ChangeLog090605 Version 090605
|
||||||
|
|
Loading…
Reference in New Issue