NFC library using PN532 to read/write NDEF Messages to NFC tags
Dependents: Seeed_NFC_Shield_write Nucleo_test_nfc
Fork of PN532 by
Ndef.cpp
00001 #include "Ndef.h" 00002 #include "PN532_debug.h" 00003 00004 // Borrowed from Adafruit_NFCShield_I2C 00005 void PrintHex(const uint8_t * data, const long numuint8_ts) 00006 { 00007 uint32_t szPos; 00008 for (szPos=0; szPos < numuint8_ts; szPos++) 00009 { 00010 DMSG("0x"); 00011 // Append leading 0 for small values 00012 if (data[szPos] <= 0xF) 00013 DMSG("0"); 00014 DMSG_HEX(data[szPos]&0xff); 00015 if ((numuint8_ts > 1) && (szPos != numuint8_ts - 1)) 00016 { 00017 DMSG(" "); 00018 } 00019 } 00020 DMSG(""); 00021 } 00022 00023 // Borrowed from Adafruit_NFCShield_I2C 00024 void PrintHexChar(const uint8_t * data, const long numuint8_ts) 00025 { 00026 uint32_t szPos; 00027 for (szPos=0; szPos < numuint8_ts; szPos++) 00028 { 00029 // Append leading 0 for small values 00030 DMSG_HEX(data[szPos]); 00031 } 00032 DMSG(" "); 00033 for (szPos=0; szPos < numuint8_ts; szPos++) 00034 { 00035 if (data[szPos] <= 0x1F) 00036 DMSG("."); 00037 else 00038 DMSG("%c", (char)data[szPos]); 00039 } 00040 DMSG("\n"); 00041 } 00042 00043 // Note if buffer % blockSize != 0, last block will not be written 00044 void DumpHex(const uint8_t * data, const long numuint8_ts, const unsigned int blockSize) 00045 { 00046 int i; 00047 for (i = 0; i < (numuint8_ts / blockSize); i++) 00048 { 00049 PrintHexChar(data, blockSize); 00050 data += blockSize; 00051 } 00052 }
Generated on Tue Jul 12 2022 21:59:39 by 1.7.2