Commit 03e1f23a authored by Philippe Teuwen's avatar Philippe Teuwen

Make use of new PN53x_ACK_FRAME__LEN

parent 00571392
......@@ -112,10 +112,10 @@
* Start bytes, packet length, length checksum, direction, packet checksum and postamble are overhead
*/
// The TFI is considered part of the overhead
# define PN53x_NORMAL_FRAME__DATA_MAX_LEN 254
# define PN53x_NORMAL_FRAME__OVERHEAD 8
# define PN53x_EXTENDED_FRAME__DATA_MAX_LEN 264
# define PN53x_EXTENDED_FRAME__OVERHEAD 11
# define PN53x_NORMAL_FRAME__DATA_MAX_LEN 254
# define PN53x_NORMAL_FRAME__OVERHEAD 8
# define PN53x_EXTENDED_FRAME__DATA_MAX_LEN 264
# define PN53x_EXTENDED_FRAME__OVERHEAD 11
# define PN53x_ACK_FRAME__LEN 6
typedef struct {
......
......@@ -294,8 +294,8 @@ typedef enum {
PTM_ISO14443_4_PICC_ONLY = 0x04
} pn53x_target_mode;
extern const uint8_t pn53x_ack_frame[6];
extern const uint8_t pn53x_nack_frame[6];
extern const uint8_t pn53x_ack_frame[PN53x_ACK_FRAME__LEN];
extern const uint8_t pn53x_nack_frame[PN53x_ACK_FRAME__LEN];
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);
......
......@@ -337,7 +337,7 @@ arygon_tama_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, i
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) {
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "%s", "Unable to read ACK");
pnd->last_error = res;
......
......@@ -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];
// 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 == NFC_EOPABORTED) {
// Send an ACK frame from host to abort the command.
......
......@@ -601,8 +601,8 @@ pn532_spi_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int
uint8_t abtRxBuf[6];
res = spi_send_receive(DRIVER_DATA(pnd)->port, &pn532_spi_cmd_dataread, 1, abtRxBuf, 6, true);
uint8_t abtRxBuf[PN53x_ACK_FRAME__LEN];
res = spi_send_receive(DRIVER_DATA(pnd)->port, &pn532_spi_cmd_dataread, 1, abtRxBuf, sizeof(abtRxBuf), true);
if (res != 0) {
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%s", "Unable to read ACK");
......
......@@ -334,8 +334,8 @@ pn532_uart_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, in
return pnd->last_error;
}
uint8_t abtRxBuf[6];
res = uart_receive(DRIVER_DATA(pnd)->port, abtRxBuf, 6, 0, timeout);
uint8_t abtRxBuf[PN53x_ACK_FRAME__LEN];
res = uart_receive(DRIVER_DATA(pnd)->port, abtRxBuf, sizeof(abtRxBuf), 0, timeout);
if (res != 0) {
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%s", "Unable to read ACK");
pnd->last_error = res;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment