Fingerprint and demo library for ARM-STM32 made from the Arduino library for R503
Dependents: R503_fingerprint_HelloWorldV4
Fingerprint.cpp@5:6fff11306a66, 2021-05-26 (annotated)
- Committer:
- cdupaty
- Date:
- Wed May 26 12:47:44 2021 +0000
- Revision:
- 5:6fff11306a66
- Parent:
- 3:394a5735eea0
Update May 26, 2021
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cdupaty | 0:35cd316e4b41 | 1 | /*! |
cdupaty | 0:35cd316e4b41 | 2 | * @file Fingerprint.cpp |
cdupaty | 0:35cd316e4b41 | 3 | * @mainpage Adafruit Fingerprint Sensor Library |
cdupaty | 0:35cd316e4b41 | 4 | * @section intro_sec Introduction |
cdupaty | 0:35cd316e4b41 | 5 | * This is a library for our optical Fingerprint sensor |
cdupaty | 0:35cd316e4b41 | 6 | * Designed specifically to work with the Adafruit Fingerprint sensor |
cdupaty | 0:35cd316e4b41 | 7 | * ---. http://www.adafruit.com/products/751 |
cdupaty | 0:35cd316e4b41 | 8 | * These displays use TTL Serial to communicate, 2 pins are required to |
cdupaty | 0:35cd316e4b41 | 9 | * interface |
cdupaty | 0:35cd316e4b41 | 10 | * Adafruit invests time and resources providing this open source code, |
cdupaty | 0:35cd316e4b41 | 11 | * please support Adafruit and open-source hardware by purchasing |
cdupaty | 0:35cd316e4b41 | 12 | * products from Adafruit! |
cdupaty | 0:35cd316e4b41 | 13 | * @section author Author |
cdupaty | 0:35cd316e4b41 | 14 | * Written by Limor Fried/Ladyada for Adafruit Industries. |
cdupaty | 2:6f273d942c43 | 15 | * @section license License |
cdupaty | 2:6f273d942c43 | 16 | * BSD license, all text above must be included in any redistribution |
cdupaty | 0:35cd316e4b41 | 17 | * |
cdupaty | 2:6f273d942c43 | 18 | * STM32 adaptation by Christian Dupaty 03/2021 |
cdupaty | 0:35cd316e4b41 | 19 | * |
cdupaty | 0:35cd316e4b41 | 20 | */ |
cdupaty | 0:35cd316e4b41 | 21 | |
cdupaty | 5:6fff11306a66 | 22 | #include "Fingerprint.h" |
cdupaty | 2:6f273d942c43 | 23 | #include "mbed.h" |
cdupaty | 0:35cd316e4b41 | 24 | |
cdupaty | 0:35cd316e4b41 | 25 | |
cdupaty | 0:35cd316e4b41 | 26 | /*! |
cdupaty | 0:35cd316e4b41 | 27 | * @brief Gets the command packet |
cdupaty | 0:35cd316e4b41 | 28 | */ |
cdupaty | 0:35cd316e4b41 | 29 | #define GET_CMD_PACKET(...) \ |
cdupaty | 0:35cd316e4b41 | 30 | uint8_t data[] = {__VA_ARGS__}; \ |
cdupaty | 0:35cd316e4b41 | 31 | Fingerprint_Packet packet(FINGERPRINT_COMMANDPACKET, sizeof(data),data); \ |
cdupaty | 0:35cd316e4b41 | 32 | writeStructuredPacket(packet); \ |
cdupaty | 0:35cd316e4b41 | 33 | if (getStructuredPacket(&packet) != FINGERPRINT_OK) \ |
cdupaty | 0:35cd316e4b41 | 34 | return FINGERPRINT_PACKETRECIEVEERR; \ |
fduchiron | 1:f392aee31272 | 35 | if (packet.type != FINGERPRINT_ACKPACKET) \ |
cdupaty | 0:35cd316e4b41 | 36 | return FINGERPRINT_PACKETRECIEVEERR; |
cdupaty | 0:35cd316e4b41 | 37 | |
cdupaty | 0:35cd316e4b41 | 38 | /*! |
cdupaty | 0:35cd316e4b41 | 39 | * @brief Sends the command packet |
cdupaty | 0:35cd316e4b41 | 40 | */ |
cdupaty | 0:35cd316e4b41 | 41 | #define SEND_CMD_PACKET(...) \ |
cdupaty | 0:35cd316e4b41 | 42 | GET_CMD_PACKET(__VA_ARGS__); \ |
fduchiron | 1:f392aee31272 | 43 | return packet.data[0]; |
cdupaty | 0:35cd316e4b41 | 44 | |
cdupaty | 0:35cd316e4b41 | 45 | /*************************************************************************** |
cdupaty | 0:35cd316e4b41 | 46 | PUBLIC FUNCTIONS |
cdupaty | 0:35cd316e4b41 | 47 | ***************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 48 | |
cdupaty | 0:35cd316e4b41 | 49 | |
cdupaty | 0:35cd316e4b41 | 50 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 51 | /*! |
cdupaty | 0:35cd316e4b41 | 52 | @brief Instantiates sensor with Software Serial |
cdupaty | 0:35cd316e4b41 | 53 | @param ss Pointer to SoftwareSerial object |
cdupaty | 0:35cd316e4b41 | 54 | @param password 32-bit integer password (default is 0) |
cdupaty | 0:35cd316e4b41 | 55 | */ |
cdupaty | 0:35cd316e4b41 | 56 | /**************************************************************************/ |
cdupaty | 2:6f273d942c43 | 57 | Fingerprint::Fingerprint(PinName serialTX, PinName serialRX, uint32_t password) : R503Serial(serialTX, serialRX) |
cdupaty | 0:35cd316e4b41 | 58 | { |
cdupaty | 0:35cd316e4b41 | 59 | thePassword = password; |
cdupaty | 0:35cd316e4b41 | 60 | theAddress = 0xFFFFFFFF; |
cdupaty | 2:6f273d942c43 | 61 | |
cdupaty | 0:35cd316e4b41 | 62 | status_reg = 0x0; ///< The status register (set by getParameters) |
cdupaty | 0:35cd316e4b41 | 63 | system_id = 0x0; ///< The system identifier (set by getParameters) |
cdupaty | 0:35cd316e4b41 | 64 | capacity = 64; ///< The fingerprint capacity (set by getParameters) |
cdupaty | 0:35cd316e4b41 | 65 | security_level = 0; ///< The security level (set by getParameters) |
cdupaty | 2:6f273d942c43 | 66 | device_addr = 0xFFFFFFFF; ///< The device address (set by getParameters) |
cdupaty | 0:35cd316e4b41 | 67 | packet_len = 64; ///< The max packet length (set by getParameters) |
cdupaty | 0:35cd316e4b41 | 68 | baud_rate = 57600; ///< The UART baud rate (set by getParameters) |
cdupaty | 2:6f273d942c43 | 69 | // Init buffer de reception, les deux pointeurs egaux |
cdupaty | 2:6f273d942c43 | 70 | pe=buffUART; |
cdupaty | 2:6f273d942c43 | 71 | pl=buffUART; |
cdupaty | 2:6f273d942c43 | 72 | // active IT sur reception UART vers methode receiveUART |
cdupaty | 2:6f273d942c43 | 73 | R503Serial.attach(callback(this,&Fingerprint::receiveUART),RawSerial::RxIrq); |
cdupaty | 0:35cd316e4b41 | 74 | } |
cdupaty | 0:35cd316e4b41 | 75 | |
cdupaty | 0:35cd316e4b41 | 76 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 77 | /*! |
cdupaty | 0:35cd316e4b41 | 78 | @brief Initializes serial interface and baud rate |
cdupaty | 0:35cd316e4b41 | 79 | @param baudrate Sensor's UART baud rate (usually 57600, 9600 or 115200) |
cdupaty | 0:35cd316e4b41 | 80 | */ |
cdupaty | 0:35cd316e4b41 | 81 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 82 | void Fingerprint::begin(uint32_t baudrate) { |
cdupaty | 0:35cd316e4b41 | 83 | R503Serial.baud(baudrate); |
cdupaty | 0:35cd316e4b41 | 84 | } |
cdupaty | 0:35cd316e4b41 | 85 | |
cdupaty | 0:35cd316e4b41 | 86 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 87 | /*! |
cdupaty | 0:35cd316e4b41 | 88 | @brief Verifies the sensors' access password (default password is |
cdupaty | 0:35cd316e4b41 | 89 | 0x0000000). A good way to also check if the sensors is active and responding |
cdupaty | 0:35cd316e4b41 | 90 | @returns True if password is correct |
cdupaty | 0:35cd316e4b41 | 91 | */ |
cdupaty | 0:35cd316e4b41 | 92 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 93 | bool Fingerprint::verifyPassword(void) { |
cdupaty | 0:35cd316e4b41 | 94 | return checkPassword() == FINGERPRINT_OK; |
cdupaty | 0:35cd316e4b41 | 95 | } |
cdupaty | 0:35cd316e4b41 | 96 | |
cdupaty | 0:35cd316e4b41 | 97 | uint8_t Fingerprint::checkPassword(void) { |
cdupaty | 0:35cd316e4b41 | 98 | GET_CMD_PACKET(FINGERPRINT_VERIFYPASSWORD, (uint8_t)(thePassword >> 24),(uint8_t)(thePassword >> 16), (uint8_t)(thePassword >> 8),(uint8_t)(thePassword & 0xFF)); |
fduchiron | 1:f392aee31272 | 99 | if (packet.data[0] == FINGERPRINT_OK) |
cdupaty | 0:35cd316e4b41 | 100 | return FINGERPRINT_OK; |
cdupaty | 0:35cd316e4b41 | 101 | else |
cdupaty | 0:35cd316e4b41 | 102 | return FINGERPRINT_PACKETRECIEVEERR; |
cdupaty | 0:35cd316e4b41 | 103 | } |
cdupaty | 0:35cd316e4b41 | 104 | |
cdupaty | 0:35cd316e4b41 | 105 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 106 | /*! |
cdupaty | 0:35cd316e4b41 | 107 | @brief Get the sensors parameters, fills in the member variables |
cdupaty | 0:35cd316e4b41 | 108 | status_reg, system_id, capacity, security_level, device_addr, packet_len |
cdupaty | 0:35cd316e4b41 | 109 | and baud_rate |
cdupaty | 0:35cd316e4b41 | 110 | @returns True if password is correct |
cdupaty | 0:35cd316e4b41 | 111 | */ |
cdupaty | 0:35cd316e4b41 | 112 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 113 | uint8_t Fingerprint::getParameters(void) { |
cdupaty | 0:35cd316e4b41 | 114 | GET_CMD_PACKET(FINGERPRINT_READSYSPARAM); |
cdupaty | 0:35cd316e4b41 | 115 | |
fduchiron | 1:f392aee31272 | 116 | status_reg = ((uint16_t)packet.data[1] << 8) | packet.data[2]; |
fduchiron | 1:f392aee31272 | 117 | system_id = ((uint16_t)packet.data[3] << 8) | packet.data[4]; |
fduchiron | 1:f392aee31272 | 118 | capacity = ((uint16_t)packet.data[5] << 8) | packet.data[6]; |
fduchiron | 1:f392aee31272 | 119 | security_level = ((uint16_t)packet.data[7] << 8) | packet.data[8]; |
fduchiron | 1:f392aee31272 | 120 | device_addr = ((uint32_t)packet.data[9] << 24) | |
fduchiron | 1:f392aee31272 | 121 | ((uint32_t)packet.data[10] << 16) | |
fduchiron | 1:f392aee31272 | 122 | ((uint32_t)packet.data[11] << 8) | (uint32_t)packet.data[12]; |
fduchiron | 1:f392aee31272 | 123 | packet_len = ((uint16_t)packet.data[13] << 8) | packet.data[14]; |
cdupaty | 0:35cd316e4b41 | 124 | if (packet_len == 0) { |
cdupaty | 0:35cd316e4b41 | 125 | packet_len = 32; |
cdupaty | 0:35cd316e4b41 | 126 | } else if (packet_len == 1) { |
cdupaty | 0:35cd316e4b41 | 127 | packet_len = 64; |
cdupaty | 0:35cd316e4b41 | 128 | } else if (packet_len == 2) { |
cdupaty | 0:35cd316e4b41 | 129 | packet_len = 128; |
cdupaty | 0:35cd316e4b41 | 130 | } else if (packet_len == 3) { |
cdupaty | 0:35cd316e4b41 | 131 | packet_len = 256; |
cdupaty | 0:35cd316e4b41 | 132 | } |
fduchiron | 1:f392aee31272 | 133 | baud_rate = (((uint16_t)packet.data[15] << 8) | packet.data[16]) * 9600; |
cdupaty | 0:35cd316e4b41 | 134 | |
fduchiron | 1:f392aee31272 | 135 | return packet.data[0]; |
cdupaty | 0:35cd316e4b41 | 136 | } |
cdupaty | 0:35cd316e4b41 | 137 | |
cdupaty | 0:35cd316e4b41 | 138 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 139 | /*! |
cdupaty | 0:35cd316e4b41 | 140 | @brief Ask the sensor to take an image of the finger pressed on surface |
cdupaty | 0:35cd316e4b41 | 141 | @returns <code>FINGERPRINT_OK</code> on success |
cdupaty | 0:35cd316e4b41 | 142 | @returns <code>FINGERPRINT_NOFINGER</code> if no finger detected |
cdupaty | 0:35cd316e4b41 | 143 | @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error |
cdupaty | 0:35cd316e4b41 | 144 | @returns <code>FINGERPRINT_IMAGEFAIL</code> on imaging error |
cdupaty | 0:35cd316e4b41 | 145 | */ |
cdupaty | 0:35cd316e4b41 | 146 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 147 | uint8_t Fingerprint::getImage(void) { |
cdupaty | 0:35cd316e4b41 | 148 | SEND_CMD_PACKET(FINGERPRINT_GETIMAGE); |
cdupaty | 0:35cd316e4b41 | 149 | } |
cdupaty | 0:35cd316e4b41 | 150 | |
cdupaty | 0:35cd316e4b41 | 151 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 152 | /*! |
cdupaty | 0:35cd316e4b41 | 153 | @brief Ask the sensor to convert image to feature template |
cdupaty | 0:35cd316e4b41 | 154 | @param slot Location to place feature template (put one in 1 and another in |
cdupaty | 0:35cd316e4b41 | 155 | 2 for verification to create model) |
cdupaty | 0:35cd316e4b41 | 156 | @returns <code>FINGERPRINT_OK</code> on success |
cdupaty | 0:35cd316e4b41 | 157 | @returns <code>FINGERPRINT_IMAGEMESS</code> if image is too messy |
cdupaty | 0:35cd316e4b41 | 158 | @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error |
cdupaty | 0:35cd316e4b41 | 159 | @returns <code>FINGERPRINT_FEATUREFAIL</code> on failure to identify |
cdupaty | 0:35cd316e4b41 | 160 | fingerprint features |
cdupaty | 0:35cd316e4b41 | 161 | @returns <code>FINGERPRINT_INVALIDIMAGE</code> on failure to identify |
cdupaty | 0:35cd316e4b41 | 162 | fingerprint features |
cdupaty | 0:35cd316e4b41 | 163 | */ |
cdupaty | 0:35cd316e4b41 | 164 | uint8_t Fingerprint::image2Tz(uint8_t slot) { |
cdupaty | 0:35cd316e4b41 | 165 | SEND_CMD_PACKET(FINGERPRINT_IMAGE2TZ, slot); |
cdupaty | 0:35cd316e4b41 | 166 | } |
cdupaty | 0:35cd316e4b41 | 167 | |
cdupaty | 0:35cd316e4b41 | 168 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 169 | /*! |
cdupaty | 0:35cd316e4b41 | 170 | @brief Ask the sensor to take two print feature template and create a |
cdupaty | 0:35cd316e4b41 | 171 | model |
cdupaty | 0:35cd316e4b41 | 172 | @returns <code>FINGERPRINT_OK</code> on success |
cdupaty | 0:35cd316e4b41 | 173 | @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error |
cdupaty | 0:35cd316e4b41 | 174 | @returns <code>FINGERPRINT_ENROLLMISMATCH</code> on mismatch of fingerprints |
cdupaty | 0:35cd316e4b41 | 175 | */ |
cdupaty | 0:35cd316e4b41 | 176 | uint8_t Fingerprint::createModel(void) { |
cdupaty | 0:35cd316e4b41 | 177 | SEND_CMD_PACKET(FINGERPRINT_REGMODEL); |
cdupaty | 0:35cd316e4b41 | 178 | } |
cdupaty | 0:35cd316e4b41 | 179 | |
cdupaty | 0:35cd316e4b41 | 180 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 181 | /*! |
cdupaty | 0:35cd316e4b41 | 182 | @brief Ask the sensor to store the calculated model for later matching |
cdupaty | 0:35cd316e4b41 | 183 | @param location The model location # |
cdupaty | 0:35cd316e4b41 | 184 | @returns <code>FINGERPRINT_OK</code> on success |
cdupaty | 0:35cd316e4b41 | 185 | @returns <code>FINGERPRINT_BADLOCATION</code> if the location is invalid |
cdupaty | 0:35cd316e4b41 | 186 | @returns <code>FINGERPRINT_FLASHERR</code> if the model couldn't be written |
cdupaty | 0:35cd316e4b41 | 187 | to flash memory |
cdupaty | 0:35cd316e4b41 | 188 | @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error |
cdupaty | 0:35cd316e4b41 | 189 | */ |
cdupaty | 0:35cd316e4b41 | 190 | uint8_t Fingerprint::storeModel(uint16_t location) { |
cdupaty | 0:35cd316e4b41 | 191 | SEND_CMD_PACKET(FINGERPRINT_STORE, 0x01, (uint8_t)(location >> 8), |
cdupaty | 0:35cd316e4b41 | 192 | (uint8_t)(location & 0xFF)); |
cdupaty | 0:35cd316e4b41 | 193 | } |
cdupaty | 0:35cd316e4b41 | 194 | |
cdupaty | 0:35cd316e4b41 | 195 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 196 | /*! |
cdupaty | 0:35cd316e4b41 | 197 | @brief Ask the sensor to load a fingerprint model from flash into buffer 1 |
cdupaty | 0:35cd316e4b41 | 198 | @param location The model location # |
cdupaty | 0:35cd316e4b41 | 199 | @returns <code>FINGERPRINT_OK</code> on success |
cdupaty | 0:35cd316e4b41 | 200 | @returns <code>FINGERPRINT_BADLOCATION</code> if the location is invalid |
cdupaty | 0:35cd316e4b41 | 201 | @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error |
cdupaty | 0:35cd316e4b41 | 202 | */ |
cdupaty | 0:35cd316e4b41 | 203 | uint8_t Fingerprint::loadModel(uint16_t location) { |
cdupaty | 0:35cd316e4b41 | 204 | SEND_CMD_PACKET(FINGERPRINT_LOAD, 0x01, (uint8_t)(location >> 8), |
cdupaty | 0:35cd316e4b41 | 205 | (uint8_t)(location & 0xFF)); |
cdupaty | 0:35cd316e4b41 | 206 | } |
cdupaty | 0:35cd316e4b41 | 207 | |
cdupaty | 0:35cd316e4b41 | 208 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 209 | /*! |
cdupaty | 0:35cd316e4b41 | 210 | @brief Ask the sensor to transfer 256-byte fingerprint template from the |
cdupaty | 0:35cd316e4b41 | 211 | buffer to the UART |
cdupaty | 0:35cd316e4b41 | 212 | @returns <code>FINGERPRINT_OK</code> on success |
cdupaty | 0:35cd316e4b41 | 213 | @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error |
cdupaty | 0:35cd316e4b41 | 214 | */ |
cdupaty | 0:35cd316e4b41 | 215 | uint8_t Fingerprint::getModel(void) { |
cdupaty | 0:35cd316e4b41 | 216 | SEND_CMD_PACKET(FINGERPRINT_UPLOAD, 0x01); |
cdupaty | 0:35cd316e4b41 | 217 | } |
cdupaty | 0:35cd316e4b41 | 218 | |
cdupaty | 0:35cd316e4b41 | 219 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 220 | /*! |
cdupaty | 0:35cd316e4b41 | 221 | @brief Ask the sensor to delete a model in memory |
cdupaty | 0:35cd316e4b41 | 222 | @param location The model location # |
cdupaty | 0:35cd316e4b41 | 223 | @returns <code>FINGERPRINT_OK</code> on success |
cdupaty | 0:35cd316e4b41 | 224 | @returns <code>FINGERPRINT_BADLOCATION</code> if the location is invalid |
cdupaty | 0:35cd316e4b41 | 225 | @returns <code>FINGERPRINT_FLASHERR</code> if the model couldn't be written |
cdupaty | 0:35cd316e4b41 | 226 | to flash memory |
cdupaty | 0:35cd316e4b41 | 227 | @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error |
cdupaty | 0:35cd316e4b41 | 228 | */ |
cdupaty | 0:35cd316e4b41 | 229 | uint8_t Fingerprint::deleteModel(uint16_t location) { |
cdupaty | 0:35cd316e4b41 | 230 | SEND_CMD_PACKET(FINGERPRINT_DELETE, (uint8_t)(location >> 8), |
cdupaty | 0:35cd316e4b41 | 231 | (uint8_t)(location & 0xFF), 0x00, 0x01); |
cdupaty | 0:35cd316e4b41 | 232 | } |
cdupaty | 0:35cd316e4b41 | 233 | |
cdupaty | 0:35cd316e4b41 | 234 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 235 | /*! |
cdupaty | 0:35cd316e4b41 | 236 | @brief Ask the sensor to delete ALL models in memory |
cdupaty | 0:35cd316e4b41 | 237 | @returns <code>FINGERPRINT_OK</code> on success |
cdupaty | 0:35cd316e4b41 | 238 | @returns <code>FINGERPRINT_BADLOCATION</code> if the location is invalid |
cdupaty | 0:35cd316e4b41 | 239 | @returns <code>FINGERPRINT_FLASHERR</code> if the model couldn't be written |
cdupaty | 0:35cd316e4b41 | 240 | to flash memory |
cdupaty | 0:35cd316e4b41 | 241 | @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error |
cdupaty | 0:35cd316e4b41 | 242 | */ |
cdupaty | 0:35cd316e4b41 | 243 | uint8_t Fingerprint::emptyDatabase(void) { |
cdupaty | 0:35cd316e4b41 | 244 | SEND_CMD_PACKET(FINGERPRINT_EMPTY); |
cdupaty | 0:35cd316e4b41 | 245 | } |
cdupaty | 0:35cd316e4b41 | 246 | |
cdupaty | 0:35cd316e4b41 | 247 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 248 | /*! |
cdupaty | 0:35cd316e4b41 | 249 | @brief Ask the sensor to search the current slot 1 fingerprint features to |
cdupaty | 0:35cd316e4b41 | 250 | match saved templates. The matching location is stored in <b>fingerID</b> and |
cdupaty | 0:35cd316e4b41 | 251 | the matching confidence in <b>confidence</b> |
cdupaty | 0:35cd316e4b41 | 252 | @returns <code>FINGERPRINT_OK</code> on fingerprint match success |
cdupaty | 0:35cd316e4b41 | 253 | @returns <code>FINGERPRINT_NOTFOUND</code> no match made |
cdupaty | 0:35cd316e4b41 | 254 | @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error |
cdupaty | 0:35cd316e4b41 | 255 | */ |
cdupaty | 0:35cd316e4b41 | 256 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 257 | uint8_t Fingerprint::fingerFastSearch(void) { |
cdupaty | 0:35cd316e4b41 | 258 | // high speed search of slot #1 starting at page 0x0000 and page #0x00A3 |
cdupaty | 0:35cd316e4b41 | 259 | GET_CMD_PACKET(FINGERPRINT_HISPEEDSEARCH, 0x01, 0x00, 0x00, 0x00, 0xA3); |
cdupaty | 0:35cd316e4b41 | 260 | fingerID = 0xFFFF; |
cdupaty | 0:35cd316e4b41 | 261 | confidence = 0xFFFF; |
cdupaty | 0:35cd316e4b41 | 262 | |
fduchiron | 1:f392aee31272 | 263 | fingerID = packet.data[1]; |
cdupaty | 0:35cd316e4b41 | 264 | fingerID <<= 8; |
fduchiron | 1:f392aee31272 | 265 | fingerID |= packet.data[2]; |
cdupaty | 0:35cd316e4b41 | 266 | |
fduchiron | 1:f392aee31272 | 267 | confidence = packet.data[3]; |
cdupaty | 0:35cd316e4b41 | 268 | confidence <<= 8; |
fduchiron | 1:f392aee31272 | 269 | confidence |= packet.data[4]; |
cdupaty | 0:35cd316e4b41 | 270 | |
fduchiron | 1:f392aee31272 | 271 | return packet.data[0]; |
cdupaty | 0:35cd316e4b41 | 272 | } |
cdupaty | 0:35cd316e4b41 | 273 | |
cdupaty | 0:35cd316e4b41 | 274 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 275 | /*! |
cdupaty | 0:35cd316e4b41 | 276 | @brief Control the built in LED |
cdupaty | 0:35cd316e4b41 | 277 | @param on True if you want LED on, False to turn LED off |
cdupaty | 0:35cd316e4b41 | 278 | @returns <code>FINGERPRINT_OK</code> on success |
cdupaty | 0:35cd316e4b41 | 279 | */ |
cdupaty | 0:35cd316e4b41 | 280 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 281 | uint8_t Fingerprint::LEDcontrol(bool on) { |
cdupaty | 0:35cd316e4b41 | 282 | if (on) { |
cdupaty | 0:35cd316e4b41 | 283 | SEND_CMD_PACKET(FINGERPRINT_LEDON); |
cdupaty | 0:35cd316e4b41 | 284 | } else { |
cdupaty | 0:35cd316e4b41 | 285 | SEND_CMD_PACKET(FINGERPRINT_LEDOFF); |
cdupaty | 0:35cd316e4b41 | 286 | } |
cdupaty | 0:35cd316e4b41 | 287 | } |
cdupaty | 0:35cd316e4b41 | 288 | |
cdupaty | 0:35cd316e4b41 | 289 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 290 | /*! |
cdupaty | 0:35cd316e4b41 | 291 | @brief Control the built in Aura LED (if exists). Check datasheet/manual |
cdupaty | 0:35cd316e4b41 | 292 | for different colors and control codes available |
cdupaty | 0:35cd316e4b41 | 293 | @param control The control code (e.g. breathing, full on) |
cdupaty | 0:35cd316e4b41 | 294 | @param speed How fast to go through the breathing/blinking cycles |
cdupaty | 0:35cd316e4b41 | 295 | @param coloridx What color to light the indicator |
cdupaty | 0:35cd316e4b41 | 296 | @param count How many repeats of blinks/breathing cycles |
cdupaty | 0:35cd316e4b41 | 297 | @returns <code>FINGERPRINT_OK</code> on fingerprint match success |
cdupaty | 0:35cd316e4b41 | 298 | @returns <code>FINGERPRINT_NOTFOUND</code> no match made |
cdupaty | 0:35cd316e4b41 | 299 | @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error |
cdupaty | 0:35cd316e4b41 | 300 | */ |
cdupaty | 0:35cd316e4b41 | 301 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 302 | uint8_t Fingerprint::LEDcontrol(uint8_t control, uint8_t speed, |
cdupaty | 0:35cd316e4b41 | 303 | uint8_t coloridx, uint8_t count) { |
cdupaty | 0:35cd316e4b41 | 304 | SEND_CMD_PACKET(FINGERPRINT_AURALEDCONFIG, control, speed, coloridx, count); |
cdupaty | 0:35cd316e4b41 | 305 | } |
cdupaty | 0:35cd316e4b41 | 306 | |
cdupaty | 0:35cd316e4b41 | 307 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 308 | /*! |
cdupaty | 0:35cd316e4b41 | 309 | @brief Ask the sensor to search the current slot fingerprint features to |
cdupaty | 0:35cd316e4b41 | 310 | match saved templates. The matching location is stored in <b>fingerID</b> and |
cdupaty | 0:35cd316e4b41 | 311 | the matching confidence in <b>confidence</b> |
cdupaty | 0:35cd316e4b41 | 312 | @param slot The slot to use for the print search, defaults to 1 |
cdupaty | 0:35cd316e4b41 | 313 | @returns <code>FINGERPRINT_OK</code> on fingerprint match success |
cdupaty | 0:35cd316e4b41 | 314 | @returns <code>FINGERPRINT_NOTFOUND</code> no match made |
cdupaty | 0:35cd316e4b41 | 315 | @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error |
cdupaty | 0:35cd316e4b41 | 316 | */ |
cdupaty | 0:35cd316e4b41 | 317 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 318 | uint8_t Fingerprint::fingerSearch(uint8_t slot) { |
cdupaty | 0:35cd316e4b41 | 319 | // search of slot starting thru the capacity |
cdupaty | 0:35cd316e4b41 | 320 | GET_CMD_PACKET(FINGERPRINT_SEARCH, slot, 0x00, 0x00, capacity >> 8, |
cdupaty | 0:35cd316e4b41 | 321 | capacity & 0xFF); |
cdupaty | 0:35cd316e4b41 | 322 | |
cdupaty | 0:35cd316e4b41 | 323 | fingerID = 0xFFFF; |
cdupaty | 0:35cd316e4b41 | 324 | confidence = 0xFFFF; |
cdupaty | 0:35cd316e4b41 | 325 | |
fduchiron | 1:f392aee31272 | 326 | fingerID = packet.data[1]; |
cdupaty | 0:35cd316e4b41 | 327 | fingerID <<= 8; |
fduchiron | 1:f392aee31272 | 328 | fingerID |= packet.data[2]; |
cdupaty | 0:35cd316e4b41 | 329 | |
fduchiron | 1:f392aee31272 | 330 | confidence = packet.data[3]; |
cdupaty | 0:35cd316e4b41 | 331 | confidence <<= 8; |
fduchiron | 1:f392aee31272 | 332 | confidence |= packet.data[4]; |
cdupaty | 0:35cd316e4b41 | 333 | |
fduchiron | 1:f392aee31272 | 334 | return packet.data[0]; |
cdupaty | 0:35cd316e4b41 | 335 | } |
cdupaty | 0:35cd316e4b41 | 336 | |
cdupaty | 0:35cd316e4b41 | 337 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 338 | /*! |
cdupaty | 0:35cd316e4b41 | 339 | @brief Ask the sensor for the number of templates stored in memory. The |
cdupaty | 0:35cd316e4b41 | 340 | number is stored in <b>templateCount</b> on success. |
cdupaty | 0:35cd316e4b41 | 341 | @returns <code>FINGERPRINT_OK</code> on success |
cdupaty | 0:35cd316e4b41 | 342 | @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error |
cdupaty | 0:35cd316e4b41 | 343 | */ |
cdupaty | 0:35cd316e4b41 | 344 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 345 | uint8_t Fingerprint::getTemplateCount(void) { |
cdupaty | 0:35cd316e4b41 | 346 | GET_CMD_PACKET(FINGERPRINT_TEMPLATECOUNT); |
cdupaty | 0:35cd316e4b41 | 347 | |
fduchiron | 1:f392aee31272 | 348 | templateCount = packet.data[1]; |
cdupaty | 0:35cd316e4b41 | 349 | templateCount <<= 8; |
fduchiron | 1:f392aee31272 | 350 | templateCount |= packet.data[2]; |
cdupaty | 0:35cd316e4b41 | 351 | |
fduchiron | 1:f392aee31272 | 352 | return packet.data[0]; |
cdupaty | 0:35cd316e4b41 | 353 | } |
cdupaty | 0:35cd316e4b41 | 354 | |
cdupaty | 0:35cd316e4b41 | 355 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 356 | /*! |
cdupaty | 0:35cd316e4b41 | 357 | @brief Set the password on the sensor (future communication will require |
cdupaty | 0:35cd316e4b41 | 358 | password verification so don't forget it!!!) |
cdupaty | 0:35cd316e4b41 | 359 | @param password 32-bit password code |
cdupaty | 0:35cd316e4b41 | 360 | @returns <code>FINGERPRINT_OK</code> on success |
cdupaty | 0:35cd316e4b41 | 361 | @returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error |
cdupaty | 0:35cd316e4b41 | 362 | */ |
cdupaty | 0:35cd316e4b41 | 363 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 364 | uint8_t Fingerprint::setPassword(uint32_t password) { |
cdupaty | 0:35cd316e4b41 | 365 | SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16), |
cdupaty | 0:35cd316e4b41 | 366 | (password >> 8), password); |
cdupaty | 0:35cd316e4b41 | 367 | } |
cdupaty | 0:35cd316e4b41 | 368 | |
cdupaty | 0:35cd316e4b41 | 369 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 370 | /*! |
cdupaty | 0:35cd316e4b41 | 371 | @brief Helper function to process a packet and send it over UART to the |
cdupaty | 0:35cd316e4b41 | 372 | sensor |
cdupaty | 0:35cd316e4b41 | 373 | @param packet A structure containing the bytes to transmit |
cdupaty | 0:35cd316e4b41 | 374 | */ |
cdupaty | 0:35cd316e4b41 | 375 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 376 | |
cdupaty | 0:35cd316e4b41 | 377 | void Fingerprint::writeStructuredPacket(const Fingerprint_Packet &packet) |
cdupaty | 0:35cd316e4b41 | 378 | { |
fduchiron | 1:f392aee31272 | 379 | R503Serial.putc((uint8_t)(packet.start_code >> 8)); |
fduchiron | 1:f392aee31272 | 380 | R503Serial.putc((uint8_t)(packet.start_code & 0xFF)); |
fduchiron | 1:f392aee31272 | 381 | R503Serial.putc(packet.address[0]); |
fduchiron | 1:f392aee31272 | 382 | R503Serial.putc(packet.address[1]); |
fduchiron | 1:f392aee31272 | 383 | R503Serial.putc(packet.address[2]); |
fduchiron | 1:f392aee31272 | 384 | R503Serial.putc(packet.address[3]); |
fduchiron | 1:f392aee31272 | 385 | R503Serial.putc(packet.type); |
cdupaty | 0:35cd316e4b41 | 386 | |
fduchiron | 1:f392aee31272 | 387 | uint16_t wire_length = packet.length + 2; |
cdupaty | 0:35cd316e4b41 | 388 | R503Serial.putc((uint8_t)(wire_length >> 8)); |
cdupaty | 0:35cd316e4b41 | 389 | R503Serial.putc((uint8_t)(wire_length & 0xFF)); |
cdupaty | 0:35cd316e4b41 | 390 | |
cdupaty | 2:6f273d942c43 | 391 | #ifdef FINGERPRINT_DEBUG |
cdupaty | 2:6f273d942c43 | 392 | printf("-> Send packet \n-> "); |
cdupaty | 2:6f273d942c43 | 393 | printf("0x%02X%02X ",(uint8_t)(packet.start_code >> 8),(uint8_t)(packet.start_code & 0xFF)); |
cdupaty | 2:6f273d942c43 | 394 | printf(", 0x%02X ",packet.address[0]); |
cdupaty | 2:6f273d942c43 | 395 | printf(", 0x%02X ",packet.address[1]); |
cdupaty | 2:6f273d942c43 | 396 | printf(", 0x%02X ",packet.address[2]); |
cdupaty | 2:6f273d942c43 | 397 | printf(", 0x%02X ",packet.address[3]); |
cdupaty | 2:6f273d942c43 | 398 | printf(", 0x%02X ",packet.type); |
cdupaty | 2:6f273d942c43 | 399 | printf(", 0x%02X ",(uint8_t)(wire_length >> 8)); |
cdupaty | 2:6f273d942c43 | 400 | printf(", 0x%02X \n-> Data ",(uint8_t)(wire_length & 0xFF)); |
cdupaty | 2:6f273d942c43 | 401 | #endif |
cdupaty | 0:35cd316e4b41 | 402 | |
fduchiron | 1:f392aee31272 | 403 | uint16_t sum = ((wire_length) >> 8) + ((wire_length)&0xFF) + packet.type; |
cdupaty | 2:6f273d942c43 | 404 | for (uint8_t i = 0; i < packet.length; i++) |
cdupaty | 2:6f273d942c43 | 405 | { |
fduchiron | 1:f392aee31272 | 406 | R503Serial.putc(packet.data[i]); |
fduchiron | 1:f392aee31272 | 407 | sum += packet.data[i]; |
cdupaty | 2:6f273d942c43 | 408 | #ifdef FINGERPRINT_DEBUG |
cdupaty | 2:6f273d942c43 | 409 | printf(", 0x%02X ",packet.data[i]); |
cdupaty | 2:6f273d942c43 | 410 | #endif |
cdupaty | 0:35cd316e4b41 | 411 | } |
cdupaty | 2:6f273d942c43 | 412 | // #ifdef FINGERPRINT_DEBUG |
cdupaty | 3:394a5735eea0 | 413 | // printf("\n-\n"); |
cdupaty | 2:6f273d942c43 | 414 | // #endif |
cdupaty | 0:35cd316e4b41 | 415 | |
cdupaty | 0:35cd316e4b41 | 416 | R503Serial.putc((uint8_t)(sum >> 8)); |
cdupaty | 0:35cd316e4b41 | 417 | R503Serial.putc((uint8_t)(sum & 0xFF)); |
cdupaty | 0:35cd316e4b41 | 418 | |
cdupaty | 0:35cd316e4b41 | 419 | #ifdef FINGERPRINT_DEBUG |
cdupaty | 2:6f273d942c43 | 420 | printf("-> chksum = 0x%02X%02X \n",(uint8_t)(sum >> 8),(uint8_t)(sum & 0xFF)); |
cdupaty | 0:35cd316e4b41 | 421 | #endif |
cdupaty | 0:35cd316e4b41 | 422 | |
cdupaty | 0:35cd316e4b41 | 423 | return; |
cdupaty | 0:35cd316e4b41 | 424 | } |
cdupaty | 0:35cd316e4b41 | 425 | |
cdupaty | 0:35cd316e4b41 | 426 | /**************************************************************************/ |
cdupaty | 0:35cd316e4b41 | 427 | /*! |
cdupaty | 0:35cd316e4b41 | 428 | @brief Helper function to receive data over UART from the sensor and |
cdupaty | 0:35cd316e4b41 | 429 | process it into a packet |
cdupaty | 0:35cd316e4b41 | 430 | @param packet A structure containing the bytes received |
cdupaty | 0:35cd316e4b41 | 431 | @param timeout how many milliseconds we're willing to wait |
cdupaty | 0:35cd316e4b41 | 432 | @returns <code>FINGERPRINT_OK</code> on success |
cdupaty | 0:35cd316e4b41 | 433 | @returns <code>FINGERPRINT_TIMEOUT</code> or |
cdupaty | 0:35cd316e4b41 | 434 | <code>FINGERPRINT_BADPACKET</code> on failure |
cdupaty | 0:35cd316e4b41 | 435 | */ |
cdupaty | 0:35cd316e4b41 | 436 | /**************************************************************************/ |
cdupaty | 2:6f273d942c43 | 437 | uint8_t Fingerprint::getStructuredPacket(Fingerprint_Packet *packet, uint16_t timeout) |
cdupaty | 2:6f273d942c43 | 438 | { |
cdupaty | 0:35cd316e4b41 | 439 | uint8_t byte; |
cdupaty | 0:35cd316e4b41 | 440 | uint16_t idx = 0, timer = 0; |
cdupaty | 0:35cd316e4b41 | 441 | |
cdupaty | 0:35cd316e4b41 | 442 | #ifdef FINGERPRINT_DEBUG |
cdupaty | 2:6f273d942c43 | 443 | printf("\n<----------------------packet reception\n<- "); |
cdupaty | 0:35cd316e4b41 | 444 | #endif |
cdupaty | 0:35cd316e4b41 | 445 | |
cdupaty | 2:6f273d942c43 | 446 | while (true) |
cdupaty | 2:6f273d942c43 | 447 | { |
cdupaty | 2:6f273d942c43 | 448 | while (pl==pe) // rien n'est arrivé |
cdupaty | 2:6f273d942c43 | 449 | { |
cdupaty | 0:35cd316e4b41 | 450 | wait_ms(1); |
cdupaty | 0:35cd316e4b41 | 451 | timer++; |
cdupaty | 2:6f273d942c43 | 452 | if (timer >= timeout) |
cdupaty | 2:6f273d942c43 | 453 | { |
cdupaty | 2:6f273d942c43 | 454 | #ifdef FINGERPRINT_DEBUG |
cdupaty | 2:6f273d942c43 | 455 | printf("Timed out\n"); |
cdupaty | 2:6f273d942c43 | 456 | #endif |
cdupaty | 0:35cd316e4b41 | 457 | return FINGERPRINT_TIMEOUT; |
cdupaty | 0:35cd316e4b41 | 458 | } |
cdupaty | 0:35cd316e4b41 | 459 | } |
cdupaty | 2:6f273d942c43 | 460 | byte = readUARTbuff(); |
cdupaty | 2:6f273d942c43 | 461 | |
cdupaty | 2:6f273d942c43 | 462 | #ifdef FINGERPRINT_DEBUG |
cdupaty | 2:6f273d942c43 | 463 | printf("0x%02X, ",byte); |
cdupaty | 2:6f273d942c43 | 464 | #endif |
cdupaty | 2:6f273d942c43 | 465 | switch (idx) |
cdupaty | 2:6f273d942c43 | 466 | { |
cdupaty | 2:6f273d942c43 | 467 | case 0: |
cdupaty | 2:6f273d942c43 | 468 | if (byte != (FINGERPRINT_STARTCODE >> 8)) |
cdupaty | 2:6f273d942c43 | 469 | continue; |
cdupaty | 2:6f273d942c43 | 470 | packet->start_code = (uint16_t)byte << 8; |
cdupaty | 2:6f273d942c43 | 471 | break; |
cdupaty | 2:6f273d942c43 | 472 | case 1: |
cdupaty | 2:6f273d942c43 | 473 | packet->start_code |= byte; |
cdupaty | 2:6f273d942c43 | 474 | if (packet->start_code != FINGERPRINT_STARTCODE) |
cdupaty | 2:6f273d942c43 | 475 | return FINGERPRINT_BADPACKET; |
cdupaty | 2:6f273d942c43 | 476 | break; |
cdupaty | 2:6f273d942c43 | 477 | case 2: // 4 bytes for adress |
cdupaty | 2:6f273d942c43 | 478 | case 3: |
cdupaty | 2:6f273d942c43 | 479 | case 4: |
cdupaty | 2:6f273d942c43 | 480 | case 5: |
cdupaty | 2:6f273d942c43 | 481 | packet->address[idx - 2] = byte; |
cdupaty | 2:6f273d942c43 | 482 | break; |
cdupaty | 2:6f273d942c43 | 483 | case 6: |
cdupaty | 2:6f273d942c43 | 484 | packet->type = byte; |
cdupaty | 2:6f273d942c43 | 485 | break; |
cdupaty | 2:6f273d942c43 | 486 | case 7: |
cdupaty | 2:6f273d942c43 | 487 | packet->length = (uint16_t)byte << 8; |
cdupaty | 2:6f273d942c43 | 488 | break; |
cdupaty | 2:6f273d942c43 | 489 | case 8: |
cdupaty | 2:6f273d942c43 | 490 | packet->length |= byte; |
cdupaty | 2:6f273d942c43 | 491 | #ifdef FINGERPRINT_DEBUG |
cdupaty | 2:6f273d942c43 | 492 | printf("\n<- Data "); |
cdupaty | 2:6f273d942c43 | 493 | #endif |
cdupaty | 2:6f273d942c43 | 494 | break; |
cdupaty | 2:6f273d942c43 | 495 | default: |
cdupaty | 2:6f273d942c43 | 496 | packet->data[idx - 9] = byte; |
cdupaty | 2:6f273d942c43 | 497 | if ((idx - 8) == packet->length) |
cdupaty | 2:6f273d942c43 | 498 | { |
cdupaty | 2:6f273d942c43 | 499 | #ifdef FINGERPRINT_DEBUG |
cdupaty | 2:6f273d942c43 | 500 | printf("\n<--------------------packet reception OK \n\n"); |
cdupaty | 2:6f273d942c43 | 501 | #endif |
cdupaty | 2:6f273d942c43 | 502 | return FINGERPRINT_OK; |
cdupaty | 2:6f273d942c43 | 503 | } |
cdupaty | 2:6f273d942c43 | 504 | break; |
cdupaty | 0:35cd316e4b41 | 505 | } |
cdupaty | 0:35cd316e4b41 | 506 | idx++; |
cdupaty | 0:35cd316e4b41 | 507 | } |
cdupaty | 0:35cd316e4b41 | 508 | // Shouldn't get here so... |
cdupaty | 2:6f273d942c43 | 509 | // return FINGERPRINT_BADPACKET; |
cdupaty | 0:35cd316e4b41 | 510 | } |
cdupaty | 2:6f273d942c43 | 511 | |
cdupaty | 2:6f273d942c43 | 512 | /* |
cdupaty | 2:6f273d942c43 | 513 | Added by Christian Dupaty, STM32 adaptation |
cdupaty | 2:6f273d942c43 | 514 | */ |
cdupaty | 2:6f273d942c43 | 515 | |
cdupaty | 2:6f273d942c43 | 516 | /*************************************************************************** |
cdupaty | 2:6f273d942c43 | 517 | PRIVATE FUNCTIONS |
cdupaty | 2:6f273d942c43 | 518 | ***************************************************************************/ |
cdupaty | 2:6f273d942c43 | 519 | |
cdupaty | 2:6f273d942c43 | 520 | void Fingerprint::receiveUART(void) { |
cdupaty | 2:6f273d942c43 | 521 | uint8_t c; |
cdupaty | 2:6f273d942c43 | 522 | while(!R503Serial.readable()); |
cdupaty | 2:6f273d942c43 | 523 | c=R503Serial.getc(); |
cdupaty | 2:6f273d942c43 | 524 | *pe=c; |
cdupaty | 2:6f273d942c43 | 525 | pe++; |
cdupaty | 2:6f273d942c43 | 526 | if (pe>buffUART+sizeof(buffUART)) pe=buffUART; |
cdupaty | 2:6f273d942c43 | 527 | } |
cdupaty | 2:6f273d942c43 | 528 | |
cdupaty | 2:6f273d942c43 | 529 | uint8_t Fingerprint::readUARTbuff(void) { |
cdupaty | 2:6f273d942c43 | 530 | uint8_t c; |
cdupaty | 2:6f273d942c43 | 531 | c=*pl; |
cdupaty | 2:6f273d942c43 | 532 | pl++; |
cdupaty | 2:6f273d942c43 | 533 | if (pl>buffUART+sizeof(buffUART)) pl=buffUART; |
cdupaty | 2:6f273d942c43 | 534 | return c; |
cdupaty | 2:6f273d942c43 | 535 | } |