Set all CDC and MassStorage device mode demos (LowLevel and ClassDriver) to use the...
[pub/USBasp.git] / Demos / Host / LowLevel / MouseHostWithParser / MouseHostWithParser.c
index 42865e5..8ea5e72 100644 (file)
@@ -166,9 +166,6 @@ void Mouse_HID_Task(void)
                                break;\r
                        }\r
                        \r
-                       USB_HostState = HOST_STATE_Configured;\r
-                       break;\r
-               case HOST_STATE_Configured:\r
                        puts_P(PSTR("Processing HID Report.\r\n"));\r
 \r
                        /* Get and process the device's first HID report descriptor */\r
@@ -186,10 +183,10 @@ void Mouse_HID_Task(void)
                        }\r
 \r
                        puts_P(PSTR("Mouse Enumerated.\r\n"));\r
-                               \r
-                       USB_HostState = HOST_STATE_Ready;\r
+\r
+                       USB_HostState = HOST_STATE_Configured;\r
                        break;\r
-               case HOST_STATE_Ready:\r
+               case HOST_STATE_Configured:\r
                        /* Select and unfreeze mouse data pipe */\r
                        Pipe_SelectPipe(MOUSE_DATAPIPE);        \r
                        Pipe_Unfreeze();\r
@@ -263,12 +260,7 @@ void ProcessMouseReport(uint8_t* MouseReport)
                        if (!(FoundData))\r
                          continue;\r
                          \r
-                       int16_t DeltaMovement;\r
-                       \r
-                       if (ReportItem->Attributes.BitSize > 8)\r
-                         DeltaMovement = (int16_t)ReportItem->Value;\r
-                       else\r
-                         DeltaMovement = (int8_t)ReportItem->Value;\r
+                       int16_t DeltaMovement = (int16_t)(ReportItem->Value << (16 - ReportItem->Attributes.BitSize));\r
                        \r
                        /* Determine if the report is for the X or Y delta movement */\r
                        if (ReportItem->Attributes.Usage.Usage == USAGE_X)\r