Skip to content

Commit

Permalink
Fixes for NDEF keys
Browse files Browse the repository at this point in the history
  • Loading branch information
K. Townsend committed Oct 23, 2012
1 parent c519bc6 commit d30d48a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Adafruit_NFCShield_I2C.cpp
Expand Up @@ -722,6 +722,9 @@ uint8_t Adafruit_NFCShield_I2C::mifareclassic_FormatNDEF (void)
uint8_t sectorbuffer2[16] = {0x03, 0xE1, 0x03, 0xE1, 0x03, 0xE1, 0x03, 0xE1, 0x03, 0xE1, 0x03, 0xE1, 0x03, 0xE1, 0x03, 0xE1};
uint8_t sectorbuffer3[16] = {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0x78, 0x77, 0x88, 0xC1, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};

// Note 0xA0 0xA1 0xA2 0xA3 0xA4 0xA5 must be used for key A
// for the MAD sector in NDEF records (sector 0)

// Write block 1 and 2 to the card
if (!(mifareclassic_WriteDataBlock (1, sectorbuffer1)))
return 0;
Expand Down Expand Up @@ -766,6 +769,9 @@ uint8_t Adafruit_NFCShield_I2C::mifareclassic_WriteNDEFURI (uint8_t sectorNumber
if ((len < 1) || (len > 38))
return 0;

// Note 0xD3 0xF7 0xD3 0xF7 0xD3 0xF7 must be used for key A
// in NDEF records

// Setup the sector buffer (w/pre-formatted TLV wrapper and NDEF message)
uint8_t sectorbuffer1[16] = {0x00, 0x00, 0x03, len+5, 0xD1, 0x01, len+1, 0x55, uriIdentifier, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
uint8_t sectorbuffer2[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
Expand Down

0 comments on commit d30d48a

Please sign in to comment.