1
0
mirror of https://github.com/whowechina/aic_pico.git synced 2024-11-12 00:40:47 +01:00

Move the false card id filtering into PN5180 module

This commit is contained in:
whowechina 2024-06-11 21:49:52 +08:00
parent 01b141db53
commit a047d16a76
3 changed files with 10 additions and 9 deletions

Binary file not shown.

View File

@ -364,6 +364,16 @@ bool pn5180_poll_felica(uint8_t uid[8], uint8_t pmm[8], uint8_t syscode[2], bool
memcpy(uid, out.idm, 8); memcpy(uid, out.idm, 8);
memcpy(pmm, out.pmm, 8); memcpy(pmm, out.pmm, 8);
memcpy(syscode, out.syscode, 2); memcpy(syscode, out.syscode, 2);
/* double check the result */
pn5180_send_data(cmd, sizeof(cmd), 0x00);
sleep_ms(1);
pn5180_read_data((uint8_t *)&out, sizeof(out));
if ((out.len != sizeof(out)) || (out.cmd != 0x01) ||
(memcmp(uid, out.idm, 8) != 0)) {
return false;
}
memcpy(idm_cache, uid, 8); memcpy(idm_cache, uid, 8);
return true; return true;
} }

View File

@ -199,15 +199,6 @@ static void cardio_run()
nfc_card_t card = nfc_detect_card(); nfc_card_t card = nfc_detect_card();
nfc_rf_field(false); nfc_rf_field(false);
/* Double check ID, some module gives random false data */
nfc_rf_field(true);
nfc_card_t card_confirm = nfc_detect_card();
nfc_rf_field(false);
if (memcmp(&card, &card_confirm, sizeof(card)) != 0) {
return;
}
if (memcmp(&old_card, &card, sizeof(old_card)) == 0) { if (memcmp(&old_card, &card, sizeof(old_card)) == 0) {
return; return;
} }