Corrections to Keyboard and Mouse combined demos so that all modes (normal, interrupt...
[pub/USBasp.git] / Demos / Mouse / Mouse.c
index b61850a..c4b7f55 100644 (file)
@@ -113,9 +113,11 @@ int main(void)
  */\r
 EVENT_HANDLER(USB_Connect)\r
 {\r
+       #if !defined(INTERRUPT_CONTROL_ENDPOINT)\r
        /* Start USB management task */\r
        Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);\r
-\r
+       #endif\r
+       \r
        /* Indicate USB enumerating */\r
        UpdateStatus(Status_USBEnumerating);\r
 \r
@@ -307,15 +309,10 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
 /** Fills the given HID report data structure with the next HID report to send to the host.\r
  *\r
  *  \param ReportData  Pointer to a HID report data structure to be filled\r
- *\r
- *  \return Boolean true if the new report differs from the last report, false otherwise\r
  */\r
-bool CreateMouseReport(USB_MouseReport_Data_t* ReportData)\r
+void CreateMouseReport(USB_MouseReport_Data_t* ReportData)\r
 {\r
-       static uint8_t PrevJoyStatus = 0;\r
-       static bool    PrevHWBStatus = false;\r
-       uint8_t        JoyStatus_LCL = Joystick_GetStatus();\r
-       bool           InputChanged  = false;\r
+       uint8_t JoyStatus_LCL = Joystick_GetStatus();\r
        \r
        /* Clear the report contents */\r
        memset(ReportData, 0, sizeof(USB_MouseReport_Data_t));\r
@@ -335,16 +332,6 @@ bool CreateMouseReport(USB_MouseReport_Data_t* ReportData)
          \r
        if (HWB_GetStatus())\r
          ReportData->Button |= (1 << 1);\r
-\r
-       /* Check if the new report is different to the previous report */\r
-       InputChanged = ((uint8_t)(PrevJoyStatus ^ JoyStatus_LCL) | (uint8_t)(HWB_GetStatus() ^ PrevHWBStatus));\r
-\r
-       /* Save the current joystick and HWB status for later comparison */\r
-       PrevJoyStatus = JoyStatus_LCL;\r
-       PrevHWBStatus = HWB_GetStatus();\r
-\r
-       /* Return whether the new report is different to the previous report or not */\r
-       return InputChanged;\r
 }\r
 \r
 /** Sends the next HID report to the host, via the keyboard data endpoint. */\r