Program for R306 fingerprint module

Dependencies:   FPC_R306_fingerprintmodule SDFileSystem WIZnetInterface mbed-src

Fork of GT511C3_TimeStamp_WIZwiki-W7500 by WIZnet

Files at this revision

API Documentation at this revision

Comitter:
hjjeon
Date:
Thu Jul 30 00:43:42 2015 +0000
Parent:
7:8b9ef3211cd0
Child:
9:9becf9ddb86e
Commit message:
Fingerprint sensor example with WIZwiki-W7500.; 1st release.

Changed in this revision

GT511C3.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-src.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show diff for this revision Revisions of this file
--- a/GT511C3.lib	Fri Jan 03 16:03:44 2014 +0000
+++ b/GT511C3.lib	Thu Jul 30 00:43:42 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/tosihisa/code/GT511C3/#90c64cb9db58
+http://mbed.org/users/tosihisa/code/GT511C3/#e53c3965131e
--- a/main.cpp	Fri Jan 03 16:03:44 2014 +0000
+++ b/main.cpp	Thu Jul 30 00:43:42 2015 +0000
@@ -1,10 +1,16 @@
 #include "mbed.h"
 #include "GT511C3.hpp"
 
+#define MAX_ID_NUM  20
+
 Serial debug(USBTX,USBRX);
 
-DigitalOut myled(LED1);
-GT511C3 finger(p28,p27);
+
+#ifdef TARGET_WIZWIKI_W7500
+GT511C3 finger(PA_13,PA_14);
+DigitalIn del_ID(D7);
+DigitalIn enroll_ID(D8);
+#endif
 
 int progress(int status,char *msg)
 {
@@ -12,50 +18,81 @@
     return 0;
 }
 
-int main() {
+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__);
+    int cnt = 0;
+    int EnrollID;
 
-    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.baud(115200);
+    printf("Try to Open Device....\r\n");
+    
+    while(1)
+    {
+        sts = finger.Open();
+        if(sts == -1)
+        {
+            printf("Open failed!!\r\n");
+            cnt++;
+            while(cnt > 5);
+        }
+        else
+        {
+            printf("Open Success!!\r\n");
+            break;
         }
-        debug.printf("\n");
+        wait(0.2);
+    }
+    
+    if(del_ID == 1)
+    {
+        finger.DeleteID_All();
+        printf("All ID are deleted!!\r\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");
+    
+    cnt = 0;
+    if(enroll_ID == 1)
+    {
+        while(1)
+        {
+            if(finger.CheckEnrolled(cnt) == -1)
+            {
+                EnrollID = cnt;
+                printf("ID(%d) is empty\r\n", EnrollID);
+                break;
+            }
+            cnt++;
+            if(cnt > MAX_ID_NUM)
+            {
+                printf("\r\nERROR : ID number is fulled!!Delete ID first!!\r\n\r\n");
+                while(1);
             }
         }
         finger.Enroll(EnrollID,progress);
     }
-
+    
     finger.CmosLed(1);
-    while(1) {
-        debug.printf("Press finger for Identify\n");
+    
+    while(1)
+    {
+        printf("Press finger for Identify\r\n");
         finger.WaitPress(1);
         if(finger.Capture(1) != 0)
             continue;
+            
         ID = finger.Identify();
-        debug.printf("ID = %d\n",ID); 
-        debug.printf("Remove finger\n");
+        
+        if(ID == -1)
+            printf("\r\nERROR : There is no ID!!Enroll first!!\r\n\r\n");
+        else
+            printf("ID = %d\r\n",ID); 
+            
+        printf("Remove finger\r\n");
         finger.WaitPress(0);
+        
     }
+    
+        
 }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-src.lib	Thu Jul 30 00:43:42 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-src/#5e59b9938d4a
--- a/mbed.bld	Fri Jan 03 16:03:44 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file