[Libphidget-cvs-commits] CVS: libphidget/src/libphidget phidget.c,1.14,1.15 phidget.h,1.9,1.10
Status: Alpha
Brought to you by:
jstrohm
From: Jack S. <js...@us...> - 2002-12-13 22:05:20
|
Update of /cvsroot/libphidget/libphidget/src/libphidget In directory sc8-pr-cvs1:/tmp/cvs-serv7153/libphidget Modified Files: phidget.c phidget.h Log Message: Fixed some bugs and added a test for 088 phidget Index: phidget.c =================================================================== RCS file: /cvsroot/libphidget/libphidget/src/libphidget/phidget.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** phidget.c 13 Dec 2002 21:16:23 -0000 1.14 --- phidget.c 13 Dec 2002 22:05:16 -0000 1.15 *************** *** 901,907 **** _registerDeviceType("QuadServo .1 Degree", 0x06C2, 0x0038, LP_SERVO_CONTROLLER); _registerDeviceType("UniServo .1 Degree", 0x06C2, 0x0039, LP_SERVO_CONTROLLER); ! _registerDeviceType("Interface Kit 884", 0x0925, 0x8201, LP_INTERFACE_KIT); ! _registerDeviceType("Interface Kit 884", 0x06C2, 0x0040, LP_INTERFACE_KIT); ! _registerDeviceType("Interface Kit 088", 0x06C2, 0x0041, LP_INTERFACE_KIT); //_registerDeviceType("RFID VID/PID", 0x06C2, 0x0030, LP_OTHER); //_registerDeviceType("8-AdvancedServo", 0x06C2, 0x003B, LP_SERVO_CONTROLLER); --- 901,907 ---- _registerDeviceType("QuadServo .1 Degree", 0x06C2, 0x0038, LP_SERVO_CONTROLLER); _registerDeviceType("UniServo .1 Degree", 0x06C2, 0x0039, LP_SERVO_CONTROLLER); ! _registerDeviceType("Interface Kit 884", 0x0925, 0x8201, LP_INTERFACE_KIT_884); ! _registerDeviceType("Interface Kit 884", 0x06C2, 0x0040, LP_INTERFACE_KIT_884); ! _registerDeviceType("Interface Kit 088", 0x06C2, 0x0041, LP_INTERFACE_KIT_088); //_registerDeviceType("RFID VID/PID", 0x06C2, 0x0030, LP_OTHER); //_registerDeviceType("8-AdvancedServo", 0x06C2, 0x003B, LP_SERVO_CONTROLLER); *************** *** 1343,1347 **** // Free any defaults that have already been set if (phidgetDevice->defaultData != NULL) ! free(phidgetDevice); phidgetDevice->defaultDataSize = sizeof(buffer); --- 1343,1347 ---- // Free any defaults that have already been set if (phidgetDevice->defaultData != NULL) ! free(phidgetDevice); phidgetDevice->defaultDataSize = sizeof(buffer); *************** *** 1376,1383 **** * Helper function to read from an interface kit. */ ! enum ELPError phidgetInterfaceKit488Read(struct phidget *phidgetDevice, float analog[4], int digital[8]) { char buffer[7]; enum ELPError err=phidgetRead(phidgetDevice,buffer,sizeof(buffer)); if (err!=LPE_NONE) --- 1376,1387 ---- * Helper function to read from an interface kit. */ ! enum ELPError phidgetInterfaceKit884Read(struct phidget *phidgetDevice, float analog[4], int digital[8]) { char buffer[7]; + // Not correct type of interface kit + if (phidgetDevice->type->deviceClass != LP_INTERFACE_KIT_884) + return (_error(LPE_WRONG_PHIDGET_CLASS_TYPE)); + enum ELPError err=phidgetRead(phidgetDevice,buffer,sizeof(buffer)); if (err!=LPE_NONE) *************** *** 1404,1411 **** * Helper function to read from an interface kit. */ ! enum ELPError phidgetInterfaceKit880Read(struct phidget *phidgetDevice, float analog[8], int digital[8]) { int t=0; char buffer[7]; for (t=0;t<2;t++) --- 1408,1419 ---- * Helper function to read from an interface kit. */ ! enum ELPError phidgetInterfaceKit088Read(struct phidget *phidgetDevice, float analog[8], int digital[8]) { int t=0; char buffer[7]; + + // Not correct type of interface kit + if (phidgetDevice->type->deviceClass != LP_INTERFACE_KIT_088) + return (_error(LPE_WRONG_PHIDGET_CLASS_TYPE)); for (t=0;t<2;t++) Index: phidget.h =================================================================== RCS file: /cvsroot/libphidget/libphidget/src/libphidget/phidget.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** phidget.h 13 Dec 2002 21:16:23 -0000 1.9 --- phidget.h 13 Dec 2002 22:05:16 -0000 1.10 *************** *** 65,68 **** --- 65,70 ---- LP_SERVO_CONTROLLER = 200, /**< Identifies all servo controller phidgets */ LP_INTERFACE_KIT = 300, /**< Identifies all interface kit phidgets, support being added now */ + LP_INTERFACE_KIT_088 = 301, /**< 088 interface kit */ + LP_INTERFACE_KIT_884 = 302, /**< 884 interface kit */ LP_ENCODER = 400, /**< Currently unsupported */ LP_POWER = 500, /**< Currently unsupported */ |