Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions Adafruit_Fingerprint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,21 @@ boolean Adafruit_Fingerprint::verifyPassword(void) {
return checkPassword() == FINGERPRINT_OK;
}

/**************************************************************************/
/*!
@brief Verifies the sensors' access password (default password is
0x0000000). A good way to also check if the sensors is active and responding
@returns <code>FINGERPRINT_OK</code> on success
@returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
@returns <code>FINGERPRINT_PASSFAIL</code> on wrong password
*/
/**************************************************************************/

uint8_t Adafruit_Fingerprint::checkPassword(void) {
GET_CMD_PACKET(FINGERPRINT_VERIFYPASSWORD, (uint8_t)(thePassword >> 24),
(uint8_t)(thePassword >> 16), (uint8_t)(thePassword >> 8),
(uint8_t)(thePassword & 0xFF));
if (packet.data[0] == FINGERPRINT_OK)
return FINGERPRINT_OK;
else
return FINGERPRINT_PACKETRECIEVEERR;
return packet.data[0];
}

/**************************************************************************/
Expand Down
5 changes: 2 additions & 3 deletions Adafruit_Fingerprint.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
#define FINGERPRINT_UPLOADFAIL 0x0F //!< Error when uploading image
#define FINGERPRINT_DELETEFAIL 0x10 //!< Failed to delete the template
#define FINGERPRINT_DBCLEARFAIL 0x11 //!< Failed to clear finger library
#define FINGERPRINT_PASSFAIL \
0x13 //!< Find whether the fingerprint passed or failed
#define FINGERPRINT_PASSFAIL 0x13 //!< Wrong password
#define FINGERPRINT_INVALIDIMAGE \
0x15 //!< Failed to generate image because of lac of valid primary image
#define FINGERPRINT_FLASHERR 0x18 //!< Error when writing flash
Expand Down Expand Up @@ -137,6 +136,7 @@ class Adafruit_Fingerprint {
void begin(uint32_t baud);

boolean verifyPassword(void);
uint8_t checkPassword(void);
uint8_t getParameters(void);

uint8_t getImage(void);
Expand Down Expand Up @@ -178,7 +178,6 @@ class Adafruit_Fingerprint {
uint16_t baud_rate = 57600; ///< The UART baud rate (set by getParameters)

private:
uint8_t checkPassword(void);
uint32_t thePassword;
uint32_t theAddress;
uint8_t recvPacket[20];
Expand Down