Fixed GenericHIDHost demo report write routine incorrect for control type requests...
[pub/lufa.git] / Demos / Host / CDCHost / CDCHost.c
index 9ecf060..80d9939 100644 (file)
  \r
 #include "CDCHost.h"\r
 \r
-/* Project Tags, for reading out using the ButtLoad project */\r
-BUTTLOADTAG(ProjName,    "LUFA CDC Host 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
@@ -244,33 +238,37 @@ TASK(USB_CDC_Host)
                        /* Select and the data IN pipe */\r
                        Pipe_SelectPipe(CDC_DATAPIPE_IN);\r
 \r
-                       /* Check if data is in the pipe */\r
-                       if (Pipe_ReadWriteAllowed())\r
+                       /* Check to see if a packet has been received */\r
+                       if (Pipe_IsINReceived())\r
                        {\r
-                               /* Get the length of the pipe data, and create a new buffer to hold it */\r
-                               uint16_t BufferLength = Pipe_BytesInPipe();\r
-                               uint8_t Buffer[BufferLength];\r
-                               \r
-                               /* Read in the pipe data to the temporary buffer */\r
-                               Pipe_Read_Stream_LE(Buffer, BufferLength);\r
-                               \r
+                               /* Check if data is in the pipe */\r
+                               if (Pipe_IsReadWriteAllowed())\r
+                               {\r
+                                       /* Get the length of the pipe data, and create a new buffer to hold it */\r
+                                       uint16_t BufferLength = Pipe_BytesInPipe();\r
+                                       uint8_t Buffer[BufferLength];\r
+                                       \r
+                                       /* Read in the pipe data to the temporary buffer */\r
+                                       Pipe_Read_Stream_LE(Buffer, BufferLength);\r
+                                                                       \r
+                                       /* Print out the buffer contents to the USART */\r
+                                       for (uint16_t BufferByte = 0; BufferByte < BufferLength; BufferByte++)\r
+                                         putchar(Buffer[BufferByte]);\r
+                               }\r
+\r
                                /* Clear the pipe after it is read, ready for the next packet */\r
-                               Pipe_ClearCurrentBank();\r
-                               \r
-                               /* Print out the buffer contents to the USART */\r
-                               for (uint16_t BufferByte = 0; BufferByte < BufferLength; BufferByte++)\r
-                                 putchar(Buffer[BufferByte]);\r
+                               Pipe_ClearIN();\r
                        }\r
 \r
                        /* Select and unfreeze the notification pipe */\r
                        Pipe_SelectPipe(CDC_NOTIFICATIONPIPE);\r
                        Pipe_Unfreeze();\r
                        \r
-                       /* Check if data is in the pipe */\r
-                       if (Pipe_ReadWriteAllowed())\r
+                       /* Check if a packet has been received */\r
+                       if (Pipe_IsINReceived())\r
                        {\r
                                /* Discard the event notification */\r
-                               Pipe_ClearCurrentBank();\r
+                               Pipe_ClearIN();\r
                        }\r
                        \r
                        /* Freeze notification IN pipe after use */\r