pn53x_set_parameters() function returns now libnfc error code.
This commit is contained in:
parent
9c5ec3c4e1
commit
c5f05f0592
2 changed files with 11 additions and 10 deletions
|
@ -74,7 +74,7 @@ pn53x_init(struct nfc_device *pnd)
|
|||
|
||||
// We can't read these parameters, so we set a default config by using the SetParameters wrapper
|
||||
// Note: pn53x_SetParameters() will save the sent value in pnd->ui8Parameters cache
|
||||
if(!pn53x_SetParameters(pnd, PARAM_AUTO_ATR_RES | PARAM_AUTO_RATS)) {
|
||||
if(pn53x_SetParameters(pnd, PARAM_AUTO_ATR_RES | PARAM_AUTO_RATS) < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -195,14 +195,14 @@ pn53x_transceive (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szT
|
|||
return ((0 == CHIP_DATA(pnd)->last_status_byte) ? NFC_SUCCESS : NFC_ECHIP);
|
||||
}
|
||||
|
||||
bool
|
||||
int
|
||||
pn53x_set_parameters (struct nfc_device *pnd, const uint8_t ui8Parameter, const bool bEnable)
|
||||
{
|
||||
uint8_t ui8Value = (bEnable) ? (CHIP_DATA (pnd)->ui8Parameters | ui8Parameter) : (CHIP_DATA (pnd)->ui8Parameters & ~(ui8Parameter));
|
||||
if (ui8Value != CHIP_DATA (pnd)->ui8Parameters) {
|
||||
return pn53x_SetParameters(pnd, ui8Value);
|
||||
}
|
||||
return true;
|
||||
return NFC_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -761,7 +761,7 @@ pn53x_set_property_bool (struct nfc_device *pnd, const nfc_property property, co
|
|||
// Nothing to do
|
||||
return NFC_SUCCESS;
|
||||
pnd->bAutoIso14443_4 = bEnable;
|
||||
if (pn53x_set_parameters (pnd, PARAM_AUTO_RATS, bEnable))
|
||||
if (pn53x_set_parameters (pnd, PARAM_AUTO_RATS, bEnable) == 0)
|
||||
return NFC_SUCCESS;
|
||||
break;
|
||||
|
||||
|
@ -2010,17 +2010,18 @@ pn53x_RFConfiguration__MaxRetries (struct nfc_device *pnd, const uint8_t MxRtyAT
|
|||
return pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, NULL, -1);
|
||||
}
|
||||
|
||||
bool
|
||||
int
|
||||
pn53x_SetParameters (struct nfc_device *pnd, const uint8_t ui8Value)
|
||||
{
|
||||
uint8_t abtCmd[] = { SetParameters, ui8Value };
|
||||
int res = 0;
|
||||
|
||||
if(pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, NULL, -1) < 0) {
|
||||
return false;
|
||||
if((res = pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, NULL, -1)) < 0) {
|
||||
return res;
|
||||
}
|
||||
// We save last parameters in register cache
|
||||
CHIP_DATA (pnd)->ui8Parameters = ui8Value;
|
||||
return true;
|
||||
return NFC_SUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -266,7 +266,7 @@ extern const uint8_t pn53x_nack_frame[6];
|
|||
bool pn53x_init(struct nfc_device *pnd);
|
||||
int pn53x_transceive (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, size_t *pszRx, int timeout);
|
||||
|
||||
bool pn53x_set_parameters (struct nfc_device *pnd, const uint8_t ui8Value, const bool bEnable);
|
||||
int pn53x_set_parameters (struct nfc_device *pnd, const uint8_t ui8Value, const bool bEnable);
|
||||
bool pn53x_set_tx_bits (struct nfc_device *pnd, const uint8_t ui8Bits);
|
||||
bool pn53x_wrap_frame (const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar, uint8_t *pbtFrame,
|
||||
size_t *pszFrameBits);
|
||||
|
@ -322,7 +322,7 @@ bool pn53x_target_send_bytes (struct nfc_device *pnd, const uint8_t *pbtTx, c
|
|||
const char *pn53x_strerror (const struct nfc_device *pnd);
|
||||
|
||||
// C wrappers for PN53x commands
|
||||
bool pn53x_SetParameters (struct nfc_device *pnd, const uint8_t ui8Value);
|
||||
int pn53x_SetParameters (struct nfc_device *pnd, const uint8_t ui8Value);
|
||||
int pn53x_SAMConfiguration (struct nfc_device *pnd, const pn532_sam_mode mode, int timeout);
|
||||
int pn53x_PowerDown (struct nfc_device *pnd);
|
||||
int pn53x_InListPassiveTarget (struct nfc_device *pnd, const pn53x_modulation pmInitModulation,
|
||||
|
|
Loading…
Reference in a new issue