Library for R306 fingerprint module

Dependents:   R306_fingerprintmodule_WizwikiW7500

Fork of GT511C3 by WIZnet

Files at this revision

API Documentation at this revision

Comitter:
Albinarackal
Date:
Mon Jul 16 10:14:28 2018 +0000
Parent:
1:e53c3965131e
Commit message:
Library for R306 fingerprint module;

Changed in this revision

FPC_R306.cpp Show annotated file Show diff for this revision Revisions of this file
FPC_R306.hpp Show annotated file Show diff for this revision Revisions of this file
GT511C3.cpp Show diff for this revision Revisions of this file
GT511C3.hpp Show diff for this revision Revisions of this file
diff -r e53c3965131e -r 12ca31a7364e FPC_R306.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FPC_R306.cpp	Mon Jul 16 10:14:28 2018 +0000
@@ -0,0 +1,268 @@
+
+
+
+//......Created by the CDI KENGERI TEAM (CHRIST(Deemed to be University)) Bangalore, Karnataka, India..........//
+
+
+#include "mbed.h"
+#include "FPC_R306.hpp"
+Serial FPC(PA_13,PA_14);
+Serial lib(USBTX,USBRX);
+#define SET_AND_SUMADD(idx,val) sendbuf[idx]=((unsigned char)(val));//sum += sendbuf[idx]
+
+/*int FPC_R306::Init(void)
+{
+    baud(57600);
+    ClearLine();
+    return 0;
+}*/
+
+int FPC_R306::CMD_GETIMG()
+{
+    FPC.baud(57600);
+    FPC.putc(0xEF);     //start_code
+    FPC.putc(0x01);     //start_code
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0x01);     //type 
+    FPC.putc(0x00);     //length
+    FPC.putc(0x03);     //length
+    FPC.putc(0x01);     //command
+    FPC.putc(0x00);     //Checksum
+    FPC.putc(0x05);     //Checksum
+    uint8_t resp = RecvResponse();
+    return resp;
+}
+
+
+int FPC_R306::CMD_IMG2Tz1()
+{
+    FPC.baud(57600);
+    FPC.putc(0xEF);     //start_code
+    FPC.putc(0x01);     //start_code
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0x01);     //type (package identifier)
+    FPC.putc(0x00);     //datalength
+    FPC.putc(0x04);     //datalength
+    FPC.putc(0x02);     //command
+    FPC.putc(0x01);     //slot number
+    FPC.putc(0x00);     //Checksum
+    FPC.putc(0x08);     //Checksum
+    uint8_t resp = RecvResponse();
+    return resp;
+    }
+    
+int FPC_R306::CMD_IMG2Tz2()
+{
+    FPC.baud(57600);
+    FPC.putc(0xEF);     //start_code
+    FPC.putc(0x01);     //start_code
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0x01);     //type (package identifier)
+    FPC.putc(0x00);     //datalength
+    FPC.putc(0x04);     //datalength
+    FPC.putc(0x02);     //command
+    FPC.putc(0x02);     //slot number
+    FPC.putc(0x00);     //Checksum
+    FPC.putc(0x09);     //Checksum
+    uint8_t resp = RecvResponse();
+    return resp;
+    }
+    
+    
+int FPC_R306::createModel()
+{
+    FPC.baud(57600);
+    FPC.putc(0xEF);     //start_code
+    FPC.putc(0x01);     //start_code
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0x01);     //type (package identifier)
+    FPC.putc(0x00);     //datalength
+    FPC.putc(0x03);     //datalength
+    FPC.putc(0x05);     //command
+    FPC.putc(0x00);     //Checksum
+    FPC.putc(0x09);     //Checksum
+    uint8_t resp = RecvResponse();
+    return resp;
+    }
+    
+    
+int FPC_R306:: STORE_MODEL(uint16_t id)
+{
+    FPC.baud(57600);
+    FPC.putc(0xEF);     //start_code
+    FPC.putc(0x01);     //start_code
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0x01);     //type (package identifier)
+    FPC.putc(0x00);     //datalength
+    FPC.putc(0x06);     //datalength
+    FPC.putc(0x06);     //command
+    FPC.putc(0x01);     //bufferID
+    uint8_t sum = 0x0E; //type + datalength + command + BufferID
+    FPC.putc((uint8_t)(id >> 8));
+    FPC.putc((uint8_t)(id & 0xFF));
+    uint16_t checksum = ((uint8_t)(sum & 0xFF) + (uint8_t)(id >> 8) + (uint8_t)(id & 0xFF)); //checkssum = type + datalength + command + BufferID + ID
+    FPC.putc((uint8_t)(checksum >> 8));     //Checksum
+    FPC.putc((uint8_t) (checksum & 0xFF));     //Checksum
+    uint8_t resp = RecvResponse();
+    return resp;
+    }
+
+uint8_t FPC_R306::RecvResponse()
+{
+    FPC.baud(57600);
+    //lib.printf("Waiting for response\n");
+    uint8_t byte[12];
+    int i=0;
+       for(i=0;i<12;i++)
+       {
+        byte[i] = FPC.getc();
+        }
+        //lib.printf("Reading Done\n");
+        return byte[9];
+           
+}
+
+uint8_t FPC_R306 :: FAST_SEARCH()
+{
+    FPC.baud(57600);
+    FPC.putc(0xEF);     //start_code
+    FPC.putc(0x01);     //start_code
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0x01);     //type (package identifier)
+    FPC.putc(0x00);     //datalength
+    FPC.putc(0x08);     //datalength
+    FPC.putc(0x1B);     //command
+    FPC.putc(0x01);     //CharBuffer
+    FPC.putc(0x00);     //Start Page
+    FPC.putc(0x00);     //Start Page
+    FPC.putc(0x00);     //Page Num
+    FPC.putc(0xA3);     //Page Num
+    FPC.putc(0x00);     //Checksum
+    FPC.putc(0xC8);     //Checksum
+    uint8_t resp = Recv_FAST_SEARCH();
+    return resp;
+    } 
+
+uint8_t FPC_R306 :: TMPL_COUNT()
+{
+    FPC.baud(57600);
+    FPC.putc(0xEF);     //start_code
+    FPC.putc(0x01);     //start_code
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0x01);     //type (package identifier)
+    FPC.putc(0x00);     //datalength
+    FPC.putc(0x03);     //datalength
+    FPC.putc(0x1D);     //command
+    FPC.putc(0x00);     //Checksum
+    FPC.putc(0x21);     //Checksum
+    uint8_t resp = Recv_TMPL_COUNT();
+    return resp;
+    }
+    
+
+uint8_t FPC_R306 :: DELETE_ID(uint16_t id)
+{
+    FPC.baud(57600);
+    FPC.putc(0xEF);     //start_code
+    FPC.putc(0x01);     //start_code
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0x01);     //type (package identifier)
+    FPC.putc(0x00);     //datalength
+    FPC.putc(0x07);     //datalength
+    FPC.putc(0x0C);     //command
+    FPC.putc((uint8_t) id >>8 );     //ID num (Page Num)
+    FPC.putc((uint8_t) id & 0xFF);     //ID num (Page Num)
+    FPC.putc(0x00);     //Number of templates
+    FPC.putc(0x01);     //Number of templates
+    uint8_t sum = 0x15; // sum = type + datalength + command + no. of templates
+    uint16_t checksum = ((uint8_t)(sum & 0xFF) + (uint8_t)(id >> 8) + (uint8_t)(id & 0xFF));
+    FPC.putc((uint8_t)(checksum >> 8));     //Checksum
+    FPC.putc((uint8_t)(checksum & 0xFF));     //Checksum
+    uint8_t resp = RecvResponse();
+    return resp;
+    }     
+    
+    
+uint8_t FPC_R306 :: EMPTY_LIB()
+{
+    FPC.baud(57600);
+    FPC.putc(0xEF);     //start_code
+    FPC.putc(0x01);     //start_code
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0xFF);     //address
+    FPC.putc(0x01);     //type (package identifier)
+    FPC.putc(0x00);     //datalength
+    FPC.putc(0x03);     //datalength
+    FPC.putc(0x0D);     //command
+    FPC.putc(0x00);     //Checksum
+    FPC.putc(0x11);     //Checksum
+    uint8_t resp = RecvResponse();
+    return resp;
+    }
+    
+        
+uint8_t FPC_R306 :: Recv_TMPL_COUNT()
+{
+    FPC.baud(57600);
+    //lib.printf("Waiting for response\n");
+    uint8_t byte[14];
+    int i=0;
+       for(i=0;i<14;i++)
+       {
+        byte[i] = FPC.getc();
+        }
+        templatecount = byte[10];
+        templatecount <<=8;
+        templatecount |= byte[11];
+        
+        return byte[9];
+    }
+    
+    
+uint8_t FPC_R306:: Recv_FAST_SEARCH()
+{
+    FPC.baud(57600);
+    //lib.printf("Waiting for response\n");
+    uint8_t byte[16];
+    int i=0;
+       for(i=0;i<16;i++)
+       {
+        byte[i] = FPC.getc();
+        }
+        fingerID = byte[10];
+        fingerID <<=8;       
+        fingerID |= byte[11];
+        
+        MatchScore = byte[12];
+        MatchScore <<=8;
+        MatchScore |= byte[13];
+        
+        return byte[9];
+    }
+    
\ No newline at end of file
diff -r e53c3965131e -r 12ca31a7364e FPC_R306.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FPC_R306.hpp	Mon Jul 16 10:14:28 2018 +0000
@@ -0,0 +1,89 @@
+
+
+
+//......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
diff -r e53c3965131e -r 12ca31a7364e GT511C3.cpp
--- a/GT511C3.cpp	Thu Jul 30 00:43:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,361 +0,0 @@
-/**
- * @section LICENSE
- *
- * Copyright (c) 2013 @tosihisa, MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
- * and associated documentation files (the "Software"), to deal in the Software without restriction, 
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, 
- * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all copies or 
- * substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * @section DESCRIPTION
- *
- * Fingerprint reader module "GT-511C3" class.
- *
- * http://www.adh-tech.com.tw/?22,gt-511c3-gt-511c31
- * http://www.adh-tech.com.tw/files/GT-511C3_datasheet_V1%201_20131127[1].pdf
- * https://www.sparkfun.com/products/11792
- * https://github.com/sparkfun/Fingerprint_Scanner-TTL/ 
- */
-
-#include "mbed.h"
-#include "GT511C3.hpp"
-
-#define SET_AND_SUMADD(idx,val) sendbuf[idx]=((unsigned char)(val));sum += sendbuf[idx]
-
-int GT511C3::Init(void)
-{
-    baud(9600);
-    ClearLine();
-    return 0;
-}
-
-int GT511C3::SendCommand(unsigned long Parameter,unsigned short Command)
-{
-    unsigned char sendbuf[12];
-    unsigned short sum = 0;
-    int idx = 0;
-    int i;
-
-    SET_AND_SUMADD(idx,0x55); idx++;
-    SET_AND_SUMADD(idx,0xAA); idx++;
-    SET_AND_SUMADD(idx,0x01); idx++;
-    SET_AND_SUMADD(idx,0x00); idx++;
-    SET_AND_SUMADD(idx,Parameter & 0xff); idx++;
-    SET_AND_SUMADD(idx,(Parameter >> 8) & 0xff); idx++;
-    SET_AND_SUMADD(idx,(Parameter >> 16) & 0xff); idx++;
-    SET_AND_SUMADD(idx,(Parameter >> 24) & 0xff); idx++;
-    SET_AND_SUMADD(idx,Command & 0xff); idx++;
-    SET_AND_SUMADD(idx,(Command >> 8) & 0xff); idx++;
-    sendbuf[idx] = sum & 0xff; idx++;
-    sendbuf[idx] = (sum >> 8) & 0xff; idx++;
-
-    for(i = 0;i < idx;i++){
-        while(!writeable());
-        putc(sendbuf[i]);
-    }
-    return 0;
-}
-
-int GT511C3::RecvResponse(unsigned long *Parameter,unsigned short *Response)
-{
-    const unsigned char fixedbuf[4] = { 0x55,0xAA,0x01,0x00 };
-    unsigned char buf[12];
-    unsigned short sum = 0;
-    int i;
-
-    *Parameter = 0;
-    *Response = CMD_Nack;
-
-    for(i = 0;i < sizeof(buf);i++){
-        while(!readable());
-        buf[i] = getc();
-        if(i < 9){
-            sum += buf[i];
-        }
-        if(i < 4){
-            if(buf[i] != fixedbuf[i]){
-                return -1;
-            }
-        }
-    }
-    if(buf[10] != (sum & 0xff))
-        return -2;
-    if(buf[11] != ((sum >> 8) & 0xff))
-        return -2;
-
-    *Parameter =  buf[7];
-    *Parameter = (*Parameter << 8) | buf[6];
-    *Parameter = (*Parameter << 8) | buf[5];
-    *Parameter = (*Parameter << 8) | buf[4];
-
-    *Response = buf[9];
-    *Response = (*Response << 8) | buf[8];
-
-    return 0;
-}
-
-int GT511C3::RecvData(unsigned char *data,unsigned long size)
-{
-    const unsigned char fixedbuf[4] = { 0x5A,0xA5,0x01,0x00 };
-    unsigned short sum = 0;
-    int i;
-
-    for(i = 0;i < size;i++){
-        while(!readable());
-        *(data + i) = getc();
-        if(i < (size-2)){
-            sum += *(data + i);
-        }
-        if(i < 4){
-            if(*(data + i) != fixedbuf[i]){
-                return -1;
-            }
-        }
-    }
-    if(*(data + size - 2) != (sum & 0xff))
-        return -2;
-    if(*(data + size - 1) != ((sum >> 8) & 0xff))
-        return -2;
-    return 0;
-}
-
-int GT511C3::SendRecv(unsigned short Command,unsigned long *Parameter,unsigned short *Response)
-{
-    int sts;
-    if((sts = SendCommand(*Parameter,Command)) == 0){
-        *Parameter = 0;
-        if((sts = RecvResponse(Parameter,Response)) != 0){
-            *Response = CMD_Nack;
-            *Parameter = NACK_IO_ERR;
-        }
-    }
-    if(*Response == CMD_Nack){
-        LastError = *Parameter;
-    }
-    return sts;
-}
-
-int GT511C3::ClearLine(void)
-{
-    while(readable()){
-        (void)getc();
-    }
-    return 0;
-}
-
-int GT511C3::Open(void)
-{
-    unsigned long Parameter = 1;
-    unsigned short Response = 0;
-    unsigned char buf[4+sizeof(FirmwareVersion)+sizeof(IsoAreaMaxSize)+sizeof(DeviceSerialNumber)+2];
-    int sts = 0;
-
-    if((sts = Init()) != 0)
-        return -1;
-
-    sts = SendRecv(CMD_Open,&Parameter,&Response);
-    if((sts != 0) || (Response != CMD_Ack)){
-        return -1;
-    }
-    if((sts = RecvData(buf,sizeof(buf))) == 0){
-        memcpy(&FirmwareVersion,&buf[4+0],sizeof(FirmwareVersion));
-        memcpy(&IsoAreaMaxSize,&buf[4+sizeof(FirmwareVersion)],sizeof(IsoAreaMaxSize));
-        memcpy(DeviceSerialNumber,&buf[4+sizeof(FirmwareVersion)+sizeof(IsoAreaMaxSize)],sizeof(DeviceSerialNumber));
-    }
-    return sts;
-}
-
-int GT511C3::WaitPress(int press)
-{
-    while(IsPress() != press);
-    return 0;
-}
-
-int GT511C3::CmosLed(int onoff)
-{
-    unsigned long Parameter = onoff & 1;
-    unsigned short Response = 0;
-    int sts = 0;
-
-    sts = SendRecv(CMD_CmosLed,&Parameter,&Response);
-    if((sts != 0) || (Response != CMD_Ack)){
-        return -1;
-    }
-    return 0;
-}
-
-int GT511C3::IsPress(void)
-{
-    unsigned long Parameter = 0;
-    unsigned short Response = 0;
-    int sts = 0;
-    sts = SendRecv(CMD_IsPressFinger,&Parameter,&Response);
-    if((sts != 0) || (Response != CMD_Ack))
-        return 0;
-    if(Parameter != 0)
-        return 0;
-    return 1;
-}
-
-int GT511C3::Capture(int best)
-{
-    unsigned long Parameter = best;
-    unsigned short Response = 0;
-    int sts = 0;
-
-    sts = SendRecv(CMD_CaptureFinger,&Parameter,&Response);
-    if((sts != 0) || (Response != CMD_Ack))
-        return -1;
-    return 0;
-}
-
-int GT511C3::Enroll_N(int N)
-{
-    unsigned long Parameter = 0;
-    unsigned short Response = 0;
-    int sts = 0;
-    enum Command cmd;
-
-    switch(N){
-        default:
-        case 1: cmd = CMD_Enroll1; break;
-        case 2: cmd = CMD_Enroll2; break;
-        case 3: cmd = CMD_Enroll3; break;
-    }
-    sts = SendRecv(cmd,&Parameter,&Response);
-    if((sts != 0) || (Response != CMD_Ack))
-        return -1;
-    return 0;
-}
-
-int GT511C3::Identify(void)
-{
-    unsigned long Parameter = 0;
-    unsigned short Response = 0;
-    int sts = 0;
-
-    sts = SendRecv(CMD_Identify,&Parameter,&Response);
-    if((sts != 0) || (Response != CMD_Ack))
-        return -1;
-    return Parameter;
-}
-
-int GT511C3::Enroll(int ID,int (*progress)(int status,char *msg))
-{
-    unsigned long Parameter = 0;
-    unsigned short Response = 0;
-    int sts = 0;
-
-    CmosLed(1);
-
-    while(1){
-        if((sts = (*progress)(1,"EnrollStart\r\n")) != 0)
-            return -9999;
-        Parameter = ID;
-        sts = SendRecv(CMD_EnrollStart,&Parameter,&Response);
-        if(sts != 0)
-            return sts;
-        if(Response != CMD_Ack)
-            return -100;
-
-        if((sts = (*progress)(0,"Remove finger\r\n")) != 0)
-            return -9999;
-        WaitPress(0);
-
-        while(1){
-            if((sts = (*progress)(10,"Press finger to Enroll (1st)\r\n")) != 0)
-                return -9999;
-            WaitPress(1);
-            if(Capture(1) == 0)
-                break;
-        }
-
-        if((sts = (*progress)(0,"Remove finger\r\n")) != 0)
-            return -9999;
-        if(Enroll_N(1) != 0)
-            continue;
-        WaitPress(0);
-
-        while(1){
-            if((sts = (*progress)(20,"Press finger to Enroll (2nd)\r\n")) != 0)
-                return -9999;
-            WaitPress(1);
-            if(Capture(1) == 0)
-                break;
-        }
-
-        if((sts = (*progress)(0,"Remove finger\r\n")) != 0)
-            return -9999;
-        if(Enroll_N(2) != 0)
-            continue;
-        WaitPress(0);
-
-        while(1){
-            if((sts = (*progress)(30,"Press finger to Enroll (3rd)\r\n")) != 0)
-                return -9999;
-            WaitPress(1);
-            if(Capture(1) == 0)
-                break;
-        }
-
-        if((sts = (*progress)(0,"Remove finger\r\n")) != 0)
-            return -9999;
-        if(Enroll_N(3) != 0)
-            continue;
-        WaitPress(0);
-
-        if((sts = (*progress)(100,"Enroll OK\r\n")) != 0)
-            return -9999;
-
-        break;
-    }
-    return 0;
-}
-
-int GT511C3::CheckEnrolled(int ID)
-{
-    unsigned long Parameter = ID;
-    unsigned short Response = 0;
-    int sts = 0;
-
-    sts = SendRecv(CMD_CheckEnrolled,&Parameter,&Response);
-    if((sts == 0) && (Response == CMD_Ack))
-        return 0;  //This ID is enrolled 
-    return -1;
-}
-
-int GT511C3::DeleteID(int ID)
-{
-    unsigned long Parameter = ID;
-    unsigned short Response = 0;
-    int sts = 0;
-
-    sts = SendRecv(CMD_DeleteID,&Parameter,&Response);
-    if((sts == 0) && (Response == CMD_Ack))
-        return 0;
-    return -1;
-}
-
-int GT511C3::DeleteID_All(void)
-{
-    unsigned long Parameter = 0;
-    unsigned short Response = 0;
-    int sts = 0;
-
-    sts = SendRecv(CMD_DeleteAll,&Parameter,&Response);
-    if((sts == 0) && (Response == CMD_Ack))
-        return 0;
-    return -1;
-}
-
diff -r e53c3965131e -r 12ca31a7364e GT511C3.hpp
--- a/GT511C3.hpp	Thu Jul 30 00:43:04 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-/**
- * @section LICENSE
- *
- * Copyright (c) 2013 @tosihisa, MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
- * and associated documentation files (the "Software"), to deal in the Software without restriction, 
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, 
- * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all copies or 
- * substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * @section DESCRIPTION
- *
- * Fingerprint reader module "GT-511C3" class.
- *
- * http://www.adh-tech.com.tw/?22,gt-511c3-gt-511c31
- * http://www.adh-tech.com.tw/files/GT-511C3_datasheet_V1%201_20131127[1].pdf
- * https://www.sparkfun.com/products/11792
- * https://github.com/sparkfun/Fingerprint_Scanner-TTL/ 
- * http://blog.digit-parts.com/archives/51894096.html
- */
-#ifndef __GT511C3_HPP
-#define __GT511C3_HPP
-#include "mbed.h"
-
-class GT511C3 : public Serial {
-public:
-    enum Command {
-        CMD_Open = 0x01, // 01 Open Initialization 
-        CMD_Close = 0x02, // 02 Close Termination 
-        CMD_UsbInternalCheck = 0x03, // 03 UsbInternalCheck Check if the connected USB device is valid 
-        CMD_ChangeBaudrate = 0x04, // 04 ChangeBaudrate Change UART baud rate 
-        CMD_SetIAPMode = 0x05, // 05 SetIAPMode Enter IAP Mode In this mode, FW Upgrade is available 
-        CMD_CmosLed = 0x12, // 12 CmosLed Control CMOS LED 
-        CMD_GetEnrollCount = 0x20, // 20 GetEnrollCount Get enrolled fingerprint count 
-        CMD_CheckEnrolled = 0x21, // 21 CheckEnrolled Check whether the specified ID is already enrolled 
-        CMD_EnrollStart = 0x22, // 22 EnrollStart Start an enrollment 
-        CMD_Enroll1 = 0x23, // 23 Enroll1 Make 1st template for an enrollment 
-        CMD_Enroll2 = 0x24, // 24 Enroll2 Make 2nd template for an enrollment 
-        CMD_Enroll3 = 0x25, // 25 Enroll3  Make 3rd template for an enrollment, merge three templates into one template, save merged template to the database 
-        CMD_IsPressFinger = 0x26, // 26 IsPressFinger Check if a finger is placed on the sensor 
-        CMD_DeleteID = 0x40, // 40 DeleteID Delete the fingerprint with the specified ID 
-        CMD_DeleteAll = 0x41, // 41 DeleteAll Delete all fingerprints from the database 
-        CMD_Verify = 0x50, // 50 Verify 1:1 Verification of the capture fingerprint image with the specified ID 
-        CMD_Identify = 0x51, // 51 Identify 1:N Identification of the capture fingerprint image with the database 
-        CMD_VerifyTemplate = 0x52, // 52 VerifyTemplate 1:1 Verification of a fingerprint template with the specified ID 
-        CMD_IdentifyTemplate = 0x53, // 53 IdentifyTemplate 1:N Identification of a fingerprint template with the database 
-        CMD_CaptureFinger = 0x60, // 60 CaptureFinger Capture a fingerprint image(256x256) from the sensor 
-        CMD_MakeTemplate = 0x61, // 61 MakeTemplate Make template for transmission
-        CMD_GetImage = 0x62, // 62 GetImage Download the captured fingerprint image(256x256) 
-        CMD_GetRawImage = 0x63, // 63 GetRawImage Capture & Download raw fingerprint image(320x240) 
-        CMD_GetTemplate = 0x70, // 70 GetTemplate Download the template of the specified ID 
-        CMD_SetTemplate = 0x71, // 71 SetTemplate Upload the template of the specified ID 
-        CMD_GetDatabaseStart = 0x72, // 72 GetDatabaseStart Start database download, obsolete 
-        CMD_GetDatabaseEnd = 0x73, // 73 GetDatabaseEnd End database download, obsolete 
-        CMD_UpgradeFirmware = 0x80, // 80 UpgradeFirmware Not supported 
-        CMD_UpgradeISOCDImage = 0x81, // 81 UpgradeISOCDImage Not supported 
-        CMD_Ack = 0x30, // 30 Ack Acknowledge. 
-        CMD_Nack = 0x31, // 31 Nack Non-acknowledge.
-    };
-    enum Error {
-        NACK_TIMEOUT = 0x1001, // NACK_TIMEOUT 0x1001 Obsolete, capture timeout 
-        NACK_INVALID_BAUDRATE = 0x1002, // NACK_INVALID_BAUDRATE 0x1002 Obsolete, Invalid serial baud rate 
-        NACK_INVALID_POS = 0x1003, // NACK_INVALID_POS 0x1003 The specified ID is not between 0~199 
-        NACK_IS_NOT_USED = 0x1004, // NACK_IS_NOT_USED 0x1004 The specified ID is not used 
-        NACK_IS_ALREADY_USED = 0x1005, // NACK_IS_ALREADY_USED 0x1005 The specified ID is already used 
-        NACK_COMM_ERR = 0x1006, // NACK_COMM_ERR 0x1006 Communication Error 
-        NACK_VERIFY_FAILED = 0x1007, // NACK_VERIFY_FAILED 0x1007 1:1 Verification Failure 
-        NACK_IDENTIFY_FAILED = 0x1008, // NACK_IDENTIFY_FAILED 0x1008 1:N Identification Failure 
-        NACK_DB_IS_FULL = 0x1009, // NACK_DB_IS_FULL 0x1009 The database is full 
-        NACK_DB_IS_EMPTY = 0x100A, // NACK_DB_IS_EMPTY 0x100A The database is empty 
-        NACK_TURN_ERR = 0x100B, // NACK_TURN_ERR 0x100B Obsolete, Invalid order of the enrollment (The order was not as: EnrollStart -> Enroll1 -> Enroll2 -> Enroll3) 
-        NACK_BAD_FINGER = 0x100C, // NACK_BAD_FINGER 0x100C Too bad fingerprint 
-        NACK_ENROLL_FAILED = 0x100D, // NACK_ENROLL_FAILED 0x100D Enrollment Failure 
-        NACK_IS_NOT_SUPPORTED = 0x100E, // NACK_IS_NOT_SUPPORTED 0x100E The specified command is not supported 
-        NACK_DEV_ERR = 0x100F, // NACK_DEV_ERR 0x100F Device Error, especially if Crypto-Chip is trouble 
-        NACK_CAPTURE_CANCELED = 0x1010, // NACK_CAPTURE_CANCELED 0x1010 Obsolete, The capturing is canceled 
-        NACK_INVALID_PARAM = 0x1011, // NACK_INVALID_PARAM 0x1011 Invalid parameter 
-        NACK_FINGER_IS_NOT_PRESSED = 0x1012, // NACK_FINGER_IS_NOT_PRESSED 0x1012 Finger is not pressed 
-        NACK_IO_ERR = 0xF000,   // ORIGINAL ERROR CODE. Serial line error.
-    };
-    unsigned long LastError;
-    unsigned long FirmwareVersion; 
-    unsigned long IsoAreaMaxSize; 
-    unsigned char DeviceSerialNumber[16]; 
-
-    GT511C3(PinName _tx, PinName _rx) : Serial(_tx,_rx) , LastError(0) {}
-    int Init(void);
-    int SendCommand(unsigned long Parameter,unsigned short Command);
-    int RecvResponse(unsigned long *Parameter,unsigned short *Response);
-    int RecvData(unsigned char *data,unsigned long size);
-    int SendRecv(unsigned short Command,unsigned long *Parameter,unsigned short *Response);
-    int ClearLine(void);
-    int Open(void);
-    int WaitPress(int press);
-    int CmosLed(int onoff);
-    int IsPress(void);
-    int Capture(int best);
-    int Enroll_N(int N);
-    int Identify(void);
-    int Enroll(int ID,int (*progress)(int status,char *msg));
-    int CheckEnrolled(int ID);
-    int DeleteID(int ID);
-    int DeleteID_All(void);
-};
-
-#endif  //__GT511C3_HPP