Fixed CDCHost demo unfreezing IN pipes during configuration, rather than during use.
[pub/USBasp.git] / Demos / Host / LowLevel / CDCHost / CDCHost.c
index e00332f..b3e0674 100644 (file)
@@ -176,10 +176,14 @@ void CDC_Host_Task(void)
                case HOST_STATE_Ready:\r
                        /* Select and the data IN pipe */\r
                        Pipe_SelectPipe(CDC_DATAPIPE_IN);\r
                case HOST_STATE_Ready:\r
                        /* Select and the data IN pipe */\r
                        Pipe_SelectPipe(CDC_DATAPIPE_IN);\r
+                       Pipe_Unfreeze();\r
 \r
                        /* Check to see if a packet has been received */\r
                        if (Pipe_IsINReceived())\r
                        {\r
 \r
                        /* Check to see if a packet has been received */\r
                        if (Pipe_IsINReceived())\r
                        {\r
+                               /* Re-freeze IN pipe after the packet has been received */\r
+                               Pipe_Freeze();\r
+\r
                                /* Check if data is in the pipe */\r
                                if (Pipe_IsReadWriteAllowed())\r
                                {\r
                                /* Check if data is in the pipe */\r
                                if (Pipe_IsReadWriteAllowed())\r
                                {\r
@@ -199,6 +203,9 @@ void CDC_Host_Task(void)
                                Pipe_ClearIN();\r
                        }\r
 \r
                                Pipe_ClearIN();\r
                        }\r
 \r
+                       /* Re-freeze IN pipe after use */\r
+                       Pipe_Freeze();\r
+\r
                        /* Select and unfreeze the notification pipe */\r
                        Pipe_SelectPipe(CDC_NOTIFICATIONPIPE);\r
                        Pipe_Unfreeze();\r
                        /* Select and unfreeze the notification pipe */\r
                        Pipe_SelectPipe(CDC_NOTIFICATIONPIPE);\r
                        Pipe_Unfreeze();\r