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
29 changes: 29 additions & 0 deletions Adafruit_Fingerprint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,25 @@ void Adafruit_Fingerprint::begin(uint32_t baudrate) {
#endif
}

/**************************************************************************/
/*!
@brief Initializes serial interface and baud rate
@param baudrate Sensor's UART baud rate (usually 57600, 9600 or 115200)
@param rx pin connected to the Sensor to receive data
@param tx pin connected to the Sensor to transmit data
*/
/**************************************************************************/
void Adafruit_Fingerprint::begin(uint32_t baudrate, uint32_t rx, uint32_t tx) {
delay(1000); // one second delay to let the sensor 'boot up'

if (hwSerial)
hwSerial->begin(baudrate,SERIAL_8N1,rx,tx);
#if defined(__AVR__) || defined(ESP8266) || defined(FREEDOM_E300_HIFIVE1)
if (swSerial)
swSerial->begin(baudrate,SERIAL_8N1,rx,tx);
#endif
}

/**************************************************************************/
/*!
@brief Verifies the sensors' access password (default password is
Expand Down Expand Up @@ -417,6 +436,16 @@ uint8_t Adafruit_Fingerprint::setPassword(uint32_t password) {
(uint8_t)(password & 0xFF));
}

/**************************************************************************/
/*!
@brief Send soft reset instruction to the module
@returns <code>FINGERPRINT_OK</code> on success
@returns Other: device is abnormal
*/
uint8_t Adafruit_Fingerprint::softReset(void) {
SEND_CMD_PACKET(FINGERPRINT_SOFT_RESET);
}

/**************************************************************************/
/*!
@brief Writing module registers
Expand Down
3 changes: 3 additions & 0 deletions Adafruit_Fingerprint.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
0x1B //!< Asks the sensor to search for a matching fingerprint template to the
//!< last model generated
#define FINGERPRINT_TEMPLATECOUNT 0x1D //!< Read finger template numbers
#define FINGERPRINT_SOFT_RESET 0x3D //!< Soft Reset
#define FINGERPRINT_AURALEDCONFIG 0x35 //!< Aura LED control
#define FINGERPRINT_LEDON 0x50 //!< Turn on the onboard LED
#define FINGERPRINT_LEDOFF 0x51 //!< Turn off the onboard LED
Expand Down Expand Up @@ -168,6 +169,7 @@ class Adafruit_Fingerprint {
Adafruit_Fingerprint(Stream *serial, uint32_t password = 0x0);

void begin(uint32_t baud);
void begin(uint32_t baud, uint32_t rx, uint32_t tx);

boolean verifyPassword(void);
uint8_t getParameters(void);
Expand All @@ -185,6 +187,7 @@ class Adafruit_Fingerprint {
uint8_t fingerSearch(uint8_t slot = 1);
uint8_t getTemplateCount(void);
uint8_t setPassword(uint32_t password);
uint8_t softReset(void);
uint8_t LEDcontrol(bool on);
uint8_t LEDcontrol(uint8_t control, uint8_t speed, uint8_t coloridx,
uint8_t count = 0);
Expand Down
Loading