Factorise code.
Avoid redundant code in PN53x usb and uart drivers. Since it makes sense to report errors at the nfc_device_t level, pass it directly to pn53x_transceive(). Programs using the libnfc MAY use pn53x_transceive() to communicate with a NFC device, and SHALL not use anymore pnd->pdc->transceive(). Code in the library itself SHOULD avoid calling pnd->pdc->transceive(), so such construct have been updated accordingly.
This commit is contained in:
parent
301d692e8a
commit
79aeaa6287
15 changed files with 80 additions and 70 deletions
|
|
@ -69,16 +69,17 @@
|
|||
#define RFCI_ANALOG_TYPE_B 0x0C // 3
|
||||
#define RFCI_ANALOG_TYPE_14443_4 0x0D // 9
|
||||
|
||||
bool pn53x_transceive_callback(nfc_device_t* pnd, const byte_t *pbtRxFrame, const size_t szRxFrameLen);
|
||||
bool pn53x_transceive(nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen);
|
||||
byte_t pn53x_get_reg(const nfc_device_t* pnd, uint16_t ui16Reg);
|
||||
bool pn53x_set_reg(const nfc_device_t* pnd, uint16_t ui16Reg, uint8_t ui8SybmolMask, uint8_t ui8Value);
|
||||
bool pn53x_set_parameters(const nfc_device_t* pnd, uint8_t ui8Value);
|
||||
bool pn53x_set_tx_bits(const nfc_device_t* pnd, uint8_t ui8Bits);
|
||||
byte_t pn53x_get_reg(nfc_device_t* pnd, uint16_t ui16Reg);
|
||||
bool pn53x_set_reg(nfc_device_t* pnd, uint16_t ui16Reg, uint8_t ui8SybmolMask, uint8_t ui8Value);
|
||||
bool pn53x_set_parameters(nfc_device_t* pnd, uint8_t ui8Value);
|
||||
bool pn53x_set_tx_bits(nfc_device_t* pnd, uint8_t ui8Bits);
|
||||
bool pn53x_wrap_frame(const byte_t* pbtTx, const size_t szTxBits, const byte_t* pbtTxPar, byte_t* pbtFrame, size_t* pszFrameBits);
|
||||
bool pn53x_unwrap_frame(const byte_t* pbtFrame, const size_t szFrameBits, byte_t* pbtRx, size_t* pszRxBits, byte_t* pbtRxPar);
|
||||
bool pn53x_decode_target_data(const byte_t* pbtRawData, size_t szDataLen, nfc_chip_t nc, nfc_target_type_t ntt, nfc_target_info_t* pnti);
|
||||
|
||||
bool pn53x_InListPassiveTarget(const nfc_device_t* pnd, const nfc_modulation_t nmInitModulation, const byte_t szMaxTargets, const byte_t* pbtInitiatorData, const size_t szInitiatorDataLen, byte_t* pbtTargetsData, size_t* pszTargetsData);
|
||||
bool pn53x_InListPassiveTarget(nfc_device_t* pnd, const nfc_modulation_t nmInitModulation, const byte_t szMaxTargets, const byte_t* pbtInitiatorData, const size_t szInitiatorDataLen, byte_t* pbtTargetsData, size_t* pszTargetsData);
|
||||
bool pn53x_InDeselect(nfc_device_t* pnd, const uint8_t ui8Target);
|
||||
|
||||
const char *pn53x_strerror (const nfc_device_t *pnd);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue