Program for R306 fingerprint module interfaced with Wiz750SR S2E device

Dependencies:   FPC_R306 MQTT WIZnetInterface mbed

Fork of GT511C3_TimeStamp_WIZwiki-W7500 by WIZnet

main.cpp

Committer:
tosihisa
Date:
2014-01-03
Revision:
7:8b9ef3211cd0
Parent:
6:016ad8f480d3
Child:
8:574087f87b1e

File content as of revision 7:8b9ef3211cd0:

#include "mbed.h"
#include "GT511C3.hpp"

Serial debug(USBTX,USBRX);

DigitalOut myled(LED1);
GT511C3 finger(p28,p27);

int progress(int status,char *msg)
{
    debug.printf("%s",msg);
    return 0;
}

int main() {
    int sts = 0;
    int ID = 0;

    debug.format(8,Serial::None,1);
    debug.baud(115200);

    debug.printf("Fingerprint reader module \"GT-511C3 / GT-511C31\" test program.\n");
    debug.printf("Build: %s %s\n",__DATE__,__TIME__);

    debug.printf("Open\n");
    sts = finger.Open();
    debug.printf("sts = %d\n",sts);
    if(sts == 0){
        int i;
        debug.printf("FirmwareVersion = %lx\n",finger.FirmwareVersion);
        debug.printf("IsoAreaMaxSize = %ld\n",finger.IsoAreaMaxSize);
        debug.printf("DeviceSerialNumber = ");
        for(i = 0; i < sizeof(finger.DeviceSerialNumber);i++){
            debug.printf("%02X",finger.DeviceSerialNumber[i]);
        }
        debug.printf("\n");
    }

    if(1){
        int EnrollID = 11;
        if(finger.CheckEnrolled(EnrollID) == 0){
            debug.printf("EnrollID(%d) is already enrolled.Delete!\n",EnrollID);
            if(finger.DeleteID(EnrollID) == 0){
                debug.printf("Delete OK!\n");
            }
        }
        finger.Enroll(EnrollID,progress);
    }

    finger.CmosLed(1);
    while(1) {
        debug.printf("Press finger for Identify\n");
        finger.WaitPress(1);
        if(finger.Capture(1) != 0)
            continue;
        ID = finger.Identify();
        debug.printf("ID = %d\n",ID); 
        debug.printf("Remove finger\n");
        finger.WaitPress(0);
    }
}