Adafruit Fingerprint Arduino Library
|
! Helper class to communicate with and keep state for fingerprint sensors More...
#include <Adafruit_Fingerprint.h>
Public Member Functions | |
Adafruit_Fingerprint (HardwareSerial *hs, uint32_t password=0x0) | |
Instantiates sensor with Hardware Serial. More... | |
Adafruit_Fingerprint (Stream *serial, uint32_t password=0x0) | |
Instantiates sensor with a stream for Serial. More... | |
void | begin (uint32_t baud) |
Initializes serial interface and baud rate. More... | |
boolean | verifyPassword (void) |
Verifies the sensors' access password (default password is 0x0000000). A good way to also check if the sensors is active and responding. More... | |
uint8_t | getParameters (void) |
Get the sensors parameters, fills in the member variables status_reg, system_id, capacity, security_level, device_addr, packet_len and baud_rate. More... | |
uint8_t | getImage (void) |
Ask the sensor to take an image of the finger pressed on surface. More... | |
uint8_t | image2Tz (uint8_t slot=1) |
Ask the sensor to convert image to feature template. More... | |
uint8_t | createModel (void) |
Ask the sensor to take two print feature template and create a model. More... | |
uint8_t | emptyDatabase (void) |
Ask the sensor to delete ALL models in memory. More... | |
uint8_t | storeModel (uint16_t id) |
Ask the sensor to store the calculated model for later matching. More... | |
uint8_t | loadModel (uint16_t id) |
Ask the sensor to load a fingerprint model from flash into buffer 1. More... | |
uint8_t | getModel (void) |
Ask the sensor to transfer 256-byte fingerprint template from the buffer to the UART. More... | |
uint8_t | deleteModel (uint16_t id) |
Ask the sensor to delete a model in memory. More... | |
uint8_t | fingerFastSearch (void) |
Ask the sensor to search the current slot 1 fingerprint features to match saved templates. The matching location is stored in fingerID and the matching confidence in confidence More... | |
uint8_t | fingerSearch (uint8_t slot=1) |
Ask the sensor to search the current slot fingerprint features to match saved templates. The matching location is stored in fingerID and the matching confidence in confidence More... | |
uint8_t | getTemplateCount (void) |
Ask the sensor for the number of templates stored in memory. The number is stored in templateCount on success. More... | |
uint8_t | setPassword (uint32_t password) |
Set the password on the sensor (future communication will require password verification so don't forget it!!!) More... | |
uint8_t | LEDcontrol (bool on) |
Control the built in LED. More... | |
uint8_t | LEDcontrol (uint8_t control, uint8_t speed, uint8_t coloridx, uint8_t count=0) |
Control the built in Aura LED (if exists). Check datasheet/manual for different colors and control codes available. More... | |
uint8_t | setBaudRate (uint8_t baudrate) |
Change UART baudrate. More... | |
uint8_t | setSecurityLevel (uint8_t level) |
Change security level. More... | |
uint8_t | setPacketSize (uint8_t size) |
Change packet size. More... | |
void | writeStructuredPacket (const Adafruit_Fingerprint_Packet &p) |
Helper function to process a packet and send it over UART to the sensor. More... | |
uint8_t | getStructuredPacket (Adafruit_Fingerprint_Packet *p, uint16_t timeout=DEFAULTTIMEOUT) |
Helper function to receive data over UART from the sensor and process it into a packet. More... | |
Public Attributes | |
uint16_t | fingerID |
The matching location that is set by fingerFastSearch() | |
uint16_t | confidence |
uint16_t | templateCount |
The number of stored templates in the sensor, set by getTemplateCount() | |
uint16_t | status_reg = 0x0 |
The status register (set by getParameters) | |
uint16_t | system_id = 0x0 |
The system identifier (set by getParameters) | |
uint16_t | capacity = 64 |
The fingerprint capacity (set by getParameters) | |
uint16_t | security_level = 0 |
The security level (set by getParameters) | |
uint32_t | device_addr |
The device address (set by getParameters) More... | |
uint16_t | packet_len = 64 |
The max packet length (set by getParameters) | |
uint16_t | baud_rate = 57600 |
The UART baud rate (set by getParameters) | |
! Helper class to communicate with and keep state for fingerprint sensors
Adafruit_Fingerprint::Adafruit_Fingerprint | ( | HardwareSerial * | hs, |
uint32_t | password = 0x0 |
||
) |
Instantiates sensor with Hardware Serial.
hs | Pointer to HardwareSerial object |
password | 32-bit integer password (default is 0) |
Adafruit_Fingerprint::Adafruit_Fingerprint | ( | Stream * | serial, |
uint32_t | password = 0x0 |
||
) |
Instantiates sensor with a stream for Serial.
serial | Pointer to a Stream object |
password | 32-bit integer password (default is 0) |
void Adafruit_Fingerprint::begin | ( | uint32_t | baudrate | ) |
Initializes serial interface and baud rate.
baudrate | Sensor's UART baud rate (usually 57600, 9600 or 115200) |
boolean Adafruit_Fingerprint::verifyPassword | ( | void | ) |
Verifies the sensors' access password (default password is 0x0000000). A good way to also check if the sensors is active and responding.
uint8_t Adafruit_Fingerprint::getParameters | ( | void | ) |
Get the sensors parameters, fills in the member variables status_reg, system_id, capacity, security_level, device_addr, packet_len and baud_rate.
uint8_t Adafruit_Fingerprint::getImage | ( | void | ) |
Ask the sensor to take an image of the finger pressed on surface.
FINGERPRINT_OK
on success FINGERPRINT_NOFINGER
if no finger detected FINGERPRINT_PACKETRECIEVEERR
on communication error FINGERPRINT_IMAGEFAIL
on imaging error uint8_t Adafruit_Fingerprint::image2Tz | ( | uint8_t | slot = 1 | ) |
Ask the sensor to convert image to feature template.
slot | Location to place feature template (put one in 1 and another in 2 for verification to create model) |
FINGERPRINT_OK
on success FINGERPRINT_IMAGEMESS
if image is too messy FINGERPRINT_PACKETRECIEVEERR
on communication error FINGERPRINT_FEATUREFAIL
on failure to identify fingerprint features FINGERPRINT_INVALIDIMAGE
on failure to identify fingerprint features uint8_t Adafruit_Fingerprint::createModel | ( | void | ) |
Ask the sensor to take two print feature template and create a model.
FINGERPRINT_OK
on success FINGERPRINT_PACKETRECIEVEERR
on communication error FINGERPRINT_ENROLLMISMATCH
on mismatch of fingerprints uint8_t Adafruit_Fingerprint::emptyDatabase | ( | void | ) |
Ask the sensor to delete ALL models in memory.
FINGERPRINT_OK
on success FINGERPRINT_BADLOCATION
if the location is invalid FINGERPRINT_FLASHERR
if the model couldn't be written to flash memory FINGERPRINT_PACKETRECIEVEERR
on communication error uint8_t Adafruit_Fingerprint::storeModel | ( | uint16_t | location | ) |
Ask the sensor to store the calculated model for later matching.
location | The model location # |
FINGERPRINT_OK
on success FINGERPRINT_BADLOCATION
if the location is invalid FINGERPRINT_FLASHERR
if the model couldn't be written to flash memory FINGERPRINT_PACKETRECIEVEERR
on communication error uint8_t Adafruit_Fingerprint::loadModel | ( | uint16_t | location | ) |
Ask the sensor to load a fingerprint model from flash into buffer 1.
location | The model location # |
FINGERPRINT_OK
on success FINGERPRINT_BADLOCATION
if the location is invalid FINGERPRINT_PACKETRECIEVEERR
on communication error uint8_t Adafruit_Fingerprint::getModel | ( | void | ) |
Ask the sensor to transfer 256-byte fingerprint template from the buffer to the UART.
FINGERPRINT_OK
on success FINGERPRINT_PACKETRECIEVEERR
on communication error uint8_t Adafruit_Fingerprint::deleteModel | ( | uint16_t | location | ) |
Ask the sensor to delete a model in memory.
location | The model location # |
FINGERPRINT_OK
on success FINGERPRINT_BADLOCATION
if the location is invalid FINGERPRINT_FLASHERR
if the model couldn't be written to flash memory FINGERPRINT_PACKETRECIEVEERR
on communication error uint8_t Adafruit_Fingerprint::fingerFastSearch | ( | void | ) |
Ask the sensor to search the current slot 1 fingerprint features to match saved templates. The matching location is stored in fingerID and the matching confidence in confidence
FINGERPRINT_OK
on fingerprint match success FINGERPRINT_NOTFOUND
no match made FINGERPRINT_PACKETRECIEVEERR
on communication error uint8_t Adafruit_Fingerprint::fingerSearch | ( | uint8_t | slot = 1 | ) |
Ask the sensor to search the current slot fingerprint features to match saved templates. The matching location is stored in fingerID and the matching confidence in confidence
slot | The slot to use for the print search, defaults to 1 |
FINGERPRINT_OK
on fingerprint match success FINGERPRINT_NOTFOUND
no match made FINGERPRINT_PACKETRECIEVEERR
on communication error uint8_t Adafruit_Fingerprint::getTemplateCount | ( | void | ) |
Ask the sensor for the number of templates stored in memory. The number is stored in templateCount on success.
FINGERPRINT_OK
on success FINGERPRINT_PACKETRECIEVEERR
on communication error uint8_t Adafruit_Fingerprint::setPassword | ( | uint32_t | password | ) |
Set the password on the sensor (future communication will require password verification so don't forget it!!!)
password | 32-bit password code |
FINGERPRINT_OK
on success FINGERPRINT_PACKETRECIEVEERR
on communication error uint8_t Adafruit_Fingerprint::LEDcontrol | ( | bool | on | ) |
Control the built in LED.
on | True if you want LED on, False to turn LED off |
FINGERPRINT_OK
on success uint8_t Adafruit_Fingerprint::LEDcontrol | ( | uint8_t | control, |
uint8_t | speed, | ||
uint8_t | coloridx, | ||
uint8_t | count = 0 |
||
) |
Control the built in Aura LED (if exists). Check datasheet/manual for different colors and control codes available.
control | The control code (e.g. breathing, full on) |
speed | How fast to go through the breathing/blinking cycles |
coloridx | What color to light the indicator |
count | How many repeats of blinks/breathing cycles |
FINGERPRINT_OK
on fingerprint match success FINGERPRINT_NOTFOUND
no match made FINGERPRINT_PACKETRECIEVEERR
on communication error uint8_t Adafruit_Fingerprint::setBaudRate | ( | uint8_t | baudrate | ) |
Change UART baudrate.
baudrate | 8-bit Uart baudrate |
FINGERPRINT_OK
on success FINGERPRINT_PACKETRECIEVEERR
on communication error uint8_t Adafruit_Fingerprint::setSecurityLevel | ( | uint8_t | level | ) |
Change security level.
level | 8-bit security level |
FINGERPRINT_OK
on success FINGERPRINT_PACKETRECIEVEERR
on communication error uint8_t Adafruit_Fingerprint::setPacketSize | ( | uint8_t | size | ) |
Change packet size.
size | 8-bit packet size |
FINGERPRINT_OK
on success FINGERPRINT_PACKETRECIEVEERR
on communication error void Adafruit_Fingerprint::writeStructuredPacket | ( | const Adafruit_Fingerprint_Packet & | packet | ) |
Helper function to process a packet and send it over UART to the sensor.
packet | A structure containing the bytes to transmit |
uint8_t Adafruit_Fingerprint::getStructuredPacket | ( | Adafruit_Fingerprint_Packet * | packet, |
uint16_t | timeout = DEFAULTTIMEOUT |
||
) |
Helper function to receive data over UART from the sensor and process it into a packet.
packet | A structure containing the bytes received |
timeout | how many milliseconds we're willing to wait |
FINGERPRINT_OK
on success FINGERPRINT_TIMEOUT
or FINGERPRINT_BADPACKET
on failure uint16_t Adafruit_Fingerprint::confidence |
The confidence of the fingerFastSearch() match, higher numbers are more confidents
uint32_t Adafruit_Fingerprint::device_addr |
The device address (set by getParameters)