*/
void EVENT_USB_Device_ConfigurationChanged(void)
{
- /* Indicate USB connected and ready */
- LEDs_SetAllLEDs(LEDMASK_USB_READY);
+ bool ConfigSuccess = true;
- /* 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);
- }
+ /* Setup HID Report Endpoint */
+ ConfigSuccess &= Endpoint_ConfigureEndpoint(JOYSTICK_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
+ JOYSTICK_EPSIZE, ENDPOINT_BANK_SINGLE);
+
+ /* Indicate endpoint configuration success or failure */
+ LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
}
/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
{
USB_JoystickReport_Data_t JoystickReportData;
- Endpoint_ClearSETUP();
-
/* Create the next HID report to send to the host */
GetNextReport(&JoystickReportData);
-
+
+ Endpoint_ClearSETUP();
+
/* Write the report data to the control endpoint */
Endpoint_Write_Control_Stream_LE(&JoystickReportData, sizeof(JoystickReportData));
-
- /* Finalize the stream transfer to send the last packet or clear the host abort */
Endpoint_ClearOUT();
}
*
* \return Boolean true if the new report differs from the last report, false otherwise
*/
-bool GetNextReport(USB_JoystickReport_Data_t* ReportData)
+bool GetNextReport(USB_JoystickReport_Data_t* const ReportData)
{
static uint8_t PrevJoyStatus = 0;
static uint8_t PrevButtonStatus = 0;