Enable aborting blocking commands (e.g. TgInitAsTarget) and refactor
*_check_communication() as pn53x_check_communication().
This commit is contained in:
parent
7ed71a1501
commit
4b6060aeeb
10 changed files with 118 additions and 43 deletions
|
|
@ -755,6 +755,7 @@ static struct sErrorMessage {
|
|||
{ DEINVAL, "Invalid argument" },
|
||||
{ DEIO, "Input/output error" },
|
||||
{ DETIMEOUT, "Operation timed-out" },
|
||||
{ DEABORT, "Operation aborted" },
|
||||
{ DENOTSUP, "Operation not supported" }
|
||||
};
|
||||
|
||||
|
|
@ -1686,3 +1687,16 @@ pn53x_nm_to_ptt(const nfc_modulation_t nm)
|
|||
return PTT_UNDEFINED;
|
||||
}
|
||||
|
||||
bool
|
||||
pn53x_check_communication (nfc_device_t *pnd)
|
||||
{
|
||||
const byte_t abtCmd[] = { Diagnose, 0x00, 'l', 'i', 'b', 'n', 'f', 'c' };
|
||||
const byte_t abtExpectedRx[] = { 0x00, 'l', 'i', 'b', 'n', 'f', 'c' };
|
||||
byte_t abtRx[sizeof(abtExpectedRx)];
|
||||
size_t szRx = sizeof (abtRx);
|
||||
|
||||
if (!pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), abtRx, &szRx))
|
||||
return false;
|
||||
|
||||
return ((sizeof(abtExpectedRx) == szRx) && (0 == memcmp (abtRx, abtExpectedRx, sizeof(abtExpectedRx))));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,6 +210,7 @@ bool pn53x_decode_target_data (const byte_t * pbtRawData, size_t szRawData,
|
|||
nfc_target_info_t * pnti);
|
||||
bool pn53x_get_firmware_version (nfc_device_t * pnd, char abtFirmwareText[18]);
|
||||
bool pn53x_configure (nfc_device_t * pnd, const nfc_device_option_t ndo, const bool bEnable);
|
||||
bool pn53x_check_communication (nfc_device_t *pnd);
|
||||
|
||||
// NFC device as Initiator functions
|
||||
bool pn53x_initiator_select_passive_target (nfc_device_t * pnd,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue