Skip to content

Commit 89e0048

Browse files
committed
some improvements
1 parent 533ce39 commit 89e0048

File tree

1 file changed

+7
-1
lines changed
  • targets/stm32l432/src

1 file changed

+7
-1
lines changed

targets/stm32l432/src/nfc.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ bool ams_receive_with_timeout(uint32_t timeout_ms, uint8_t * data, int maxlen, i
122122
while (tstart + timeout_ms > millis())
123123
{
124124
uint8_t int0 = ams_read_reg(AMS_REG_INT0);
125+
if (int0) process_int0(int0);
125126
uint8_t buffer_status2 = ams_read_reg(AMS_REG_BUF2);
126127

127128
if (buffer_status2 && (int0 & AMS_INT_RXE))
@@ -389,7 +390,12 @@ int answer_rats(uint8_t parameter)
389390

390391

391392
nfc_write_frame(res, sizeof(res));
392-
ams_wait_for_tx(10);
393+
if (!ams_wait_for_tx(10))
394+
{
395+
printf1(TAG_NFC, "RATS TX timeout.\r\n");
396+
ams_write_command(AMS_CMD_DEFAULT);
397+
return 1;
398+
}
393399

394400

395401
return 0;

0 commit comments

Comments
 (0)