Make use of new PN53x_ACK_FRAME__LEN

This commit is contained in:
Philippe Teuwen 2013-06-15 23:14:54 +02:00
parent 005713921e
commit 03e1f23a40
6 changed files with 12 additions and 12 deletions

View file

@ -294,8 +294,8 @@ typedef enum {
PTM_ISO14443_4_PICC_ONLY = 0x04 PTM_ISO14443_4_PICC_ONLY = 0x04
} pn53x_target_mode; } pn53x_target_mode;
extern const uint8_t pn53x_ack_frame[6]; extern const uint8_t pn53x_ack_frame[PN53x_ACK_FRAME__LEN];
extern const uint8_t pn53x_nack_frame[6]; extern const uint8_t pn53x_nack_frame[PN53x_ACK_FRAME__LEN];
int pn53x_init(struct nfc_device *pnd); int pn53x_init(struct nfc_device *pnd);
int pn53x_transceive(struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, const size_t szRxLen, int timeout); int pn53x_transceive(struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, const size_t szRxLen, int timeout);

View file

@ -337,7 +337,7 @@ arygon_tama_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, i
return pnd->last_error; return pnd->last_error;
} }
uint8_t abtRxBuf[6]; uint8_t abtRxBuf[PN53x_ACK_FRAME__LEN];
if ((res = uart_receive(DRIVER_DATA(pnd)->port, abtRxBuf, sizeof(abtRxBuf), 0, timeout)) != 0) { if ((res = uart_receive(DRIVER_DATA(pnd)->port, abtRxBuf, sizeof(abtRxBuf), 0, timeout)) != 0) {
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "%s", "Unable to read ACK"); log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "%s", "Unable to read ACK");
pnd->last_error = res; pnd->last_error = res;

View file

@ -337,7 +337,7 @@ pn532_i2c_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int
uint8_t abtRxBuf[PN53x_ACK_FRAME__LEN]; uint8_t abtRxBuf[PN53x_ACK_FRAME__LEN];
// Wait for the ACK frame // Wait for the ACK frame
res = pn532_i2c_wait_rdyframe(pnd, abtRxBuf, PN53x_ACK_FRAME__LEN, timeout); res = pn532_i2c_wait_rdyframe(pnd, abtRxBuf, sizeof(abtRxBuf), timeout);
if (res < 0) { if (res < 0) {
if (res == NFC_EOPABORTED) { if (res == NFC_EOPABORTED) {
// Send an ACK frame from host to abort the command. // Send an ACK frame from host to abort the command.

View file

@ -601,8 +601,8 @@ pn532_spi_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int
uint8_t abtRxBuf[6]; uint8_t abtRxBuf[PN53x_ACK_FRAME__LEN];
res = spi_send_receive(DRIVER_DATA(pnd)->port, &pn532_spi_cmd_dataread, 1, abtRxBuf, 6, true); res = spi_send_receive(DRIVER_DATA(pnd)->port, &pn532_spi_cmd_dataread, 1, abtRxBuf, sizeof(abtRxBuf), true);
if (res != 0) { if (res != 0) {
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%s", "Unable to read ACK"); log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%s", "Unable to read ACK");

View file

@ -334,8 +334,8 @@ pn532_uart_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, in
return pnd->last_error; return pnd->last_error;
} }
uint8_t abtRxBuf[6]; uint8_t abtRxBuf[PN53x_ACK_FRAME__LEN];
res = uart_receive(DRIVER_DATA(pnd)->port, abtRxBuf, 6, 0, timeout); res = uart_receive(DRIVER_DATA(pnd)->port, abtRxBuf, sizeof(abtRxBuf), 0, timeout);
if (res != 0) { if (res != 0) {
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%s", "Unable to read ACK"); log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%s", "Unable to read ACK");
pnd->last_error = res; pnd->last_error = res;