Fix Webserver project code not compiling due to the changes to the USB mode selection...
[pub/USBasp.git] / Demos / Host / LowLevel / JoystickHostWithParser / JoystickHostWithParser.c
index 91bd288..c7739e9 100644 (file)
@@ -193,9 +193,9 @@ void Joystick_HID_Task(void)
                        {
                                HID_ReportSizeInfo_t* CurrReportIDInfo = &HIDReportInfo.ReportIDSizes[i];
                                
-                               uint8_t ReportSizeInBits      = CurrReportIDInfo->ReportSizeBits[REPORT_ITEM_TYPE_In];
-                               uint8_t ReportSizeOutBits     = CurrReportIDInfo->ReportSizeBits[REPORT_ITEM_TYPE_Out];
-                               uint8_t ReportSizeFeatureBits = CurrReportIDInfo->ReportSizeBits[REPORT_ITEM_TYPE_Feature];
+                               uint8_t ReportSizeInBits      = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_In];
+                               uint8_t ReportSizeOutBits     = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_Out];
+                               uint8_t ReportSizeFeatureBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_Feature];
 
                                /* Print out the byte sizes of each report within the device */
                                printf_P(PSTR("  + Report ID %d - In: %d bytes, Out: %d bytes, Feature: %d bytes\r\n"),
@@ -211,7 +211,7 @@ void Joystick_HID_Task(void)
                        break;
                case HOST_STATE_Configured:
                        /* Select and unfreeze joystick data pipe */
-                       Pipe_SelectPipe(JOYSTICK_DATAPIPE);     
+                       Pipe_SelectPipe(JOYSTICK_DATA_IN_PIPE); 
                        Pipe_Unfreeze();
                        
                        /* Check to see if a packet has been received */
@@ -258,7 +258,7 @@ void ProcessJoystickReport(uint8_t* JoystickReport)
                bool FoundData;
 
                if ((ReportItem->Attributes.Usage.Page        == USAGE_PAGE_BUTTON) &&
-                       (ReportItem->ItemType                     == REPORT_ITEM_TYPE_In))
+                       (ReportItem->ItemType                     == HID_REPORT_ITEM_In))
                {
                        /* Get the joystick button value */
                        FoundData = USB_GetHIDReportItemInfo(JoystickReport, ReportItem);
@@ -274,7 +274,7 @@ void ProcessJoystickReport(uint8_t* JoystickReport)
                else if ((ReportItem->Attributes.Usage.Page   == USAGE_PAGE_GENERIC_DCTRL) &&
                                 ((ReportItem->Attributes.Usage.Usage == USAGE_X)                  ||
                                  (ReportItem->Attributes.Usage.Usage == USAGE_Y))                 &&
-                                (ReportItem->ItemType                == REPORT_ITEM_TYPE_In))
+                                (ReportItem->ItemType                == HID_REPORT_ITEM_In))
                {
                        /* Get the joystick relative position value */
                        FoundData = USB_GetHIDReportItemInfo(JoystickReport, ReportItem);
@@ -285,17 +285,13 @@ void ProcessJoystickReport(uint8_t* JoystickReport)
                          
                        int16_t DeltaMovement = HID_ALIGN_DATA(ReportItem, int16_t);
                        
-                       /* Determine if the report is for the X or Y delta movement */
-                       if (ReportItem->Attributes.Usage.Usage == USAGE_X)
+                       /* Check to see if a (non-zero) delta movement has been indicated */
+                       if (DeltaMovement)
                        {
-                               /* Turn on the appropriate LED according to direction if the delta is non-zero */
-                               if (DeltaMovement)
+                               /* Determine if the report is for the X or Y delta movement, light LEDs as appropriate */
+                               if (ReportItem->Attributes.Usage.Usage == USAGE_X)
                                  LEDMask |= ((DeltaMovement > 0) ? LEDS_LED1 : LEDS_LED2);
-                       }
-                       else
-                       {
-                               /* Turn on the appropriate LED according to direction if the delta is non-zero */
-                               if (DeltaMovement)
+                               else
                                  LEDMask |= ((DeltaMovement > 0) ? LEDS_LED3 : LEDS_LED4);
                        }
                }