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

detect_card_ex to ignore card types

This commit is contained in:
whowechina 2024-04-23 10:49:30 +08:00
parent a287702735
commit 8c74095e42
2 changed files with 80 additions and 63 deletions

View File

@ -49,6 +49,8 @@ void nfc_set_wait_loop(nfc_wait_loop_t loop);
void nfc_rf_field(bool on);
nfc_card_t nfc_detect_card();
nfc_card_t nfc_detect_card_ex(bool mifare, bool felica, bool vicinity);
void display_card(const nfc_card_t *card);
const char *nfc_module_name();

View File

@ -199,12 +199,27 @@ nfc_card_t nfc_detect_card()
{
nfc_card_t card = { 0 };
if (!nfc_detect_mifare(&card) &&
!nfc_detect_felica(&card) &&
!nfc_detect_vicinity(&card)) {
card.card_type = NFC_CARD_NONE;
if (nfc_detect_mifare(&card) ||
nfc_detect_felica(&card) ||
nfc_detect_vicinity(&card)) {
return card;
}
card.card_type = NFC_CARD_NONE;
return card;
}
nfc_card_t nfc_detect_card_ex(bool mifare, bool felica, bool vicinity)
{
nfc_card_t card = { 0 };
if ((mifare && nfc_detect_mifare(&card))
|| (felica && nfc_detect_felica(&card))
|| (vicinity && nfc_detect_vicinity(&card))) {
return card;
}
card.card_type = NFC_CARD_NONE;
return card;
}