Move some PN53x related code from nfc.c to pn53x.c
This commit is contained in:
parent
424a48714f
commit
d932cd8450
3 changed files with 62 additions and 47 deletions
|
|
@ -1,7 +1,7 @@
|
|||
/*-
|
||||
* Public platform independent Near Field Communication (NFC) library
|
||||
*
|
||||
* Copyright (C) 2009, Roel Verdult
|
||||
* Copyright (C) 2009, 2010, Roel Verdult, Romuald Conty
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
|
|
@ -274,3 +274,28 @@ pn53x_decode_target_data(const byte_t* pbtRawData, size_t szDataLen, nfc_chip_t
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
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,
|
||||
size_t* pszTargets, byte_t* pbtTargetsData, size_t* pszTargetsData)
|
||||
{
|
||||
byte_t abtCmd[sizeof(pncmd_initiator_list_passive)];
|
||||
memcpy(abtCmd,pncmd_initiator_list_passive,sizeof(pncmd_initiator_list_passive));
|
||||
|
||||
abtCmd[2] = szMaxTargets; // MaxTg
|
||||
abtCmd[3] = nmInitModulation; // BrTy, the type of init modulation used for polling a passive tag
|
||||
|
||||
// Set the optional initiator data (used for Felica, ISO14443B, Topaz Polling or for ISO14443A selecting a specific UID).
|
||||
if (pbtInitiatorData) memcpy(abtCmd+4,pbtInitiatorData,szInitiatorDataLen);
|
||||
|
||||
// Try to find a tag, call the tranceive callback function of the current device
|
||||
size_t szRxLen = MAX_FRAME_LEN;
|
||||
// We can not use pn53x_transceive() because abtRx[0] gives no status info
|
||||
if(pnd->pdc->transceive(pnd->nds,abtCmd,4+szInitiatorDataLen,pbtTargetsData,&szRxLen)) {
|
||||
*pszTargetsData = szRxLen;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -77,6 +77,6 @@ bool pn53x_set_tx_bits(const 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, size_t* pszTargets, byte_t* pbtTargetsData, size_t* pszTargetsData);
|
||||
#endif // __NFC_CHIPS_PN53X_H__
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue