From acf5c24e03de08333bdc4bfdaa4023fe3e32cd02 Mon Sep 17 00:00:00 2001 From: Jonathan McCrohan Date: Tue, 4 Dec 2012 01:41:09 +0000 Subject: phidgetcontrol: Allow single device operation Brown paper bag commit. --- src/phidgetcontrol.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/phidgetcontrol.c b/src/phidgetcontrol.c index 7d9138e..23d6205 100644 --- a/src/phidgetcontrol.c +++ b/src/phidgetcontrol.c @@ -164,22 +164,31 @@ main (int argc, char *argv[]) // connect to Analog object CPhidget_open ((CPhidgetHandle) Aphid, -1); - // phidget interfacekit handle timeout - if ((result = CPhidget_waitForAttachment ((CPhidgetHandle) IKphid, 5000))) + // check if we should have a phidgetinterfacekit connected + if (setup_phidgetinterfacekit) { - CPhidget_getErrorDescription (result, &err); - printf ("PHIDGET: Problem waiting for attachment: %s\n", err); - return -1; + // phidget interfacekit handle timeout + if ((result = + CPhidget_waitForAttachment ((CPhidgetHandle) IKphid, 5000))) + { + CPhidget_getErrorDescription (result, &err); + printf ("PHIDGET: Problem waiting for attachment: %s\n", err); + return -1; + } } - // phidget analog handle timeout - if ((result = CPhidget_waitForAttachment ((CPhidgetHandle) Aphid, 5000))) + // check if we should have a phidgetanalog connected + if (setup_phidgetanalog) { - CPhidget_getErrorDescription (result, &err); - printf ("PHIDGET: Problem waiting for attachment: %s\n", err); - return -1; + // phidget analog handle timeout + if ((result = + CPhidget_waitForAttachment ((CPhidgetHandle) Aphid, 5000))) + { + CPhidget_getErrorDescription (result, &err); + printf ("PHIDGET: Problem waiting for attachment: %s\n", err); + return -1; + } } - // set digital outputs low on program startup for (i = 0; i < numInterfaceKitSensors; i++) { -- cgit v1.2.3