Fixed GenericHIDHost demo report write routine incorrect for control type requests...
[pub/USBasp.git] / Demos / Device / KeyboardMouse / KeyboardMouse.c
index 3ee101b..71e23ab 100644 (file)
  \r
 #include "KeyboardMouse.h"\r
 \r
-/* Project Tags, for reading out using the ButtLoad project */\r
-BUTTLOADTAG(ProjName,    "LUFA MouseKBD 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
@@ -150,7 +144,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
                case REQ_GetReport:\r
                        if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))\r
                        {\r
-                               Endpoint_Ignore_Word();\r
+                               Endpoint_Discard_Word();\r
                        \r
                                uint16_t wIndex = Endpoint_Read_Word_LE();\r
                                \r
@@ -173,7 +167,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
                                if (wLength > ReportSize)\r
                                  wLength = ReportSize;\r
 \r
-                               Endpoint_ClearSetupReceived();\r
+                               Endpoint_ClearControlSETUP();\r
        \r
                                /* Write the report data to the control endpoint */\r
                                Endpoint_Write_Control_Stream_LE(ReportData, wLength);\r
@@ -182,17 +176,17 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
                                memset(ReportData, 0, ReportSize);\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
                case REQ_SetReport:\r
                        if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))\r
                        {\r
-                               Endpoint_ClearSetupReceived();\r
+                               Endpoint_ClearControlSETUP();\r
                                \r
                                /* Wait until the LED report has been sent by the host */\r
-                               while (!(Endpoint_IsSetupOUTReceived()));\r
+                               while (!(Endpoint_IsOUTReceived()));\r
 \r
                                /* Read in the LED report from the host */\r
                                uint8_t LEDStatus = Endpoint_Read_Byte();\r
@@ -211,11 +205,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
                                LEDs_SetAllLEDs(LEDMask);\r
 \r
                                /* Clear the endpoint data */\r
-                               Endpoint_ClearSetupOUT();\r
+                               Endpoint_ClearControlOUT();\r
 \r
                                /* Acknowledge status stage */\r
-                               while (!(Endpoint_IsSetupINReady()));\r
-                               Endpoint_ClearSetupIN();\r
+                               while (!(Endpoint_IsINReady()));\r
+                               Endpoint_ClearControlIN();\r
                        }\r
                        \r
                        break;\r
@@ -281,13 +275,13 @@ TASK(USB_Keyboard)
                Endpoint_SelectEndpoint(KEYBOARD_IN_EPNUM);\r
 \r
                /* Check if Keyboard Endpoint Ready for Read/Write */\r
-               if (Endpoint_ReadWriteAllowed())\r
+               if (Endpoint_IsReadWriteAllowed())\r
                {\r
                        /* Write Keyboard Report Data */\r
                        Endpoint_Write_Stream_LE(&KeyboardReportData, sizeof(KeyboardReportData));\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
                        memset(&KeyboardReportData, 0, sizeof(KeyboardReportData));\r
@@ -297,7 +291,7 @@ TASK(USB_Keyboard)
                Endpoint_SelectEndpoint(KEYBOARD_OUT_EPNUM);\r
 \r
                /* Check if Keyboard LED Endpoint Ready for Read/Write */\r
-               if (Endpoint_ReadWriteAllowed())\r
+               if (Endpoint_IsReadWriteAllowed())\r
                {               \r
                        /* Read in the LED report from the host */\r
                        uint8_t LEDStatus = Endpoint_Read_Byte();\r
@@ -316,7 +310,7 @@ TASK(USB_Keyboard)
                        LEDs_SetAllLEDs(LEDMask);\r
 \r
                        /* Handshake the OUT Endpoint - clear endpoint and ready for next report */\r
-                       Endpoint_ClearCurrentBank();\r
+                       Endpoint_ClearOUT();\r
                }\r
        }\r
 }\r
@@ -352,13 +346,13 @@ TASK(USB_Mouse)
                Endpoint_SelectEndpoint(MOUSE_IN_EPNUM);\r
 \r
                /* Check if Mouse Endpoint Ready for Read/Write */\r
-               if (Endpoint_ReadWriteAllowed())\r
+               if (Endpoint_IsReadWriteAllowed())\r
                {\r
                        /* Write Mouse Report Data */\r
                        Endpoint_Write_Stream_LE(&MouseReportData, sizeof(MouseReportData));\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
                        memset(&MouseReportData, 0, sizeof(MouseReportData));\r