Fix redefinition warning when USB_DEVICE_ONLY is set on an AVR which does not support...
[pub/USBasp.git] / Demos / Device / Incomplete / Sideshow / Sideshow.c
index 8454f9d..d67fae0 100644 (file)
@@ -131,7 +131,7 @@ void EVENT_USB_UnhandledControlPacket(void)
                                \r
                                Endpoint_ClearSETUP();\r
                                \r
-                               Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize);\r
+                               Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize);\r
                                Endpoint_ClearOUT();                            \r
                        }\r
 \r
@@ -141,17 +141,17 @@ void EVENT_USB_UnhandledControlPacket(void)
        \r
 void SideShow_Task(void)\r
 {\r
-       /* Check if the USB System is connected to a Host */\r
-       if (USB_IsConnected)\r
+       /* Device must be connected and configured for the task to run */\r
+       if (USB_DeviceState != DEVICE_STATE_Configured)\r
+         return;\r
+\r
+       /* Select the SideShow data out endpoint */\r
+       Endpoint_SelectEndpoint(SIDESHOW_OUT_EPNUM);\r
+       \r
+       /* Check to see if a new SideShow message has been received */\r
+       if (Endpoint_IsReadWriteAllowed())\r
        {\r
-               /* Select the SideShow data out endpoint */\r
-               Endpoint_SelectEndpoint(SIDESHOW_OUT_EPNUM);\r
-               \r
-               /* Check to see if a new SideShow message has been received */\r
-               if (Endpoint_IsReadWriteAllowed())\r
-               {\r
-                       /* Process the received SideShow message */\r
-                       Sideshow_ProcessCommandPacket();\r
-               }\r
+               /* Process the received SideShow message */\r
+               Sideshow_ProcessCommandPacket();\r
        }\r
 }\r