1 #ifndef ADAFRUIT_FINGERPRINT_H 2 #define ADAFRUIT_FINGERPRINT_H 9 #if defined(__AVR__) || defined(ESP8266) 10 #include <SoftwareSerial.h> 11 #elif defined(FREEDOM_E300_HIFIVE1) 12 #include <SoftwareSerial32.h> 13 #define SoftwareSerial SoftwareSerial32 16 #define FINGERPRINT_OK 0x00 17 #define FINGERPRINT_PACKETRECIEVEERR 0x01 18 #define FINGERPRINT_NOFINGER 0x02 19 #define FINGERPRINT_IMAGEFAIL 0x03 20 #define FINGERPRINT_IMAGEMESS \ 22 #define FINGERPRINT_FEATUREFAIL \ 25 #define FINGERPRINT_NOMATCH 0x08 27 #define FINGERPRINT_NOTFOUND 0x09 28 #define FINGERPRINT_ENROLLMISMATCH \ 30 #define FINGERPRINT_BADLOCATION \ 32 #define FINGERPRINT_DBRANGEFAIL \ 34 #define FINGERPRINT_UPLOADFEATUREFAIL 0x0D 35 #define FINGERPRINT_PACKETRESPONSEFAIL \ 37 #define FINGERPRINT_UPLOADFAIL 0x0F 38 #define FINGERPRINT_DELETEFAIL 0x10 39 #define FINGERPRINT_DBCLEARFAIL 0x11 40 #define FINGERPRINT_PASSFAIL \ 42 #define FINGERPRINT_INVALIDIMAGE \ 44 #define FINGERPRINT_FLASHERR 0x18 45 #define FINGERPRINT_INVALIDREG 0x1A 46 #define FINGERPRINT_ADDRCODE 0x20 47 #define FINGERPRINT_PASSVERIFY 0x21 48 #define FINGERPRINT_STARTCODE \ 51 #define FINGERPRINT_COMMANDPACKET 0x1 52 #define FINGERPRINT_DATAPACKET \ 54 #define FINGERPRINT_ACKPACKET 0x7 55 #define FINGERPRINT_ENDDATAPACKET 0x8 57 #define FINGERPRINT_TIMEOUT 0xFF 58 #define FINGERPRINT_BADPACKET 0xFE 60 #define FINGERPRINT_GETIMAGE 0x01 61 #define FINGERPRINT_IMAGE2TZ 0x02 62 #define FINGERPRINT_SEARCH 0x04 63 #define FINGERPRINT_REGMODEL \ 65 #define FINGERPRINT_STORE 0x06 66 #define FINGERPRINT_LOAD 0x07 67 #define FINGERPRINT_UPLOAD 0x08 68 #define FINGERPRINT_DELETE 0x0C 69 #define FINGERPRINT_EMPTY 0x0D 70 #define FINGERPRINT_READSYSPARAM 0x0F 71 #define FINGERPRINT_SETPASSWORD 0x12 72 #define FINGERPRINT_VERIFYPASSWORD 0x13 73 #define FINGERPRINT_HISPEEDSEARCH \ 75 #define FINGERPRINT_TEMPLATECOUNT 0x1D 77 #define FINGERPRINT_AURALEDCONFIG 0x35 78 #define FINGERPRINT_LEDON 0x50 79 #define FINGERPRINT_LEDOFF 0x51 81 #define FINGERPRINT_LED_BREATHING 0x01 82 #define FINGERPRINT_LED_FLASHING 0x02 83 #define FINGERPRINT_LED_ON 0x03 84 #define FINGERPRINT_LED_OFF 0x04 85 #define FINGERPRINT_LED_GRADUAL_ON 0x05 86 #define FINGERPRINT_LED_GRADUAL_OFF 0x06 87 #define FINGERPRINT_LED_RED 0x01 88 #define FINGERPRINT_LED_BLUE 0x02 89 #define FINGERPRINT_LED_PURPLE 0x03 91 #define FINGERPRINT_REG_ADDR_ERROR 0x1A 92 #define FINGERPRINT_WRITE_REG 0x0E 94 #define FINGERPRINT_BAUD_REG_ADDR 0x4 95 #define FINGERPRINT_BAUDRATE_9600 0x1 96 #define FINGERPRINT_BAUDRATE_19200 0x2 97 #define FINGERPRINT_BAUDRATE_28800 0x3 98 #define FINGERPRINT_BAUDRATE_38400 0x4 99 #define FINGERPRINT_BAUDRATE_48000 0x5 100 #define FINGERPRINT_BAUDRATE_57600 0x6 101 #define FINGERPRINT_BAUDRATE_67200 0x7 102 #define FINGERPRINT_BAUDRATE_76800 0x8 103 #define FINGERPRINT_BAUDRATE_86400 0x9 104 #define FINGERPRINT_BAUDRATE_96000 0xA 105 #define FINGERPRINT_BAUDRATE_105600 0xB 106 #define FINGERPRINT_BAUDRATE_115200 0xC 108 #define FINGERPRINT_SECURITY_REG_ADDR 0x5 109 // The safety level is 1 The highest rate of false recognition , The rejection 112 #define FINGERPRINT_SECURITY_LEVEL_1 0X1 113 #define FINGERPRINT_SECURITY_LEVEL_2 0X2 114 #define FINGERPRINT_SECURITY_LEVEL_3 0X3 115 #define FINGERPRINT_SECURITY_LEVEL_4 0X4 116 #define FINGERPRINT_SECURITY_LEVEL_5 0X5 118 #define FINGERPRINT_PACKET_REG_ADDR 0x6 119 #define FINGERPRINT_PACKET_SIZE_32 0X0 120 #define FINGERPRINT_PACKET_SIZE_64 0X1 121 #define FINGERPRINT_PACKET_SIZE_128 0X2 122 #define FINGERPRINT_PACKET_SIZE_256 0X3 126 #define DEFAULTTIMEOUT 1000 150 memcpy(this->data, data, length);
152 memcpy(this->data, data, 64);
164 #if defined(__AVR__) || defined(ESP8266) || defined(FREEDOM_E300_HIFIVE1) 170 void begin(uint32_t baud);
172 boolean verifyPassword(
void);
173 uint8_t getParameters(
void);
175 uint8_t getImage(
void);
176 uint8_t image2Tz(uint8_t slot = 1);
177 uint8_t createModel(
void);
179 uint8_t emptyDatabase(
void);
180 uint8_t storeModel(uint16_t
id);
181 uint8_t loadModel(uint16_t
id);
182 uint8_t getModel(
void);
183 uint8_t deleteModel(uint16_t
id);
184 uint8_t fingerFastSearch(
void);
185 uint8_t fingerSearch(uint8_t slot = 1);
186 uint8_t getTemplateCount(
void);
187 uint8_t setPassword(uint32_t password);
188 uint8_t LEDcontrol(
bool on);
189 uint8_t LEDcontrol(uint8_t control, uint8_t speed, uint8_t coloridx,
192 uint8_t setBaudRate(uint8_t baudrate);
193 uint8_t setSecurityLevel(uint8_t level);
194 uint8_t setPacketSize(uint8_t size);
208 uint16_t status_reg = 0x0;
209 uint16_t system_id = 0x0;
210 uint16_t capacity = 64;
211 uint16_t security_level = 0;
212 uint32_t device_addr =
214 uint16_t packet_len = 64;
215 uint16_t baud_rate = 57600;
218 uint8_t checkPassword(
void);
219 uint8_t writeRegister(uint8_t regAdd, uint8_t value);
220 uint32_t thePassword;
222 uint8_t recvPacket[20];
225 #if defined(__AVR__) || defined(ESP8266) || defined(FREEDOM_E300_HIFIVE1) 226 SoftwareSerial *swSerial;
228 HardwareSerial *hwSerial;
! Helper class to communicate with and keep state for fingerprint sensors
Definition: Adafruit_Fingerprint.h:162
uint16_t length
Length of packet.
Definition: Adafruit_Fingerprint.h:157
#define DEFAULTTIMEOUT
UART reading timeout in milliseconds.
Definition: Adafruit_Fingerprint.h:126
uint8_t type
Type of packet.
Definition: Adafruit_Fingerprint.h:156
#define FINGERPRINT_STARTCODE
Fixed falue of EF01H; High byte transferred first.
Definition: Adafruit_Fingerprint.h:48
uint16_t confidence
Definition: Adafruit_Fingerprint.h:204
uint16_t fingerID
The matching location that is set by fingerFastSearch()
Definition: Adafruit_Fingerprint.h:201
uint8_t data[64]
The raw buffer for packet payload.
Definition: Adafruit_Fingerprint.h:158
uint8_t address[4]
32-bit Fingerprint sensor address
Definition: Adafruit_Fingerprint.h:155
Adafruit_Fingerprint_Packet(uint8_t type, uint16_t length, uint8_t *data)
Create a new UART-borne packet.
Definition: Adafruit_Fingerprint.h:141
uint16_t templateCount
The number of stored templates in the sensor, set by getTemplateCount()
Definition: Adafruit_Fingerprint.h:206
uint16_t start_code
"Wakeup" code for packet detection
Definition: Adafruit_Fingerprint.h:154
! Helper class to craft UART packets
Definition: Adafruit_Fingerprint.h:129