1
0
mirror of https://github.com/whowechina/aic_pico.git synced 2024-11-14 09:37:35 +01:00

Correct pn532 select/deselect

This commit is contained in:
whowechina 2024-05-26 11:38:05 +08:00
parent 12d1372c76
commit 0f6844f47c
3 changed files with 16 additions and 4 deletions

View File

@ -71,7 +71,7 @@ struct {
pn532_felica_read,
pn532_set_wait_loop,
pn532_select,
NULL,
pn532_deselect,
},
{
pn5180_firmware_ver,

View File

@ -470,7 +470,18 @@ bool pn532_felica_write(uint16_t svc_code, uint16_t block_id, const uint8_t bloc
void pn532_select()
{
uint8_t ignore_buf[7];
int ignore_len;
pn532_poll_mifare(ignore_buf, &ignore_len);
uint8_t param[] = {0x01};
pn532_write_command(0x54, param, sizeof(param));
uint8_t ignored;
pn532_read_response(0x54, &ignored, 1);
}
void pn532_deselect()
{
uint8_t param[] = {0x01};
pn532_write_command(0x44, param, sizeof(param));
uint8_t ignored;
pn532_read_response(0x44, &ignored, 1);
}

View File

@ -36,5 +36,6 @@ bool pn532_felica_read(uint16_t svc_code, uint16_t block_id, uint8_t block_data[
bool pn532_felica_write(uint16_t svc_code, uint16_t block_id, const uint8_t block_data[16]);
void pn532_select();
void pn532_deselect();
#endif