Skip to content
Browse files

Implement Function TemplateCount

TemplateCount gets the number of templates stored in memory. Also added
translated documentation for this one.
  • Loading branch information...
1 parent e0936a1 commit c5947444cfc66dca6b9615e3c10a3279662ea071 @cycloon cycloon committed Oct 3, 2012
Showing with 20 additions and 1 deletion.
  1. +17 −0 Adafruit_Fingerprint.cpp
  2. +3 −1 Adafruit_Fingerprint.h
  3. BIN documentation/fingerprint_en.pdf
View
17 Adafruit_Fingerprint.cpp
@@ -133,6 +133,23 @@ uint8_t Adafruit_Fingerprint::fingerFastSearch(void) {
return packet[1];
}
+uint8_t Adafruit_Fingerprint::getTemplateCount(void) {
+ templateCount = 0xFFFF;
+ // get number of templates in memory
+ uint8_t packet[] = {FINGERPRINT_TEMPLATECOUNT};
+ writePacket(theAddress, FINGERPRINT_COMMANDPACKET, sizeof(packet)+2, packet);
+ uint8_t len = getReply(packet);
+
+ if ((len != 1) && (packet[0] != FINGERPRINT_ACKPACKET))
+ return -1;
+
+ templateCount = packet[2];
+ templateCount <<= 8;
+ templateCount |= packet[3];
+
+ return packet[1];
+}
+
void Adafruit_Fingerprint::writePacket(uint32_t addr, uint8_t packettype,
View
4 Adafruit_Fingerprint.h
@@ -63,6 +63,7 @@
#define FINGERPRINT_EMPTY 0x0D
#define FINGERPRINT_VERIFYPASSWORD 0x13
#define FINGERPRINT_HISPEEDSEARCH 0x1B
+#define FINGERPRINT_TEMPLATECOUNT 0x1D
//#define FINGERPRINT_DEBUG
@@ -85,10 +86,11 @@ class Adafruit_Fingerprint {
uint8_t emptyDatabase(void);
uint8_t storeModel(uint16_t id);
uint8_t fingerFastSearch(void);
+ uint8_t getTemplateCount(void);
void writePacket(uint32_t addr, uint8_t packettype, uint16_t len, uint8_t *packet);
uint8_t getReply(uint8_t packet[], uint16_t timeout=DEFAULTTIMEOUT);
- uint16_t fingerID, confidence;
+ uint16_t fingerID, confidence, templateCount;
private:
uint32_t thePassword;
View
BIN documentation/fingerprint_en.pdf
Binary file not shown.

0 comments on commit c594744

Please sign in to comment.
Something went wrong with that request. Please try again.