drivers/pn53x*: use shared pn53x_ack_frame[] and pn53x_nack_frame[] instead of local declaration.
This commit is contained in:
parent
699e9008d1
commit
904f41e0f7
4 changed files with 8 additions and 12 deletions
|
@ -48,8 +48,8 @@
|
||||||
// TODO: Count max bytes for InJumpForDEP reply
|
// TODO: Count max bytes for InJumpForDEP reply
|
||||||
const byte_t pncmd_initiator_jump_for_dep[68] = { 0xD4, 0x56 };
|
const byte_t pncmd_initiator_jump_for_dep[68] = { 0xD4, 0x56 };
|
||||||
|
|
||||||
static const byte_t pn53x_ack_frame[] = { 0x00, 0x00, 0xff, 0x00, 0xff, 0x00 };
|
const byte_t pn53x_ack_frame[] = { 0x00, 0x00, 0xff, 0x00, 0xff, 0x00 };
|
||||||
static const byte_t pn53x_nack_frame[] = { 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 };
|
const byte_t pn53x_nack_frame[] = { 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 };
|
||||||
static const byte_t pn53x_error_frame[] = { 0x00, 0x00, 0xff, 0x01, 0xff, 0x7f, 0x81, 0x00 };
|
static const byte_t pn53x_error_frame[] = { 0x00, 0x00, 0xff, 0x01, 0xff, 0x7f, 0x81, 0x00 };
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
|
|
|
@ -250,6 +250,9 @@ typedef enum {
|
||||||
PTM_ISO14443_4_PICC_ONLY = 0x04
|
PTM_ISO14443_4_PICC_ONLY = 0x04
|
||||||
} pn53x_target_mode_t;
|
} pn53x_target_mode_t;
|
||||||
|
|
||||||
|
extern const byte_t pn53x_ack_frame[6];
|
||||||
|
extern const byte_t pn53x_nack_frame[6];
|
||||||
|
|
||||||
bool pn53x_init(nfc_device_t * pnd);
|
bool pn53x_init(nfc_device_t * pnd);
|
||||||
bool pn53x_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTx, byte_t * pbtRx, size_t *pszRx);
|
bool pn53x_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTx, byte_t * pbtRx, size_t *pszRx);
|
||||||
|
|
||||||
|
|
|
@ -46,9 +46,6 @@
|
||||||
#define PN532_UART_DEFAULT_SPEED 115200
|
#define PN532_UART_DEFAULT_SPEED 115200
|
||||||
#define PN532_UART_DRIVER_NAME "PN532_UART"
|
#define PN532_UART_DRIVER_NAME "PN532_UART"
|
||||||
|
|
||||||
// TODO Move this one level up for libnfc-1.6
|
|
||||||
static const byte_t ack_frame[] = { 0x00, 0x00, 0xff, 0x00, 0xff, 0x00 };
|
|
||||||
|
|
||||||
int pn532_uart_ack (nfc_device_t * pnd);
|
int pn532_uart_ack (nfc_device_t * pnd);
|
||||||
int pn532_uart_wakeup (nfc_device_t * pnd);
|
int pn532_uart_wakeup (nfc_device_t * pnd);
|
||||||
|
|
||||||
|
@ -422,7 +419,7 @@ pn532_uart_ack (nfc_device_t * pnd)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (0 == uart_send (DRIVER_DATA(pnd)->port, ack_frame, sizeof (ack_frame))) ? 0 : -1;
|
return (0 == uart_send (DRIVER_DATA(pnd)->port, pn53x_ack_frame, sizeof (pn53x_ack_frame))) ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -156,10 +156,6 @@ pn53x_usb_get_device_model (uint16_t vendor_id, uint16_t product_id)
|
||||||
return UNKNOWN;
|
return UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Move this HACK1 into an upper level in order to benefit to other devices that use PN53x
|
|
||||||
static const byte_t ack_frame[] = { 0x00, 0x00, 0xff, 0x00, 0xff, 0x00 };
|
|
||||||
static const byte_t nack_frame[] = { 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 };
|
|
||||||
|
|
||||||
int pn53x_usb_ack (nfc_device_t * pnd);
|
int pn53x_usb_ack (nfc_device_t * pnd);
|
||||||
|
|
||||||
// Find transfer endpoints for bulk transfers
|
// Find transfer endpoints for bulk transfers
|
||||||
|
@ -449,7 +445,7 @@ pn53x_usb_send (nfc_device_t * pnd, const byte_t * pbtData, const size_t szData)
|
||||||
// response packet. With this hack, the nextly executed function (ie.
|
// response packet. With this hack, the nextly executed function (ie.
|
||||||
// pn53x_usb_receive()) will be able to retreive the correct response
|
// pn53x_usb_receive()) will be able to retreive the correct response
|
||||||
// packet.
|
// packet.
|
||||||
int res = pn53x_usb_bulk_write (DRIVER_DATA (pnd), (byte_t *)nack_frame, sizeof(nack_frame));
|
int res = pn53x_usb_bulk_write (DRIVER_DATA (pnd), (byte_t *)pn53x_nack_frame, sizeof(pn53x_nack_frame));
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
pnd->iLastError = DEIO;
|
pnd->iLastError = DEIO;
|
||||||
// try to interrupt current device state
|
// try to interrupt current device state
|
||||||
|
@ -593,7 +589,7 @@ read:
|
||||||
int
|
int
|
||||||
pn53x_usb_ack (nfc_device_t * pnd)
|
pn53x_usb_ack (nfc_device_t * pnd)
|
||||||
{
|
{
|
||||||
return pn53x_usb_bulk_write (DRIVER_DATA (pnd), (byte_t *) ack_frame, sizeof (ack_frame));
|
return pn53x_usb_bulk_write (DRIVER_DATA (pnd), (byte_t *) pn53x_ack_frame, sizeof (pn53x_ack_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
Loading…
Add table
Reference in a new issue