Fixed GenericHIDHost demo report write routine incorrect for control type requests...
[pub/USBasp.git] / Demos / Device / Joystick / Joystick.c
index cd88227..c5d90e7 100644 (file)
 \r
 #include "Joystick.h"\r
 \r
-/* Project Tags, for reading out using the ButtLoad project */\r
-BUTTLOADTAG(ProjName,    "LUFA Joystick App");\r
-BUTTLOADTAG(BuildTime,   __TIME__);\r
-BUTTLOADTAG(BuildDate,   __DATE__);\r
-BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);\r
-\r
 /* Scheduler Task List */\r
 TASK_LIST\r
 {\r
@@ -151,13 +145,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
                                if (wLength > sizeof(JoystickReportData))\r
                                  wLength = sizeof(JoystickReportData);\r
 \r
-                               Endpoint_ClearSetupReceived();\r
+                               Endpoint_ClearControlSETUP();\r
        \r
                                /* Write the report data to the control endpoint */\r
                                Endpoint_Write_Control_Stream_LE(&JoystickReportData, wLength);\r
                                \r
                                /* Finalize the stream transfer to send the last packet or clear the host abort */\r
-                               Endpoint_ClearSetupOUT();\r
+                               Endpoint_ClearControlOUT();\r
                        }\r
                \r
                        break;\r
@@ -241,8 +235,8 @@ TASK(USB_Joystick_Report)
                /* Select the Joystick Report Endpoint */\r
                Endpoint_SelectEndpoint(JOYSTICK_EPNUM);\r
 \r
-               /* Check if Joystick Endpoint Ready for Read/Write */\r
-               if (Endpoint_ReadWriteAllowed())\r
+               /* Check to see if the host is ready for another packet */\r
+               if (Endpoint_IsINReady())\r
                {\r
                        USB_JoystickReport_Data_t JoystickReportData;\r
                        \r
@@ -253,12 +247,10 @@ TASK(USB_Joystick_Report)
                        Endpoint_Write_Stream_LE(&JoystickReportData, sizeof(JoystickReportData));\r
 \r
                        /* Finalize the stream transfer to send the last packet */\r
-                       Endpoint_ClearCurrentBank();\r
+                       Endpoint_ClearIN();\r
                        \r
                        /* Clear the report data afterwards */\r
-                       JoystickReportData.X      = 0;\r
-                       JoystickReportData.Y      = 0;\r
-                       JoystickReportData.Button = 0;\r
+                       memset(&JoystickReportData, 0, sizeof(JoystickReportData));\r
                }\r
        }\r
 }\r