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:
parent
01b141db53
commit
a047d16a76
Binary file not shown.
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user