From 89e00482e4b6a62dbeb2e97214500f2e84ab2f37 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Sat, 6 Jul 2019 12:52:23 +0300 Subject: [PATCH] some improvements --- targets/stm32l432/src/nfc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/targets/stm32l432/src/nfc.c b/targets/stm32l432/src/nfc.c index 4a7429d..609b104 100644 --- a/targets/stm32l432/src/nfc.c +++ b/targets/stm32l432/src/nfc.c @@ -122,6 +122,7 @@ bool ams_receive_with_timeout(uint32_t timeout_ms, uint8_t * data, int maxlen, i while (tstart + timeout_ms > millis()) { uint8_t int0 = ams_read_reg(AMS_REG_INT0); + if (int0) process_int0(int0); uint8_t buffer_status2 = ams_read_reg(AMS_REG_BUF2); if (buffer_status2 && (int0 & AMS_INT_RXE)) @@ -389,7 +390,12 @@ int answer_rats(uint8_t parameter) nfc_write_frame(res, sizeof(res)); - ams_wait_for_tx(10); + if (!ams_wait_for_tx(10)) + { + printf1(TAG_NFC, "RATS TX timeout.\r\n"); + ams_write_command(AMS_CMD_DEFAULT); + return 1; + } return 0;