X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/73d9fafc0fe42741ad8f609dd4762e2bc14cbd01..1e8df8951a3335e4b45ad0c25a82df3d90d785f3:/Demos/Device/Incomplete/Sideshow/Sideshow.c diff --git a/Demos/Device/Incomplete/Sideshow/Sideshow.c b/Demos/Device/Incomplete/Sideshow/Sideshow.c index 41e36cc70..fdf4265e6 100644 --- a/Demos/Device/Incomplete/Sideshow/Sideshow.c +++ b/Demos/Device/Incomplete/Sideshow/Sideshow.c @@ -82,17 +82,17 @@ void SetupHardware(void) SerialStream_Init(9600, false); } -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); } -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); } -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -112,7 +112,7 @@ void EVENT_USB_ConfigurationChanged(void) } } -void EVENT_USB_UnhandledControlPacket(void) +void EVENT_USB_Device_UnhandledControlRequest(void) { /* Process UFI specific control requests */ switch (USB_ControlRequest.bRequest) @@ -141,17 +141,17 @@ void EVENT_USB_UnhandledControlPacket(void) void SideShow_Task(void) { - /* Check if the USB System is connected to a Host */ - if (USB_IsConnected) + /* Device must be connected and configured for the task to run */ + if (USB_DeviceState != DEVICE_STATE_Configured) + return; + + /* Select the SideShow data out endpoint */ + Endpoint_SelectEndpoint(SIDESHOW_OUT_EPNUM); + + /* Check to see if a new SideShow message has been received */ + if (Endpoint_IsReadWriteAllowed()) { - /* Select the SideShow data out endpoint */ - Endpoint_SelectEndpoint(SIDESHOW_OUT_EPNUM); - - /* Check to see if a new SideShow message has been received */ - if (Endpoint_IsReadWriteAllowed()) - { - /* Process the received SideShow message */ - Sideshow_ProcessCommandPacket(); - } + /* Process the received SideShow message */ + Sideshow_ProcessCommandPacket(); } }