Skip to content

Commit

Permalink
fix all dox
Browse files Browse the repository at this point in the history
  • Loading branch information
ladyada committed Jan 21, 2018
1 parent 80e9477 commit 630e16e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
17 changes: 12 additions & 5 deletions Adafruit_Fingerprint.cpp
Expand Up @@ -43,14 +43,14 @@
***************************************************************************/


#if defined(__AVR__) || defined(ESP8266)
/**************************************************************************/
/*!
@brief Instantiates sensor with Software Serial
@param ss Pointer to SoftwareSerial object
@param password 32-bit integer password (default is 0)
*/
/**************************************************************************/
#if defined(__AVR__) || defined(ESP8266)
Adafruit_Fingerprint::Adafruit_Fingerprint(SoftwareSerial *ss, uint32_t password) {
thePassword = password;
theAddress = 0xFFFFFFFF;
Expand All @@ -69,7 +69,7 @@ Adafruit_Fingerprint::Adafruit_Fingerprint(SoftwareSerial *ss, uint32_t password
*/
/**************************************************************************/
Adafruit_Fingerprint::Adafruit_Fingerprint(HardwareSerial *ss, uint32_t password) {
Adafruit_Fingerprint::Adafruit_Fingerprint(HardwareSerial *hs, uint32_t password) {
thePassword = password;
theAddress = 0xFFFFFFFF;

Expand Down Expand Up @@ -221,6 +221,7 @@ uint8_t Adafruit_Fingerprint::emptyDatabase(void) {
@returns <code>FINGERPRINT_NOTFOUND</code> no match made
@returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
*/
/**************************************************************************/
uint8_t Adafruit_Fingerprint::fingerFastSearch(void) {
// high speed search of slot #1 starting at page 0x0000 and page #0x00A3
GET_CMD_PACKET(FINGERPRINT_HISPEEDSEARCH, 0x01, 0x00, 0x00, 0x00, 0xA3);
Expand All @@ -244,6 +245,7 @@ uint8_t Adafruit_Fingerprint::fingerFastSearch(void) {
@returns <code>FINGERPRINT_OK</code> on success
@returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
*/
/**************************************************************************/
uint8_t Adafruit_Fingerprint::getTemplateCount(void) {
GET_CMD_PACKET(FINGERPRINT_TEMPLATECOUNT);

Expand All @@ -261,15 +263,17 @@ uint8_t Adafruit_Fingerprint::getTemplateCount(void) {
@returns <code>FINGERPRINT_OK</code> on success
@returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
*/
/**************************************************************************/
uint8_t Adafruit_Fingerprint::setPassword(uint32_t password) {
SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16), (password >> 8), password);
}

/**************************************************************************/
/*!
@brief Helper function to process a packet and send it over UART to the sensor
@params packet A structure containing the bytes to transmit
@param packet A structure containing the bytes to transmit
*/
/**************************************************************************/

void Adafruit_Fingerprint::writeStructuredPacket(const Adafruit_Fingerprint_Packet & packet) {
SERIAL_WRITE_U16(packet.start_code);
Expand All @@ -295,9 +299,12 @@ void Adafruit_Fingerprint::writeStructuredPacket(const Adafruit_Fingerprint_Pack
/**************************************************************************/
/*!
@brief Helper function to receive data over UART from the sensor and process it into a packet
@params packet A structure containing the bytes received
@params timeount how many milliseconds we're willing to wait
@param packet A structure containing the bytes received
@param timeout how many milliseconds we're willing to wait
@returns <code>FINGERPRINT_OK</code> on success
@returns <code>FINGERPRINT_TIMEOUT</code> or <code>FINGERPRINT_BADPACKET</code> on failure
*/
/**************************************************************************/
uint8_t Adafruit_Fingerprint::getStructuredPacket(Adafruit_Fingerprint_Packet * packet, uint16_t timeout) {
uint8_t byte;
uint16_t idx=0, timer=0;
Expand Down
28 changes: 20 additions & 8 deletions Adafruit_Fingerprint.h
Expand Up @@ -70,9 +70,20 @@

//#define FINGERPRINT_DEBUG

#define DEFAULTTIMEOUT 1000 // milliseconds
#define DEFAULTTIMEOUT 1000 ///< UART reading timeout in milliseconds

///! Helper class to craft UART packets
struct Adafruit_Fingerprint_Packet {

/**************************************************************************/
/*!
@brief Create a new UART-borne packet
@param type Command, data, ack type packet
@param length Size of payload
@param data Pointer to bytes of size length we will memcopy into the internal buffer
*/
/**************************************************************************/

Adafruit_Fingerprint_Packet(uint8_t type, uint16_t length, uint8_t * data) {
this->start_code = FINGERPRINT_STARTCODE;
this->type = type;
Expand All @@ -84,19 +95,20 @@ struct Adafruit_Fingerprint_Packet {
else
memcpy(this->data, data, 64);
}
uint16_t start_code;
uint8_t address[4];
uint8_t type;
uint16_t length;
uint8_t data[64];
uint16_t start_code; ///< "Wakeup" code for packet detection
uint8_t address[4]; ///< 32-bit Fingerprint sensor address
uint8_t type; ///< Type of packet
uint16_t length; ///< Length of packet
uint8_t data[64]; ///< The raw buffer for packet payload
};

///! Helper class to communicate with and keep state for fingerprint sensors
class Adafruit_Fingerprint {
public:
#if defined(__AVR__) || defined(ESP8266)
Adafruit_Fingerprint(SoftwareSerial *, uint32_t password = 0x0);
Adafruit_Fingerprint(SoftwareSerial *ss, uint32_t password = 0x0);
#endif
Adafruit_Fingerprint(HardwareSerial *, uint32_t password = 0x0);
Adafruit_Fingerprint(HardwareSerial *hs, uint32_t password = 0x0);

void begin(uint32_t baud);

Expand Down

0 comments on commit 630e16e

Please sign in to comment.