Minor tweaks.
- Rename the nfc_device_t's struct iErrorCode member to iPICCError (We are
likely to have both PICC and PCD errors fields to avoid unneeded complexity
at some point);
- Make the PN53x error descriptions static;
- Enhance some comments here and there.
This commit is contained in:
parent
b289784359
commit
0502401a29
3 changed files with 10 additions and 10 deletions
|
|
@ -69,8 +69,8 @@ typedef struct {
|
||||||
bool bPar;
|
bool bPar;
|
||||||
/** The last tx bits setting, we need to reset this if it does not apply anymore */
|
/** The last tx bits setting, we need to reset this if it does not apply anymore */
|
||||||
uint8_t ui8TxBits;
|
uint8_t ui8TxBits;
|
||||||
/** The last error encountered by the device */
|
/** Last error reported by the PICC */
|
||||||
int iErrorCode;
|
int iPICCError;
|
||||||
} nfc_device_t;
|
} nfc_device_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -121,13 +121,13 @@ bool pn53x_transceive(nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxL
|
||||||
case 0x90: // TgResponseToInitiator
|
case 0x90: // TgResponseToInitiator
|
||||||
case 0x92: // TgSetGeneralBytes
|
case 0x92: // TgSetGeneralBytes
|
||||||
case 0x94: // TgSetMetaData
|
case 0x94: // TgSetMetaData
|
||||||
pnd->iErrorCode = pbtRx[0] & 0x3f;
|
pnd->iPICCError = pbtRx[0] & 0x3f;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pnd->iErrorCode = 0;
|
pnd->iPICCError = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0 == pnd->iErrorCode);
|
return (0 == pnd->iPICCError);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t pn53x_get_reg(nfc_device_t* pnd, uint16_t ui16Reg)
|
byte_t pn53x_get_reg(nfc_device_t* pnd, uint16_t ui16Reg)
|
||||||
|
|
@ -378,7 +378,7 @@ pn53x_InRelease(nfc_device_t* pnd, const uint8_t ui8Target)
|
||||||
return(pn53x_transceive(pnd,abtCmd,sizeof(abtCmd),NULL,NULL));
|
return(pn53x_transceive(pnd,abtCmd,sizeof(abtCmd),NULL,NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sErrorMessage {
|
static struct sErrorMessage {
|
||||||
int iErrorCode;
|
int iErrorCode;
|
||||||
const char *pcErrorMsg;
|
const char *pcErrorMsg;
|
||||||
} sErrorMessages[] = {
|
} sErrorMessages[] = {
|
||||||
|
|
@ -421,7 +421,7 @@ pn53x_strerror (const nfc_device_t *pnd)
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i=0; i < (sizeof (sErrorMessages) / sizeof (struct sErrorMessage)); i++) {
|
for (i=0; i < (sizeof (sErrorMessages) / sizeof (struct sErrorMessage)); i++) {
|
||||||
if (sErrorMessages[i].iErrorCode == pnd->iErrorCode) {
|
if (sErrorMessages[i].iErrorCode == pnd->iPICCError) {
|
||||||
pcRes = sErrorMessages[i].pcErrorMsg;
|
pcRes = sErrorMessages[i].pcErrorMsg;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1088,7 +1088,7 @@ bool nfc_target_send_dep_bytes(nfc_device_t* pnd, const byte_t* pbtTx, const siz
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return the PCD error string
|
* @brief Return the PICC/PCD error string
|
||||||
* @return Returns a string
|
* @return Returns a string
|
||||||
*/
|
*/
|
||||||
const char *nfc_strerror (const nfc_device_t *pnd)
|
const char *nfc_strerror (const nfc_device_t *pnd)
|
||||||
|
|
@ -1097,7 +1097,7 @@ const char *nfc_strerror (const nfc_device_t *pnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Renders the PCD error in pcStrErrBuf for a maximum size of szBufLen caracters
|
* @brief Renders the PICC/PCD error in pcStrErrBuf for a maximum size of szBufLen caracters
|
||||||
* @return Returns 0 upon success
|
* @return Returns 0 upon success
|
||||||
*/
|
*/
|
||||||
int nfc_strerror_r (const nfc_device_t *pnd, char *pcStrErrBuf, size_t szBufLen)
|
int nfc_strerror_r (const nfc_device_t *pnd, char *pcStrErrBuf, size_t szBufLen)
|
||||||
|
|
@ -1106,7 +1106,7 @@ int nfc_strerror_r (const nfc_device_t *pnd, char *pcStrErrBuf, size_t szBufLen)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Display the PCD error a-la perror
|
* @brief Display the PICC/PCD error a-la perror
|
||||||
*/
|
*/
|
||||||
void nfc_perror (const nfc_device_t *pnd, const char *pcString)
|
void nfc_perror (const nfc_device_t *pnd, const char *pcString)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue