X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/7f9f97c792dee6875fbca9806422bdd7d6c5a657..d03d6513d0d24cf63225c8d3dfa07675d9107f40:/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c diff --git a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c index bf39420ee..0e7e57982 100644 --- a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c +++ b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c @@ -115,9 +115,8 @@ int main(void) break; } - LEDs_SetAllLEDs(LEDS_NO_LEDS); - printf("Joystick Enumerated.\r\n"); + LEDs_SetAllLEDs(LEDMASK_USB_READY); USB_HostState = HOST_STATE_Configured; break; case HOST_STATE_Configured: @@ -132,15 +131,14 @@ int main(void) { HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber]; + /* Update the report item value if it is contained within the current report */ + if (!(USB_GetHIDReportItemInfo(JoystickReport, ReportItem))) + continue; + + /* Determine what report item is being tested, process updated value as needed */ if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) && (ReportItem->ItemType == REPORT_ITEM_TYPE_In)) { - /* Get the joystick button value if it is contained within the current report, if not, - * skip to the next item in the parser list - */ - if (!(USB_GetHIDReportItemInfo(JoystickReport, ReportItem))) - continue; - if (ReportItem->Value) LEDMask = LEDS_ALL_LEDS; } @@ -149,12 +147,6 @@ int main(void) (ReportItem->Attributes.Usage.Usage == USAGE_Y)) && (ReportItem->ItemType == REPORT_ITEM_TYPE_In)) { - /* Get the joystick relative position value if it is contained within the current - * report, if not, skip to the next item in the parser list - */ - if (!(USB_GetHIDReportItemInfo(JoystickReport, ReportItem))) - continue; - int16_t DeltaMovement = (int16_t)(ReportItem->Value << (16 - ReportItem->Attributes.BitSize)); if (ReportItem->Attributes.Usage.Usage == USAGE_X)