[Libphidget-cvs-commits] CVS: libphidget/src/libphidget phidget.c,1.35,1.36 phidget.h,1.23,1.24
Status: Alpha
Brought to you by:
jstrohm
From: Jack S. <js...@us...> - 2003-08-15 03:06:16
|
Update of /cvsroot/libphidget/libphidget/src/libphidget In directory sc8-pr-cvs1:/tmp/cvs-serv22528/libphidget Modified Files: phidget.c phidget.h Log Message: Added initial support for RFID phidget Index: phidget.c =================================================================== RCS file: /cvsroot/libphidget/libphidget/src/libphidget/phidget.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** phidget.c 8 Jul 2003 02:24:11 -0000 1.35 --- phidget.c 15 Aug 2003 02:43:29 -0000 1.36 *************** *** 945,949 **** _registerDeviceType("Phidget LCD", 0x06C2, 0x0041, LP_INTERFACE_KIT_880); _registerDeviceType("PhidgetTextLCD ECMA1010 Ver 1.0", 0x06C2, 0x0050,LP_TEXT_LCD); ! //_registerDeviceType("RFID VID/PID", 0x06C2, 0x0030, LP_OTHER); _registerDeviceType("8-AdvancedServo", 0x06C2, 0x003B, LP_8WAY_SERVO); //_registerDeviceType("Interface Kit 32-32-0", 0x06C2, 0x0042, LP_INTERFACE_KIT); --- 945,949 ---- _registerDeviceType("Phidget LCD", 0x06C2, 0x0041, LP_INTERFACE_KIT_880); _registerDeviceType("PhidgetTextLCD ECMA1010 Ver 1.0", 0x06C2, 0x0050,LP_TEXT_LCD); ! _registerDeviceType("RFID VID/PID", 0x06C2, 0x0030, LP_RFID); _registerDeviceType("8-AdvancedServo", 0x06C2, 0x003B, LP_8WAY_SERVO); //_registerDeviceType("Interface Kit 32-32-0", 0x06C2, 0x0042, LP_INTERFACE_KIT); *************** *** 1915,1918 **** --- 1915,1941 ---- return (_error(LPE_NONE)); } + + + /** + * Checks for RFID's + */ + enum ELPError phidgetRFID(struct phidget *phidgetDevice, struct RFID *rfid) + { + char buffer[7]; + enum ELPError err; + + err=phidgetRead(phidgetDevice,buffer,sizeof(buffer)); + if (err!=LPE_NONE) + return(_error(err)); + + rfid->bytes[0]=buffer[1]; + rfid->bytes[1]=buffer[2]; + rfid->bytes[2]=buffer[3]; + rfid->bytes[3]=buffer[4]; + rfid->bytes[4]=buffer[5]; + + return (_error(LPE_NONE)); + } + /** Index: phidget.h =================================================================== RCS file: /cvsroot/libphidget/libphidget/src/libphidget/phidget.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** phidget.h 30 Jun 2003 02:49:16 -0000 1.23 --- phidget.h 15 Aug 2003 02:43:29 -0000 1.24 *************** *** 128,131 **** --- 128,139 ---- }; + /** + * Structure to store an RFID + */ + struct RFID + { + unsigned char bytes[5]; + }; + #ifdef __cplusplus extern "C" *************** *** 426,429 **** --- 434,445 ---- const char *phidgetErrorString( const enum ELPError err //!< The error number you want made human readable + ); + + /** + * Checks for RFID's, currently this blocks until an RFID is detected + */ + enum ELPError phidgetRFID( + struct phidget *phidgetDevice, //!< The phidget to read from + struct RFID *rfid //!< The RFID we detected ); |