Update of /cvsroot/libphidget/libphidget/src/examples
In directory sc8-pr-cvs1:/tmp/cvs-serv6412/examples
Modified Files:
phidget_c.c
Log Message:
Initial support for the Text LCD phidget. Made the C example program work with all supported phidgets.
Index: phidget_c.c
===================================================================
RCS file: /cvsroot/libphidget/libphidget/src/examples/phidget_c.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** phidget_c.c 13 Dec 2002 22:10:26 -0000 1.11
--- phidget_c.c 14 Dec 2002 04:34:35 -0000 1.12
***************
*** 22,28 ****
struct phidget **phidgets;
- printf ("----------------------------------------\n");
- printf ("Phidgets Device driver test.\n\n\n");
-
// Initialize libphiget, here is where the devices are actually retrieved by the library
// We want the library to handle signals (passing it 1)
--- 22,25 ----
***************
*** 41,45 ****
}
! printf ("Device count:%d\n", count);
for (t = 0; t < count; t++)
--- 38,90 ----
}
!
! if (argn==1)
! {
! for (t=0;t<count;t++)
! {
! // Open this phidget
! struct phidget *dev = phidgetOpen (phidgets[t]);
!
! // Print out some information about this phidget
! printf("\n");
! printf(" Vendor Product\n");
! printf("Phidget Name ID ID Serial#\n");
! printf("-------------------------------- ------ ------- -------\n");
! printf ("%32s 0x0%x 0x0%x %06d\n",
! phidgetTypeName (phidgetType (dev)),
! phidgetTypeVendorID (phidgetType (dev)),
! phidgetTypeProductID (phidgetType (dev)), phidgetSerial (dev));
!
! printf("\n\n");
! printf("Must specify a test to run:\n");
! printf(" SERVO1 - test any single servo phidget\n");
! printf(" SERVO4 - test any quad servo phidget\n");
! printf(" SERVO8 - test any 8-way servo phidget\n");
! printf(" IK488 - test 488 interface kit\n");
! printf(" IK880 - test 880 interface kit\n");
! printf(" TEXTLCD - test text lcd\n");
!
!
! phidgetClose(dev);
! }
! printf ("\nTotal attached phidgets:%d\n\n", count);
!
! return(0);
! }
!
! int SERVO=0;
! int IK488=0;
! int IK880=0;
! int TEXTLCD=0;
! if (argn==2)
! {
! if (strcmp(argv[1],"SERVO1")==0) SERVO=1;
! if (strcmp(argv[1],"SERVO4")==0) SERVO=1;
! if (strcmp(argv[1],"SERVO8")==0) SERVO=1;
! if (strcmp(argv[1],"IK488")==0) IK488=1;
! if (strcmp(argv[1],"IK880")==0) IK880=1;
! if (strcmp(argv[1],"TEXTLCD")==0) TEXTLCD=1;
!
! }
for (t = 0; t < count; t++)
***************
*** 56,65 ****
}
- // Print out some information about this phidget
- printf ("Phidget Name:%s Vendor:0x0%x Product:0x0%x Serial#:%06d\n",
- phidgetTypeName (phidgetType (dev)),
- phidgetTypeVendorID (phidgetType (dev)),
- phidgetTypeProductID (phidgetType (dev)), phidgetSerial (dev));
-
if (phidgetLastError()<0)
{
--- 101,104 ----
***************
*** 68,73 ****
}
-
// Is it a servo controller
if (phidgetTypeDeviceClass (phidgetType (dev)) == LP_SERVO_CONTROLLER)
{
--- 107,119 ----
}
// Is it a servo controller
+ if (TEXTLCD)
+ if (phidgetTypeDeviceClass (phidgetType (dev)) == LP_TEXT_LCD)
+ {
+ // Close that phidget
+ phidgetTextLCDWrite(dev, 1, 0,"Test ");
+ }
+
+ if (SERVO)
if (phidgetTypeDeviceClass (phidgetType (dev)) == LP_SERVO_CONTROLLER)
{
***************
*** 92,96 ****
}
}
! else
if (phidgetTypeDeviceClass (phidgetType (dev)) == LP_INTERFACE_KIT_488)
{
--- 138,143 ----
}
}
!
! if (IK488)
if (phidgetTypeDeviceClass (phidgetType (dev)) == LP_INTERFACE_KIT_488)
{
***************
*** 124,128 ****
}
}
! else
if (phidgetTypeDeviceClass (phidgetType (dev)) == LP_INTERFACE_KIT_880)
{
--- 171,176 ----
}
}
!
! if (IK880)
if (phidgetTypeDeviceClass (phidgetType (dev)) == LP_INTERFACE_KIT_880)
{
|