diff options
| author | Sadeep Madurange <sadeep@asciimx.com> | 2025-05-07 17:51:32 +0800 |
|---|---|---|
| committer | Sadeep Madurange <sadeep@asciimx.com> | 2025-05-07 17:51:32 +0800 |
| commit | 099a4f80e6e869582b5abc6d12d381bf6c48780f (patch) | |
| tree | 30d7e993ac6c970ae5ecc9922c12ebe91a52b09d /r503.c | |
| parent | 5d885ede63e013ac6e7298ba9f2d8c701cf83bd3 (diff) | |
| download | avr-fpm-drivers-099a4f80e6e869582b5abc6d12d381bf6c48780f.tar.gz | |
Match print.
Diffstat (limited to 'r503.c')
| -rw-r--r-- | r503.c | 49 |
1 files changed, 46 insertions, 3 deletions
@@ -228,13 +228,18 @@ uint8_t fpm_get_cfg(struct fpm_cfg *cfg) return 0; } -uint8_t fpm_clear_db(void) +uint8_t fpm_set_pwd(uint32_t pwd) { uint16_t n; uint8_t buf[MAXPDLEN]; - buf[0] = 0x0D; - send(0x01, buf, 1); + buf[0] = 0x12; + buf[1] = (uint8_t)(pwd >> 24); + buf[2] = (uint8_t)(pwd >> 16); + buf[3] = (uint8_t)(pwd >> 8); + buf[4] = (uint8_t)(pwd & 0xFF); + + send(0x01, buf, 5); recv(buf, &n); return buf[0] == OK; } @@ -291,3 +296,41 @@ uint8_t fpm_enroll(uint16_t id) return buf[0] == OK; } + +uint8_t fpm_match(void) +{ + struct fpm_cfg cfg; + uint16_t n; + uint8_t buf[MAXPDLEN]; + + if (!fpm_get_cfg(&cfg)) + return 0; + + if (!scan()) + return 0; + + if (!img2tz(1)) + return 0; + + buf[0] = 0x04; + buf[1] = 1; + buf[2] = 0x00; + buf[3] = 0x00; + buf[4] = (uint8_t)(cfg.cap >> 8); + buf[5] = (uint8_t)(cfg.cap & 0xFF); + + send(0x01, buf, 6); + recv(buf, &n); + return buf[0] == OK; +} + +uint8_t fpm_clear_db(void) +{ + uint16_t n; + uint8_t buf[MAXPDLEN]; + + buf[0] = 0x0D; + send(0x01, buf, 1); + recv(buf, &n); + return buf[0] == OK; +} |
