Ooops - TeensyHID bootloader makefile should use a 16MHz FCPU, not 8MHz.
[pub/USBasp.git] / Demos / Device / LowLevel / Mouse / Mouse.c
index 2f7a63f..ff54c65 100644 (file)
@@ -238,10 +238,10 @@ void CreateMouseReport(USB_MouseReport_Data_t* ReportData)
        else if (JoyStatus_LCL & JOY_DOWN)\r
          ReportData->Y =  1;\r
 \r
-       if (JoyStatus_LCL & JOY_RIGHT)\r
-         ReportData->X =  1;\r
-       else if (JoyStatus_LCL & JOY_LEFT)\r
+       if (JoyStatus_LCL & JOY_LEFT)\r
          ReportData->X = -1;\r
+       else if (JoyStatus_LCL & JOY_RIGHT)\r
+         ReportData->X = 1;\r
 \r
        if (JoyStatus_LCL & JOY_PRESS)\r
          ReportData->Button  = (1 << 0);\r
@@ -268,9 +268,6 @@ void SendNextReport(void)
        if ((MouseReportData.Y != 0) || (MouseReportData.X != 0))\r
          SendReport = true;\r
        \r
-       /* Save the current report data for later comparison to check for changes */\r
-       PrevMouseReportData = MouseReportData;\r
-       \r
        /* Check if the idle period is set and has elapsed */\r
        if ((IdleCount != HID_IDLE_CHANGESONLY) && (!(IdleMSRemaining)))\r
        {\r
@@ -286,7 +283,10 @@ void SendNextReport(void)
 \r
        /* Check if Mouse Endpoint Ready for Read/Write and if we should send a new report */\r
        if (Endpoint_IsReadWriteAllowed() && SendReport)\r
-       {\r
+       {       \r
+               /* Save the current report data for later comparison to check for changes */\r
+               PrevMouseReportData = MouseReportData;\r
+\r
                /* Write Mouse Report Data */\r
                Endpoint_Write_Stream_LE(&MouseReportData, sizeof(MouseReportData));\r
                \r