Fixed GenericHIDHost demo report write routine incorrect for control type requests...
[pub/USBasp.git] / Bootloaders / TeensyHID / TeensyHID.c
index 93f0621..f82e28e 100644 (file)
@@ -101,10 +101,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
                case REQ_SetReport:\r
                        if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))\r
                        {\r
-                               Endpoint_ClearSetupReceived();\r
+                               Endpoint_ClearControlSETUP();\r
                                \r
                                /* Wait until the command (report) has been sent by the host */\r
-                               while (!(Endpoint_IsSetupOUTReceived()));\r
+                               while (!(Endpoint_IsOUTReceived()));\r
 \r
                                /* Read in the write destination address */\r
                                uint16_t PageAddress = Endpoint_Read_Word_LE();\r
@@ -126,8 +126,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
                                                /* Check if endpoint is empty - if so clear it and wait until ready for next packet */\r
                                                if (!(Endpoint_BytesInEndpoint()))\r
                                                {\r
-                                                       Endpoint_ClearSetupOUT();\r
-                                                       while (!(Endpoint_IsSetupOUTReceived()));\r
+                                                       Endpoint_ClearControlOUT();\r
+                                                       while (!(Endpoint_IsOUTReceived()));\r
                                                }\r
 \r
                                                /* Write the next data word to the FLASH page */\r
@@ -142,11 +142,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
                                        boot_rww_enable();\r
                                }\r
 \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