tell AMS to go to sleep if deselected

This commit is contained in:
Conor Patrick 2019-01-27 23:55:11 -05:00
parent 23cbfde312
commit 91d092a27a
2 changed files with 5 additions and 2 deletions

View File

@ -508,6 +508,8 @@ void nfc_process_block(uint8_t * buf, int len)
{ {
nfc_write_frame(buf, 1); nfc_write_frame(buf, 1);
printf1(TAG_NFC, "NFC_CMD_SBLOCK, DESELECTED\r\n"); printf1(TAG_NFC, "NFC_CMD_SBLOCK, DESELECTED\r\n");
ams_wait_for_tx(2);
ams_write_command(AMS_CMD_SLEEP);
nfc_state_init(); nfc_state_init();
} }
else else

View File

@ -35,8 +35,8 @@ typedef struct
#define NFC_CMD_SBLOCK 0xc0 #define NFC_CMD_SBLOCK 0xc0
#define IS_SBLOCK(x) ( (((x) & 0xc0) == NFC_CMD_SBLOCK) && (((x) & 0x02) == 0x02) ) #define IS_SBLOCK(x) ( (((x) & 0xc0) == NFC_CMD_SBLOCK) && (((x) & 0x02) == 0x02) )
#define NFC_SBLOCK_DESELECT 0x32 #define NFC_SBLOCK_DESELECT 0x30
#define NFC_SBLOCK_WTX 0xf2 #define NFC_SBLOCK_WTX 0x30
#define AID_NDEF_TYPE_4 "\xD2\x76\x00\x00\x85\x01\x01" #define AID_NDEF_TYPE_4 "\xD2\x76\x00\x00\x85\x01\x01"
#define AID_NDEF_MIFARE_TYPE_4 "\xD2\x76\x00\x00\x85\x01\x00" #define AID_NDEF_MIFARE_TYPE_4 "\xD2\x76\x00\x00\x85\x01\x00"
@ -46,6 +46,7 @@ typedef struct
typedef enum typedef enum
{ {
APP_NOTHING = 0,
APP_NDEF_TYPE_4 = 1, APP_NDEF_TYPE_4 = 1,
APP_MIFARE_TYPE_4, APP_MIFARE_TYPE_4,
APP_CAPABILITY_CONTAINER, APP_CAPABILITY_CONTAINER,