Add configuration option to enable/disable auto iso14443-4 mode.

This commit is contained in:
Romuald Conty 2010-08-19 10:58:15 +00:00
parent 27b97c0fda
commit 8f19b078ff
3 changed files with 15 additions and 3 deletions

View file

@ -131,7 +131,9 @@ typedef enum {
/** If this option is enabled, frames that carry less than 4 bits are allowed. According to the standards these frames should normally be handles as invalid frames. */
NDO_ACCEPT_INVALID_FRAMES = 0x30,
/** If the NFC device should only listen to frames, it could be useful to let it gather multiple frames in a sequence. They will be stored in the internal FIFO of the PN53X chip. This could be retrieved by using the receive data functions. Note that if the chip runs out of bytes (FIFO = 64 bytes long), it will overwrite the first received frames, so quick retrieving of the received data is desirable. */
NDO_ACCEPT_MULTIPLE_FRAMES = 0x31
NDO_ACCEPT_MULTIPLE_FRAMES = 0x31,
/** This option can be used to enable or disable the auto-switching mode to ISO14443-4 is device is compliant */
NDO_AUTO_ISO14443_4 = 0x40,
} nfc_device_option_t;
////////////////////////////////////////////////////////////////////

View file

@ -50,6 +50,9 @@
#define REG_CIU_BIT_FRAMING 0x633D
#define SYMBOL_TX_LAST_BITS 0x07
#define SYMBOL_PARAM_fAutomaticRATS 0x10
#define SYMBOL_PARAM_fAutomaticATR_RES 0x04
// Internal parameters flags
#define PARAM_NONE 0x00
#define PARAM_NAD_USED 0x01

View file

@ -312,8 +312,15 @@ bool nfc_configure(nfc_device_t* pnd, const nfc_device_option_t ndo, const bool
case NDO_ACCEPT_MULTIPLE_FRAMES:
btValue = (bEnable) ? SYMBOL_RX_MULTIPLE : 0x00;
if (!pn53x_set_reg(pnd,REG_CIU_RX_MODE,SYMBOL_RX_MULTIPLE,btValue)) return false;
return true;
return true;
break;
case NDO_AUTO_ISO14443_4:
// TODO: PN53x parameters could not be read, so we have to buffered current value in order to prevent from configuration overwrite
// ATM, buffered current value is not needed due to a single usage of these parameters
btValue = (bEnable) ? (SYMBOL_PARAM_fAutomaticRATS | SYMBOL_PARAM_fAutomaticATR_RES): SYMBOL_PARAM_fAutomaticATR_RES;
if(!pn53x_set_parameters(pnd,btValue)) return false;
return true;
break;
}