Skip to content

Commit

Permalink
Added setPassiveActivationRetries()
Browse files Browse the repository at this point in the history
  • Loading branch information
K. Townsend committed Jul 23, 2012
1 parent fa03322 commit fb3a152
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Adafruit_NFCShield_I2C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
@section HISTORY
v1.4 - Added setPassiveActivationRetries()
v1.3 - Modified to work with I2C
v1.2 - Added writeGPIO()
Expand Down Expand Up @@ -394,6 +396,33 @@ boolean Adafruit_NFCShield_I2C::SAMConfig(void) {
return (pn532_packetbuffer[6] == 0x15);
}

/**************************************************************************/
/*!
Sets the MxRtyPassiveActivation byte of the RFConfiguration register
@param maxRetries 0xFF to wait forever, 0x00..0xFE to timeout
after mxRetries
@returns 1 if everything executed properly, 0 for an error
*/
/**************************************************************************/
boolean Adafruit_NFCShield_I2C::setPassiveActivationRetries(uint8_t maxRetries) {
pn532_packetbuffer[0] = PN532_COMMAND_RFCONFIGURATION;
pn532_packetbuffer[1] = 5; // Config item 5 (MaxRetries)
pn532_packetbuffer[2] = 0xFF; // MxRtyATR (default = 0xFF)
pn532_packetbuffer[3] = 0x01; // MxRtyPSL (default = 0x01)
pn532_packetbuffer[4] = maxRetries;

#ifdef MIFAREDEBUG
Serial.print("Setting MxRtyPassiveActivation to "); Serial.print(maxRetries, DEC); Serial.println(" ");
#endif

if (! sendCommandCheckAck(pn532_packetbuffer, 5))
return 0x0; // no ACK

return 1;
}

/***** ISO14443A Commands ******/

/**************************************************************************/
Expand Down
1 change: 1 addition & 0 deletions Adafruit_NFCShield_I2C.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ class Adafruit_NFCShield_I2C{
boolean sendCommandCheckAck(uint8_t *cmd, uint8_t cmdlen, uint16_t timeout = 1000);
boolean writeGPIO(uint8_t pinstate);
uint8_t readGPIO(void);
boolean setPassiveActivationRetries(uint8_t maxRetries);

// ISO14443A functions
boolean readPassiveTargetID(uint8_t cardbaudrate, uint8_t * uid, uint8_t * uidLength);
Expand Down

0 comments on commit fb3a152

Please sign in to comment.