Adafruit Fingerprint Sensor Library
- 添加指纹
- 识别指纹
- 清空指纹
- 删除指纹
- 修改数据库密码
1.Instantiates sensor with Software/Hardware Serial
-> ss/hs
Pointer to HardwareSerial object
-> password
32-bit integer password (default is 0)
Adafruit_Fingerprint::Adafruit_Fingerprint(SoftwareSerial *ss, uint32_t password)
Adafruit_Fingerprint::Adafruit_Fingerprint(HardwareSerial *hs, uint32_t password)
2.Initializes serial interface and baud rate
-> baudrate
Sensor's UART baud rate (usually 57600, 9600 or 115200)
void Adafruit_Fingerprint::begin(uint32_t baudrate)
3.Verifies the sensors' access password (default password is 0x0000000).
A good way to also check if the sensors is active and responding
-> returns True
if password is correct
boolean Adafruit_Fingerprint::verifyPassword(void)
uint8_t Adafruit_Fingerprint::checkPassword(void)
4.Ask the sensor to take an image of the finger pressed on surface
-> returns FINGERPRINT_OK
on success
-> returns FINGERPRINT_NOFINGER
if no finger detected
-> returns FINGERPRINT_PACKETRECIEVEERR
on communication error
-> returns FINGERPRINT_IMAGEFAIL
on imaging error
uint8_t Adafruit_Fingerprint::getImage(void)
5.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)
-> returns FINGERPRINT_OK
on success
-> returns FINGERPRINT_IMAGEMESS
if image is too messy
-> returns FINGERPRINT_PACKETRECIEVEERR
on communication error
-> returns FINGERPRINT_FEATUREFAIL
on failure to identify fingerprint features
-> returns FINGERPRINT_INVALIDIMAGE
on failure to identify fingerprint features
uint8_t Adafruit_Fingerprint::image2Tz(uint8_t slot)
6.Ask the sensor to take two print feature template and create a model
-> returns FINGERPRINT_OK
on success
-> returns FINGERPRINT_PACKETRECIEVEERR
on communication error
-> returns FINGERPRINT_ENROLLMISMATCH
on mismatch of fingerprints
uint8_t Adafruit_Fingerprint::createModel(void)
7.Ask the sensor to store the calculated model for later matching
-> location
The model location
-> returns FINGERPRINT_OK
on success
-> returns FINGERPRINT_BADLOCATION
if the location is invalid
-> returns FINGERPRINT_FLASHERR
if the model couldn't be written to flash memory
-> returns FINGERPRINT_PACKETRECIEVEERR
on communication error
uint8_t Adafruit_Fingerprint::storeModel(uint16_t location)
8.Ask the sensor to load a fingerprint model from flash into buffer 1
-> location
The model location
-> returns FINGERPRINT_OK
on success
-> returns FINGERPRINT_BADLOCATION
if the location is invalid
-> returns FINGERPRINT_PACKETRECIEVEERR
on communication error
uint8_t Adafruit_Fingerprint::loadModel(uint16_t location)
9.Ask the sensor to transfer 256-byte fingerprint template from the buffer to the UART
-> returns FINGERPRINT_OK
on success
-> returns FINGERPRINT_PACKETRECIEVEERR
on communication error
uint8_t Adafruit_Fingerprint::getModel(void)
10.Ask the sensor to delete a model in memory
-> location
The model location
-> returns FINGERPRINT_OK
on success
-> returns FINGERPRINT_BADLOCATION
if the location is invalid
-> returns FINGERPRINT_FLASHERR
if the model couldn't be written to flash memory
-> returns FINGERPRINT_PACKETRECIEVEERR
on communication error
uint8_t Adafruit_Fingerprint::deleteModel(uint16_t location)
11.Ask the sensor to delete ALL models in memory
-> returns FINGERPRINT_OK
on success
-> returns FINGERPRINT_BADLOCATION
if the location is invalid
-> returns FINGERPRINT_FLASHERR
if the model couldn't be written to flash memory
-> returns FINGERPRINT_PACKETRECIEVEERR
on communication error
uint8_t Adafruit_Fingerprint::emptyDatabase(void)
12.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
-> returns FINGERPRINT_OK
on fingerprint match success
-> returns FINGERPRINT_NOTFOUND
no match made
-> returns FINGERPRINT_PACKETRECIEVEERR
on communication error
uint8_t Adafruit_Fingerprint::fingerFastSearch(void)
13.Ask the sensor for the number of templates stored in memory.
The number is stored in templateCount on success.
-> returns FINGERPRINT_OK
on success
-> returns FINGERPRINT_PACKETRECIEVEERR
on communication error
uint8_t Adafruit_Fingerprint::getTemplateCount(void)
14.Set the password on the sensor
-> password
32-bit password code
-> returns FINGERPRINT_OK
on success
-> returns FINGERPRINT_PACKETRECIEVEERR
on communication error
uint8_t Adafruit_Fingerprint::setPassword(uint32_t password)
15.Helper function to process a packet and send it over UART to the sensor
-> packet
A structure containing the bytes to transmit
void Adafruit_Fingerprint::writeStructuredPacket(const Adafruit_Fingerprint_Packet & packet)
16.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
-> returns FINGERPRINT_OK
on success
-> returns FINGERPRINT_TIMEOUT
or FINGERPRINT_BADPACKET
on failure
uint8_t Adafruit_Fingerprint::getStructuredPacket(Adafruit_Fingerprint_Packet * packet, uint16_t timeout)