added WTX sending sketch
This commit is contained in:
parent
f6e2bfa683
commit
0ef42b2df7
@ -54,6 +54,21 @@ void process_int0(uint8_t int0)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WTX on/off:
|
||||||
|
// sends/receives WTX frame to reader every `WTX_time` time in ms
|
||||||
|
// works via timer interrupts
|
||||||
|
// WTX: f2 01 91 40 === f2(S-block + WTX, frame without CID) 01(from iso - multiply WTX from ATS by 1) <2b crc16>
|
||||||
|
bool WTX_on(int WTX_time)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WTX_off()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ams_wait_for_tx(uint32_t timeout_ms)
|
bool ams_wait_for_tx(uint32_t timeout_ms)
|
||||||
{
|
{
|
||||||
uint32_t tstart = millis();
|
uint32_t tstart = millis();
|
||||||
@ -367,7 +382,9 @@ void nfc_process_iblock(uint8_t * buf, int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
t1 = millis();
|
t1 = millis();
|
||||||
|
WTX_on(WTX_TIME_DEFAULT);
|
||||||
u2f_request_nfc(&buf[1], len, &ctap_resp);
|
u2f_request_nfc(&buf[1], len, &ctap_resp);
|
||||||
|
WTX_off();
|
||||||
|
|
||||||
printf1(TAG_NFC, "U2F resp len: %d\r\n", ctap_resp.length);
|
printf1(TAG_NFC, "U2F resp len: %d\r\n", ctap_resp.length);
|
||||||
printf1(TAG_NFC,"U2F Register processing %d (took %d)\r\n", millis(), millis() - t1);
|
printf1(TAG_NFC,"U2F Register processing %d (took %d)\r\n", millis(), millis() - t1);
|
||||||
@ -392,7 +409,9 @@ void nfc_process_iblock(uint8_t * buf, int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
t1 = millis();
|
t1 = millis();
|
||||||
|
WTX_on(WTX_TIME_DEFAULT);
|
||||||
u2f_request_nfc(&buf[1], len, &ctap_resp);
|
u2f_request_nfc(&buf[1], len, &ctap_resp);
|
||||||
|
WTX_off();
|
||||||
|
|
||||||
printf1(TAG_NFC, "U2F resp len: %d\r\n", ctap_resp.length);
|
printf1(TAG_NFC, "U2F resp len: %d\r\n", ctap_resp.length);
|
||||||
printf1(TAG_NFC,"U2F Authenticate processing %d (took %d)\r\n", millis(), millis() - t1);
|
printf1(TAG_NFC,"U2F Authenticate processing %d (took %d)\r\n", millis(), millis() - t1);
|
||||||
@ -409,8 +428,10 @@ void nfc_process_iblock(uint8_t * buf, int len)
|
|||||||
t1 = millis();
|
t1 = millis();
|
||||||
printf1(TAG_NFC, "FIDO2 CTAP message. %d\r\n", t1);
|
printf1(TAG_NFC, "FIDO2 CTAP message. %d\r\n", t1);
|
||||||
|
|
||||||
|
WTX_on(WTX_TIME_DEFAULT);
|
||||||
ctap_response_init(&ctap_resp);
|
ctap_response_init(&ctap_resp);
|
||||||
status = ctap_request(payload, plen, &ctap_resp);
|
status = ctap_request(payload, plen, &ctap_resp);
|
||||||
|
WTX_off();
|
||||||
printf1(TAG_NFC, "CTAP resp: %d len: %d\r\n", status, ctap_resp.length);
|
printf1(TAG_NFC, "CTAP resp: %d len: %d\r\n", status, ctap_resp.length);
|
||||||
|
|
||||||
if (status == CTAP1_ERR_SUCCESS)
|
if (status == CTAP1_ERR_SUCCESS)
|
||||||
|
@ -20,6 +20,9 @@ typedef struct
|
|||||||
uint8_t tlv[8];
|
uint8_t tlv[8];
|
||||||
} __attribute__((packed)) CAPABILITY_CONTAINER;
|
} __attribute__((packed)) CAPABILITY_CONTAINER;
|
||||||
|
|
||||||
|
// WTX time in ms
|
||||||
|
#define WTX_TIME_DEFAULT 300
|
||||||
|
|
||||||
#define NFC_CMD_REQA 0x26
|
#define NFC_CMD_REQA 0x26
|
||||||
#define NFC_CMD_WUPA 0x52
|
#define NFC_CMD_WUPA 0x52
|
||||||
#define NFC_CMD_HLTA 0x50
|
#define NFC_CMD_HLTA 0x50
|
||||||
|
Loading…
x
Reference in New Issue
Block a user