1
0
mirror of https://github.com/whowechina/aic_pico.git synced 2024-11-24 05:50:11 +01:00

Set RF field to auto

This commit is contained in:
whowechina 2024-03-16 15:34:28 +08:00
parent 78bf058783
commit 7f1fa63fce
2 changed files with 4 additions and 4 deletions

View File

@ -58,7 +58,7 @@ static void handle_nfc()
{
printf("NFC module: %s\n", nfc_module_name());
nfc_card_t card = nfc_detect_card();
printf("Card %s:", nfc_card_name(card.card_type));
printf("Card: %s", nfc_card_name(card.card_type));
for (int i = 0; i < card.len; i++) {
printf(" %02x", card.uid[i]);
}

View File

@ -295,9 +295,9 @@ bool pn532_config_sam()
return pn532_read_response(0x14, &resp, 1) == 0;
}
static bool pn532_set_rf_field(uint8_t auto_rf, uint8_t on_off)
static bool pn532_set_rf_field(bool auto_rf, bool on_off)
{
uint8_t param[] = { 1, auto_rf | on_off };
uint8_t param[] = { 1, (auto_rf ? 2 : 0) | (on_off ? 1 : 0) };
pn532_write_command(0x32, param, 2);
uint8_t resp;
@ -306,7 +306,7 @@ static bool pn532_set_rf_field(uint8_t auto_rf, uint8_t on_off)
void pn532_rf_field(bool on)
{
pn532_set_rf_field(0x00, on ? 0x01 : 0x00);
pn532_set_rf_field(true, on);
if (on) {
pn532_config_sam();
}