Fixed incorrect ADC driver init register manipulation (thanks to Tobias).
[pub/USBasp.git] / Projects / Magstripe / Magstripe.c
index 2826c14..aef7812 100644 (file)
@@ -204,6 +204,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
                                \r
                                /* Send the flag to the host */\r
                                Endpoint_ClearSetupIN();\r
+\r
+                               /* Acknowledge status stage */\r
+                               while (!(Endpoint_IsSetupOUTReceived()));\r
+                               Endpoint_ClearSetupOUT();\r
                        }\r
                        \r
                        break;\r
@@ -218,7 +222,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
                                /* Set or clear the flag depending on what the host indicates that the current Protocol should be */\r
                                UsingReportProtocol = (wValue != 0x0000);\r
                                \r
-                               /* Send an empty packet to acknowedge the command */\r
+                               /* Acknowledge status stage */\r
+                               while (!(Endpoint_IsSetupINReady()));\r
                                Endpoint_ClearSetupIN();\r
                        }\r
                        \r
@@ -234,7 +239,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
                                /* Get idle period in MSB */\r
                                IdleCount = (wValue >> 8);\r
                                \r
-                               /* Send an empty packet to acknowedge the command */\r
+                               /* Acknowledge status stage */\r
+                               while (!(Endpoint_IsSetupINReady()));\r
                                Endpoint_ClearSetupIN();\r
                        }\r
                        \r
@@ -249,6 +255,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
                                \r
                                /* Send the flag to the host */\r
                                Endpoint_ClearSetupIN();\r
+\r
+                               /* Acknowledge status stage */\r
+                               while (!(Endpoint_IsSetupOUTReceived()));\r
+                               Endpoint_ClearSetupOUT();\r
                        }\r
 \r
                        break;\r
@@ -306,13 +316,13 @@ bool GetNextReport(USB_KeyboardReport_Data_t* ReportData)
                if (OddReport)\r
                {\r
                        /* Set the report key code to the key code for the next data bit */\r
-                       ReportData->KeyCode[0] = BitBuffer_GetNextBit(Buffer) ? KEY_1 : KEY_0;\r
+                       ReportData->KeyCode = BitBuffer_GetNextBit(Buffer) ? KEY_1 : KEY_0;\r
                        \r
                        /* If buffer is now empty, a new line must be sent instead of the terminating bit */\r
                        if (!(Buffer->Elements))\r
                        {\r
                                /* Set the keycode to the code for an enter key press */\r
-                               ReportData->KeyCode[0] = KEY_ENTER;                             \r
+                               ReportData->KeyCode = KEY_ENTER;                                \r
                        }\r
                }\r
 \r