*/\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
+ #endif\r
+\r
/* Indicate USB enumerating */\r
UpdateStatus(Status_USBEnumerating);\r
\r
/** 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 CreateKeyboardReport(USB_KeyboardReport_Data_t* ReportData)\r
+void CreateKeyboardReport(USB_KeyboardReport_Data_t* ReportData)\r
{\r
- static uint8_t PrevJoyStatus = 0;\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_KeyboardReport_Data_t));\r
\r
if (JoyStatus_LCL & JOY_PRESS)\r
ReportData->KeyCode[0] = 0x08; // E\r
- \r
- /* Check if the new report is different to the previous report */\r
- InputChanged = (uint8_t)(PrevJoyStatus ^ JoyStatus_LCL);\r
-\r
- /* Save the current joystick status for later comparison */\r
- PrevJoyStatus = JoyStatus_LCL;\r
-\r
- /* Return whether the new report is different to the previous report or not */\r
- return InputChanged;\r
}\r
\r
/** Processes a received LED report, and updates the board LEDs states to match.\r
static inline void SendNextReport(void)\r
{\r
USB_KeyboardReport_Data_t KeyboardReportData;\r
- bool SendReport;\r
+ bool SendReport = true;\r
\r
/* Create the next keyboard report for transmission to the host */\r
- SendReport = CreateKeyboardReport(&KeyboardReportData);\r
+ CreateKeyboardReport(&KeyboardReportData);\r
\r
- /* Check if the idle period is set and has elapsed */\r
- if (IdleCount && !(IdleMSRemaining))\r
+ /* Check if the idle period is set */\r
+ if (IdleCount)\r
{\r
- /* Idle period elapsed, indicate that a report must be sent */\r
- SendReport = true;\r
- \r
- /* Reset the idle time remaining counter, must multiply by 4 to get the duration in milliseconds */\r
- IdleMSRemaining = (IdleCount << 2);\r
+ /* Check if idle period has elapsed */\r
+ if (!(IdleMSRemaining))\r
+ {\r
+ /* Reset the idle time remaining counter, must multiply by 4 to get the duration in milliseconds */\r
+ IdleMSRemaining = (IdleCount << 2);\r
+ }\r
+ else\r
+ {\r
+ /* Idle period not elapsed, indicate that a report must not be sent */\r
+ SendReport = false; \r
+ }\r
}\r
\r
/* Select the Keyboard Report Endpoint */\r