Add StillImage Host Class Driver functions for opening and closing sessions. Ensure...
[pub/USBasp.git] / Demos / Host / ClassDriver / StillImageHost / StillImageHost.c
index deb8a55..d60db09 100644 (file)
@@ -50,7 +50,6 @@ USB_ClassInfo_SI_Host_t DigitalCamera_SI_Interface =
                        },\r
        };\r
 \r
-       \r
 /** Main program entry point. This routine configures the hardware required by the application, then\r
  *  starts the scheduler to run the application tasks.\r
  */\r
@@ -102,7 +101,28 @@ int main(void)
                                USB_HostState = HOST_STATE_Configured;\r
                                break;\r
                        case HOST_STATE_Configured:\r
+                               printf("Opening Session...\r\n");\r
+                               \r
+                               if (SImage_Host_OpenSession(&DigitalCamera_SI_Interface) != PIPE_RWSTREAM_NoError)\r
+                               {\r
+                                       printf("Could not open PIMA session.\r\n");\r
+                                       USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
+                                       break;\r
+                               }\r
+\r
+                               printf("Closing Session...\r\n");\r
+\r
+                               if (SImage_Host_CloseSession(&DigitalCamera_SI_Interface) != PIPE_RWSTREAM_NoError)\r
+                               {\r
+                                       printf("Could not close PIMA session.\r\n");\r
+                                       USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
+                                       break;\r
+                               }\r
+                               \r
+                               printf("Device Idle.\r\n");\r
                        \r
+                               LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+                               USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
                                break;\r
                }\r
        \r