Simplifies reading the WaveShare fingerprint scanner module.
More...
#include "simpletools.h"
#include "fdserial.h"
Go to the source code of this file.
|
#define | ACK_SUCCESS 0x00 |
|
#define | ACK_FAIL 0x01 |
|
#define | ACK_FULL 0x04 |
|
#define | ACK_NOUSER 0x05 |
|
#define | ACK_USER_EXISTS 0x07 |
|
#define | ACK_TIMEOUT 0x08 |
|
#define | CMD_SLEEP 0x2C |
|
#define | CMD_SET_MODE 0x2D |
|
#define | CMD_ADD_FINGERPRINT_1 0x01 |
|
#define | CMD_ADD_FINGERPRINT_2 0x02 |
|
#define | CMD_ADD_FINGERPRINT_3 0x03 |
|
#define | CMD_DELETE_USER 0x04 |
|
#define | CMD_DELETE_ALL_USERS 0x05 |
|
#define | CMD_GET_USERS_COUNT 0x09 |
|
#define | CMD_SCAN_COMPARE_1_TO_1 0x0B |
|
#define | CMD_SCAN_COMPARE_1_TO_N 0x0C |
|
#define | CMD_READ_USER_PRIVLAGE 0x0A |
|
#define | CMD_SENSITIVITY 0x28 |
|
#define | CMD_SCAN_GET_IMAGE 0x24 |
|
#define | CMD_SCAN_GET_EIGENVALS 0x23 |
|
#define | CMD_SCAN_PUT_EIGENVALS 0x44 |
|
#define | CMD_PUT_EIGENVALS_COMPARE_1_TO_1 0x42 |
|
#define | CMD_PUT_EIGENVALS_COMPARE_1_TO_N 0x43 |
|
#define | CMD_GET_USER_EIGENVALS 0x31 |
|
#define | CMD_PUT_USER_EIGENVALS 0x41 |
|
#define | CMD_GET_USERS_INFO 0x2B |
|
#define | CMD_SET_SCAN_TIMEOUT 0x2E |
|
|
fpScanner * | fingerprint_open (int pin_rx, int pin_tx) |
| Open a connection to a WaveShare fingerprint scanner module. More...
|
|
void | fingerprint_close (fpScanner *device) |
| Close a connection and recover all memory set aside for the fingerprint scanner instance. More...
|
|
int | fingerprint_allowOverwrite (fpScanner *device, char b) |
| Allow overwriting of fingerprints already stored in the memory of the Fingerprint Scanner. More...
|
|
int | fingerprint_add (fpScanner *device, int userId, char userLevel, int scanNumber) |
| Add a user's fingerprint and info to the fingerprint scanner's memory. More...
|
|
int | fingerprint_deleteUser (fpScanner *device, int userId) |
| Deletes a user (or all users if no user is specified) from the fingerprint module's memory. More...
|
|
int | fingerprint_countUsers (fpScanner *device) |
| Returns the number or users stored in the fingerprint scanner's memory. More...
|
|
int | fingerprint_scan (fpScanner *device, int userId, int *uid) |
| Scans a user fingerprint and compares it to the provided User ID. If no User ID is provided, it finds and stores the User ID in the specified variable. More...
|
|
int | fingerprint_lookupUserPrivlage (fpScanner *device, int userId) |
| Looks up the stored user privalage for the provided User ID. More...
|
|
int | fingerprint_setTimeout (fpScanner *device, int timeout) |
| Sets the timeout for a single scan. More...
|
|
int | fingerprint_setStrictness (fpScanner *device, char s_level) |
| Sets the comparison strictness. More...
|
|
void | fingerprint_sendCommand (fpScanner *device, char __fpCmd, char __fpParam1, char __fpParam2, char __fpParam3) |
| Low-level function used to send a command to the Fingerprint Scanner. More...
|
|
void | fingerprint_readResponse (fpScanner *device, char *__fpResponse) |
| Low-level function used to read a response from the Fingerprint Scanner. More...
|
|
Simplifies reading the WaveShare fingerprint scanner module.
- Author
- Matthew Matz
- Version
- 0.50
- Copyright
- Copyright (C) Parallax, Inc. 2017. All Rights MIT Licensed.
int fingerprint_add |
( |
fpScanner * |
device, |
|
|
int |
userId, |
|
|
char |
userLevel, |
|
|
int |
scanNumber |
|
) |
| |
Add a user's fingerprint and info to the fingerprint scanner's memory.
- Parameters
-
*device | device identifier returned by fingerprint_open function. |
userId | a User Id number to assign to the user. May be any positive integer from 1 to 65535. |
userLevel | an abitrary level that can be attached to each user. Must be a (1), (2) or (3). |
scanNumber | To record a fingerprint, the scanner must read it three times. Passing a (1), (2), or (3) tells the scanner to record the first, second, or third scans needed to record the fingerprint. Passing any integer other than (1), (2), or (3) will cause the fingerprint scanner to take all three scans in succession. |
- Returns
- ACK_SUCCESS, ACK_FAIL, ACK_FULL, ACK_TIMEOUT, or ACK_USER_EXISTS.
int fingerprint_allowOverwrite |
( |
fpScanner * |
device, |
|
|
char |
b |
|
) |
| |
Allow overwriting of fingerprints already stored in the memory of the Fingerprint Scanner.
- Parameters
-
*device | device identifier returned by fingerprint_open function. |
b | A (1) allows overwiting, a (0) prevents overwriting stored fingerprints. |
- Returns
- ACK_SUCCESS or ACK_FAIL.
void fingerprint_close |
( |
fpScanner * |
device | ) |
|
Close a connection and recover all memory set aside for the fingerprint scanner instance.
- Parameters
-
*device | device identifier returned by fingerprint_open function. |
int fingerprint_countUsers |
( |
fpScanner * |
device | ) |
|
Returns the number or users stored in the fingerprint scanner's memory.
- Parameters
-
*device | device identifier returned by fingerprint_open function. |
- Returns
- ACK_SUCCESS or ACK_FAIL.
int fingerprint_deleteUser |
( |
fpScanner * |
device, |
|
|
int |
userId |
|
) |
| |
Deletes a user (or all users if no user is specified) from the fingerprint module's memory.
- Parameters
-
*device | device identifier returned by fingerprint_open function. |
userId | a User Id of the user to delete. Passing an integer (0) or less than (0) will delete all users from the fingerprint module. |
- Returns
- ACK_SUCCESS or ACK_FAIL.
int fingerprint_lookupUserPrivlage |
( |
fpScanner * |
device, |
|
|
int |
userId |
|
) |
| |
Looks up the stored user privalage for the provided User ID.
- Parameters
-
*device | device identifier returned by fingerprint_open function. |
userId | The User ID to look up. |
- Returns
- User privalage (1, 2, or 3) or ACK_FAIL.
fpScanner* fingerprint_open |
( |
int |
pin_rx, |
|
|
int |
pin_tx |
|
) |
| |
Open a connection to a WaveShare fingerprint scanner module.
- Parameters
-
pin_rx | Propeller I/O pin connected to fingerprint scanner's RX pin. |
pin_tx | Propeller I/O pin connected to fingerprint scanner's TX pin. |
- Returns
- Fingerprint Scanner device identifier for use with functions in fingerprint scanner library and functions with text_t parameter in simpletext library.
void fingerprint_readResponse |
( |
fpScanner * |
device, |
|
|
char * |
__fpResponse |
|
) |
| |
Low-level function used to read a response from the Fingerprint Scanner.
- Parameters
-
*device | device identifier returned by fingerprint_open function. |
__fpResponse | char array to store the response from the fingerprint scanner. |
- Note
- Must follow the fingerprint_sendCommand() function.
int fingerprint_scan |
( |
fpScanner * |
device, |
|
|
int |
userId, |
|
|
int * |
uid |
|
) |
| |
Scans a user fingerprint and compares it to the provided User ID. If no User ID is provided, it finds and stores the User ID in the specified variable.
- Parameters
-
*device | device identifier returned by fingerprint_open function. |
userId | the User ID to match the fingerprint being scanned to. If this is set to (0), it will check the scan against all of the stored user fingerprints. |
*uid | a variable to store the matched User Id of the scanned fingerprint into. Stores (0) into the variable if no matching user was found. |
- Returns
- User Privalage (1, 2, or 3) or ACK_FAIL.
void fingerprint_sendCommand |
( |
fpScanner * |
device, |
|
|
char |
__fpCmd, |
|
|
char |
__fpParam1, |
|
|
char |
__fpParam2, |
|
|
char |
__fpParam3 |
|
) |
| |
Low-level function used to send a command to the Fingerprint Scanner.
- Parameters
-
*device | device identifier returned by fingerprint_open function. |
__fpCmd | the command to be sent. |
__fpParam1 | the first parameter of the command. |
__fpParam2 | the second parameter of the command. |
__fpParam3 | the third parameter of the command. |
- Note
- Must be immediately followed by the fingerprint_readResponse() function.
int fingerprint_setStrictness |
( |
fpScanner * |
device, |
|
|
char |
s_level |
|
) |
| |
Sets the comparison strictness.
- Parameters
-
*device | device identifier returned by fingerprint_open function. |
s_level | A positive integer to set the comparison level to: (0) [not very strict] to (9) [very strict]. |
- Returns
- ACK_SUCCESS or ACK_FAIL.
int fingerprint_setTimeout |
( |
fpScanner * |
device, |
|
|
int |
timeout |
|
) |
| |
Sets the timeout for a scan.
- Parameters
-
*device | device identifier returned by fingerprint_open function. |
timeout | how long to keep trying before timing out. Specifies the number of scans the module attempts before timing out. |
- Returns
- ACK_SUCCESS or ACK_FAIL.