Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added setPassiveActivationRetries()

  • Loading branch information...
commit fb3a152098222518fc67b1c426ee3e3bd9be7938 1 parent fa03322
K. Townsend authored
Showing with 30 additions and 0 deletions.
  1. +29 −0 Adafruit_NFCShield_I2C.cpp
  2. +1 −0  Adafruit_NFCShield_I2C.h
View
29 Adafruit_NFCShield_I2C.cpp
@@ -19,6 +19,8 @@
@section HISTORY
+ v1.4 - Added setPassiveActivationRetries()
+
v1.3 - Modified to work with I2C
v1.2 - Added writeGPIO()
@@ -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 ******/
/**************************************************************************/
View
1  Adafruit_NFCShield_I2C.h
@@ -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);
Please sign in to comment.
Something went wrong with that request. Please try again.