Fingerprint Scanner API using GT511C3 fingerprint scanner.

Dependencies:   4DGL-uLCD-SE GT511C3 SDFileSystem mbed

Fork of GT511C3test by Toshihisa T

The fingerprint scanner is designed to take attendance over a group of students. It requires a the group owner to store a preloaded list of student id numbers in a .txt file to the memory (SD card) in return of a 5 digits keypass to gain access to the database when taking attendance.

While there may exist multiple group owner and a group owner with multiple databases, each group will be uniquely identified by the 5 digits keypass. The program limits each scanner to open ONE session at a time where only one group will be able to take attendance during its session. Once a session is closed, a report of the attendance taken during the open session is generated and sent via ethernet to owner and there is no way to reopen the session again.

For the initial setup, each fingerprint database needs to be populated by the students. This set up can be done continuously during a session while taking attendance that session.

main.cpp

Committer:
tosihisa
Date:
2014-01-03
Revision:
2:34a647292050
Parent:
1:4a1be9379e92
Child:
3:459a4f985a45

File content as of revision 2:34a647292050:

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

Serial debug(USBTX,USBRX);

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);

    debug.printf("Init\n");
    finger.Init();
    debug.printf("Open\n");
    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) {
        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++;
    }
}