Program for R306 fingerprint module interfaced with Wiz750SR S2E device
Dependencies: FPC_R306 MQTT WIZnetInterface mbed
Fork of GT511C3_TimeStamp_WIZwiki-W7500 by
Diff: main.cpp
- Revision:
- 2:34a647292050
- Parent:
- 1:4a1be9379e92
- Child:
- 3:459a4f985a45
--- a/main.cpp Fri Jan 03 06:34:26 2014 +0000 +++ b/main.cpp Fri Jan 03 07:24:39 2014 +0000 @@ -6,11 +6,31 @@ DigitalOut myled(LED1); GT511C3 finger(p28,p27); +int Enroll(void) +{ + int EnrollID = 10; + unsigned long Parameter = 0; + unsigned short Response = 0; + int sts = 0; + + debug.printf("CMD_EnrollStart\n"); + Parameter = EnrollID; + sts = finger.SendRecv(GT511C3::CMD_EnrollStart,&Parameter,&Response); + debug.printf("sts = %d,Response=0x%04x Parameter=0x%08lx\n",sts,Response,Parameter); + if(sts != 0) + return sts; + if(Response != GT511C3::CMD_Ack) + return -100; + // + return sts; +} + int main() { unsigned long Parameter; unsigned short Response; int sts = 0; int count = 0; + int ispress; debug.format(8,Serial::None,1); debug.baud(115200); @@ -18,19 +38,29 @@ debug.printf("Init\n"); finger.Init(); debug.printf("Open\n"); - finger.SendCommand(0,GT511C3::CMD_Open); - sts = finger.RecvResponse(&Parameter,&Response); + Parameter = 0; + sts = finger.SendRecv(GT511C3::CMD_Open,&Parameter,&Response); debug.printf("sts = %d,Response=0x%04x\n",sts,Response); + Parameter = 1; + sts = finger.SendRecv(GT511C3::CMD_CmosLed,&Parameter,&Response); + debug.printf("sts = %d,Response=0x%04x\n",sts,Response); while(1) { - debug.printf("Led\n"); - finger.SendCommand(count & 1,GT511C3::CMD_CmosLed); - sts = finger.RecvResponse(&Parameter,&Response); - debug.printf("sts = %d,Response=0x%04x\n",sts,Response); + ispress = 0; + Parameter = 0; + sts = finger.SendRecv(GT511C3::CMD_IsPressFinger,&Parameter,&Response); + debug.printf("sts = %d,Response=0x%04x Parameter=0x%08lx\n",sts,Response,Parameter); + if(sts == 0){ + if((Response == GT511C3::CMD_Ack) && (Parameter == 0)){ + ispress = 1; + } + } +#if 0 myled = 1; wait(0.5); myled = 0; wait(0.5); +#endif count++; } }