diff --git a/Adafruit_PN532.cpp b/Adafruit_PN532.cpp index 737659d..f6a640b 100644 --- a/Adafruit_PN532.cpp +++ b/Adafruit_PN532.cpp @@ -272,6 +272,24 @@ uint32_t Adafruit_PN532::getFirmwareVersion(void) { return response; } +/**************************************************************************/ +/*! + @brief Puts the module into sleep mode + + @returns 1 if everything is OK, 0 if unable to shutdown +*/ +/**************************************************************************/ + +bool Adafruit_PN532::shutDown() { + pn532_packetbuffer[0] = PN532_COMMAND_POWERDOWN; + pn532_packetbuffer[1] = 0x20; //(0x20, for SPI) (0x28 for SPI and RF detectionThe wakeup source(s) you want too use + pn532_packetbuffer[2] = 0x01; // To eneable the IRQ, 0x00 if you dont want too use the IRQ + + + if(sendCommandCheckAck(pn532_packetbuffer, 3)) + return pn532_packetbuffer[1]; +} + /**************************************************************************/ /*! @brief Sends a command and waits a specified period for the ACK diff --git a/Adafruit_PN532.h b/Adafruit_PN532.h index 46eaba8..b909674 100644 --- a/Adafruit_PN532.h +++ b/Adafruit_PN532.h @@ -166,6 +166,7 @@ class Adafruit_PN532 { bool writeGPIO(uint8_t pinstate); uint8_t readGPIO(void); bool setPassiveActivationRetries(uint8_t maxRetries); + bool shutDown(void); // ISO14443A functions bool readPassiveTargetID(