Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ntag2xx_WriteNDEFURI NTAG215 and NTAG216 compatability #56

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Adafruit_PN532.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1395,15 +1395,15 @@ uint8_t Adafruit_PN532::ntag2xx_WritePage (uint8_t page, uint8_t * data)
@returns 1 if everything executed properly, 0 for an error
*/
/**************************************************************************/
uint8_t Adafruit_PN532::ntag2xx_WriteNDEFURI (uint8_t uriIdentifier, char * url, uint8_t dataLen)
uint8_t Adafruit_PN532::ntag2xx_WriteNDEFURI (uint8_t uriIdentifier, char * url, uint16_t dataLen)
{
uint8_t pageBuffer[4] = { 0, 0, 0, 0 };

// Remove NDEF record overhead from the URI data (pageHeader below)
uint8_t wrapperSize = 12;

// Figure out how long the string is
uint8_t len = strlen(url);
uint16_t len = strlen(url);

// Make sure the URI payload will fit in dataLen (include 0xFE trailer)
if ((len < 1) || (len+1 > (dataLen-wrapperSize)))
Expand Down Expand Up @@ -1547,7 +1547,9 @@ bool Adafruit_PN532::waitready(uint16_t timeout) {
if (timeout != 0) {
timer += 10;
if (timer > timeout) {
PN532DEBUGPRINT.println("TIMEOUT!");
#ifdef PN532DEBUG
PN532DEBUGPRINT.println("TIMEOUT!");
#endif
return false;
}
}
Expand Down Expand Up @@ -1809,4 +1811,4 @@ uint8_t Adafruit_PN532::spi_read(void) {
}

return x;
}
}
4 changes: 2 additions & 2 deletions Adafruit_PN532.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class Adafruit_PN532{
// NTAG2xx functions
uint8_t ntag2xx_ReadPage (uint8_t page, uint8_t * buffer);
uint8_t ntag2xx_WritePage (uint8_t page, uint8_t * data);
uint8_t ntag2xx_WriteNDEFURI (uint8_t uriIdentifier, char * url, uint8_t dataLen);
uint8_t ntag2xx_WriteNDEFURI (uint8_t uriIdentifier, char * url, uint16_t dataLen);

// Help functions to display formatted text
static void PrintHex(const byte * data, const uint32_t numBytes);
Expand Down Expand Up @@ -219,4 +219,4 @@ class Adafruit_PN532{
// Note there are i2c_read and i2c_write inline functions defined in the .cpp file.
};

#endif
#endif