From 0afc33e44246af2c8cfa4f96c10ead93b43695a9 Mon Sep 17 00:00:00 2001 From: daid Date: Tue, 12 Jul 2016 12:41:37 +0200 Subject: [PATCH] Reduce the I2C ready delay wait, which improves reading speed by butloads. --- libnfc/drivers/pn532_i2c.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libnfc/drivers/pn532_i2c.c b/libnfc/drivers/pn532_i2c.c index b62c7de..e56f998 100644 --- a/libnfc/drivers/pn532_i2c.c +++ b/libnfc/drivers/pn532_i2c.c @@ -68,7 +68,7 @@ struct pn532_i2c_data { }; /* Delay for the loop waiting for READY frame (in ms) */ -#define PN532_RDY_LOOP_DELAY 90 +#define PN532_RDY_LOOP_DELAY 1 const struct timespec rdyDelay = { .tv_sec = 0, @@ -389,7 +389,6 @@ pn532_i2c_wait_rdyframe(nfc_device *pnd, uint8_t *pbtData, const size_t szDataLe struct timeval start_tv, cur_tv; long long duration; - // Actual I2C response frame includes an additional status byte, // so we use a temporary buffer to read the I2C frame uint8_t i2cRx[PN53x_EXTENDED_FRAME__DATA_MAX_LEN + 1]; @@ -402,7 +401,6 @@ pn532_i2c_wait_rdyframe(nfc_device *pnd, uint8_t *pbtData, const size_t szDataLe do { // Wait a little bit before reading nanosleep(&rdyDelay, (struct timespec *) NULL); - int recCount = i2c_read(DRIVER_DATA(pnd)->dev, i2cRx, szDataLen + 1); if (DRIVER_DATA(pnd)->abort_flag) { @@ -445,7 +443,6 @@ pn532_i2c_wait_rdyframe(nfc_device *pnd, uint8_t *pbtData, const size_t szDataLe } } } while (!done); - return res; }