Library for R306 fingerprint module

Dependents:   R306_fingerprintmodule_WizwikiW7500

Fork of GT511C3 by WIZnet

FPC_R306.hpp

Committer:
Albinarackal
Date:
2018-07-16
Revision:
2:12ca31a7364e

File content as of revision 2:12ca31a7364e:




//......Created by the CDI KENGERI TEAM (CHRIST(Deemed to be University)) Bangalore, Karnataka, India..........//


#ifndef __FPC_R306_HPP
#define __FPC_R306_HPP
#include "mbed.h"

class FPC_R306 : public Serial {
public:
#define FINGERPRINT_OK 0x00
#define FINGERPRINT_PACKETRECIEVEERR 0x01
#define FINGERPRINT_NOFINGER 0x02
#define FINGERPRINT_IMAGEFAIL 0x03
#define FINGERPRINT_IMAGEMESS 0x06
#define FINGERPRINT_FEATUREFAIL 0x07
#define FINGERPRINT_NOMATCH 0x08
#define FINGERPRINT_NOTFOUND 0x09
#define FINGERPRINT_ENROLLMISMATCH 0x0A
#define FINGERPRINT_BADLOCATION 0x0B
#define FINGERPRINT_DBRANGEFAIL 0x0C
#define FINGERPRINT_UPLOADFEATUREFAIL 0x0D
#define FINGERPRINT_PACKETRESPONSEFAIL 0x0E
#define FINGERPRINT_UPLOADFAIL 0x0F
#define FINGERPRINT_DELETEFAIL 0x10
#define FINGERPRINT_DBCLEARFAIL 0x11
#define FINGERPRINT_PASSFAIL 0x13
#define FINGERPRINT_INVALIDIMAGE 0x15
#define FINGERPRINT_FLASHERR 0x18
#define FINGERPRINT_INVALIDREG 0x1A
#define FINGERPRINT_ADDRCODE 0x20
#define FINGERPRINT_PASSVERIFY 0x21

#define FINGERPRINT_STARTCODE 0xEF01

#define FINGERPRINT_COMMANDPACKET 0x1
#define FINGERPRINT_DATAPACKET 0x2
#define FINGERPRINT_ACKPACKET 0x7
#define FINGERPRINT_ENDDATAPACKET 0x8

#define FINGERPRINT_TIMEOUT 0xFF
#define FINGERPRINT_BADPACKET 0xFE

#define FINGERPRINT_GETIMAGE 0x01
#define FINGERPRINT_IMAGE2TZ 0x02
#define FINGERPRINT_REGMODEL 0x05
#define FINGERPRINT_STORE 0x06
#define FINGERPRINT_LOAD 0x07
#define FINGERPRINT_UPLOAD 0x08
#define FINGERPRINT_DELETE 0x0C
#define FINGERPRINT_EMPTY 0x0D
#define FINGERPRINT_SETPASSWORD 0x12
#define FINGERPRINT_VERIFYPASSWORD 0x13
#define FINGERPRINT_HISPEEDSEARCH 0x1B
#define FINGERPRINT_TEMPLATECOUNT 0x1D


#define DEFAULTTIMEOUT 2000 

    unsigned long LastError;
    unsigned long FirmwareVersion; 
    unsigned long IsoAreaMaxSize; 
    unsigned char DeviceSerialNumber[16]; 

    FPC_R306(PinName _tx, PinName _rx) : Serial(_tx,_rx) {}
    int Init(void);
    int CMD_GETIMG();
    int CMD_IMG2Tz1();
    int CMD_IMG2Tz2();
    int createModel();
    int STORE_MODEL(uint16_t id);
    uint8_t RecvResponse();
    uint8_t TMPL_COUNT();
    uint8_t FAST_SEARCH();
    uint8_t Recv_TMPL_COUNT();
    uint8_t Recv_FAST_SEARCH();
    uint8_t DELETE_ID(uint16_t id);
    uint8_t EMPTY_LIB();
    
    
    uint16_t templatecount;
    uint16_t fingerID;
    uint16_t MatchScore;

};

#endif  //__FPC_R306_HPP