Skip to content
This repository was archived by the owner on Jun 8, 2022. It is now read-only.

Commit 2229300

Browse files
TrappmannTrappmann
Trappmann
authored and
Trappmann
committed
Version 1.5
1 parent d5f0ca9 commit 2229300

5 files changed

+54
-30
lines changed

.development

Whitespace-only changes.

PN5180ISO15693.cpp

+27-27
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include "PN5180ISO15693.h"
2323
#include "Debug.h"
2424

25-
PN5180ISO15693::PN5180ISO15693(uint8_t SSpin, uint8_t BUSYpin, uint8_t RSTpin)
25+
PN5180ISO15693::PN5180ISO15693(uint8_t SSpin, uint8_t BUSYpin, uint8_t RSTpin)
2626
: PN5180(SSpin, BUSYpin, RSTpin) {
2727
}
2828

@@ -41,9 +41,9 @@ ISO15693ErrorCode PN5180ISO15693::getInventory(uint8_t *uid) {
4141
PN5180DEBUG(F("Get Inventory...\n"));
4242

4343
for (int i=0; i<8; i++) {
44-
uid[i] = 0;
44+
uid[i] = 0;
4545
}
46-
46+
4747
uint8_t *readBuffer;
4848
ISO15693ErrorCode rc = issueISO15693Command(inventory, sizeof(inventory), &readBuffer);
4949
if (ISO15693_EC_OK != rc) {
@@ -55,15 +55,15 @@ ISO15693ErrorCode PN5180ISO15693::getInventory(uint8_t *uid) {
5555
PN5180DEBUG(F(", Data Storage Format ID: "));
5656
PN5180DEBUG(formatHex(readBuffer[1]));
5757
PN5180DEBUG(F(", UID: "));
58-
58+
5959
for (int i=0; i<8; i++) {
6060
uid[i] = readBuffer[2+i];
6161
#ifdef DEBUG
6262
PN5180DEBUG(formatHex(uid[7-i])); // LSB comes first
6363
if (i<2) PN5180DEBUG(":");
6464
#endif
6565
}
66-
66+
6767
PN5180DEBUG("\n");
6868

6969
return ISO15693_EC_OK;
@@ -126,13 +126,13 @@ ISO15693ErrorCode PN5180ISO15693::readSingleBlock(uint8_t *uid, uint8_t blockNo,
126126
}
127127

128128
PN5180DEBUG("Value=");
129-
129+
130130
for (int i=0; i<blockSize; i++) {
131-
blockData[i] = resultPtr[2+i];
131+
blockData[i] = resultPtr[1+i];
132132
#ifdef DEBUG
133133
PN5180DEBUG(formatHex(blockData[i]));
134134
PN5180DEBUG(" ");
135-
#endif
135+
#endif
136136
}
137137

138138
#ifdef DEBUG
@@ -291,7 +291,7 @@ ISO15693ErrorCode PN5180ISO15693::getSystemInfo(uint8_t *uid, uint8_t *blockSize
291291
for (int i=0; i<8; i++) {
292292
uid[i] = readBuffer[2+i];
293293
}
294-
294+
295295
#ifdef DEBUG
296296
PN5180DEBUG("UID=");
297297
for (int i=0; i<8; i++) {
@@ -300,7 +300,7 @@ ISO15693ErrorCode PN5180ISO15693::getSystemInfo(uint8_t *uid, uint8_t *blockSize
300300
}
301301
PN5180DEBUG("\n");
302302
#endif
303-
303+
304304
uint8_t *p = &readBuffer[10];
305305

306306
uint8_t infoFlags = readBuffer[1];
@@ -311,9 +311,9 @@ ISO15693ErrorCode PN5180ISO15693::getSystemInfo(uint8_t *uid, uint8_t *blockSize
311311
PN5180DEBUG("\n");
312312
}
313313
#ifdef DEBUG
314-
else PN5180DEBUG(F("No DSFID\n"));
314+
else PN5180DEBUG(F("No DSFID\n"));
315315
#endif
316-
316+
317317
if (infoFlags & 0x02) { // AFI flag
318318
uint8_t afi = *p++;
319319
PN5180DEBUG(F("AFI=")); // Application family identifier
@@ -361,7 +361,7 @@ ISO15693ErrorCode PN5180ISO15693::getSystemInfo(uint8_t *uid, uint8_t *blockSize
361361
#ifdef DEBUG
362362
else PN5180DEBUG(F("No VICC memory size\n"));
363363
#endif
364-
364+
365365
if (infoFlags & 0x08) { // IC reference
366366
uint8_t icRef = *p++;
367367
PN5180DEBUG("IC Ref=");
@@ -379,8 +379,8 @@ ISO15693ErrorCode PN5180ISO15693::getSystemInfo(uint8_t *uid, uint8_t *blockSize
379379
// ICODE SLIX specific commands
380380

381381
/*
382-
* The GET RANDOM NUMBER command is required to receive a random number from the label IC.
383-
* The passwords that will be transmitted with the SET PASSWORD,ENABLEPRIVACY and DESTROY commands
382+
* The GET RANDOM NUMBER command is required to receive a random number from the label IC.
383+
* The passwords that will be transmitted with the SET PASSWORD,ENABLEPRIVACY and DESTROY commands
384384
* have to be calculated with the password and therandom number (see Section 9.5.3.2 "SET PASSWORD")
385385
*/
386386
ISO15693ErrorCode PN5180ISO15693::getRandomNumber(uint8_t *randomData) {
@@ -395,8 +395,8 @@ ISO15693ErrorCode PN5180ISO15693::getRandomNumber(uint8_t *randomData) {
395395
}
396396

397397
/*
398-
* The SET PASSWORD command enables the different passwords to be transmitted to the label
399-
* to access the different protected functionalities of the following commands.
398+
* The SET PASSWORD command enables the different passwords to be transmitted to the label
399+
* to access the different protected functionalities of the following commands.
400400
* The SET PASSWORD command has to be executed just once for the related passwords if the label is powered
401401
*/
402402
ISO15693ErrorCode PN5180ISO15693::setPassword(uint8_t *password, uint8_t *random) {
@@ -430,10 +430,10 @@ ISO15693ErrorCode PN5180ISO15693::unlockICODESLIX2(uint8_t *password) {
430430
if (rc != ISO15693_EC_OK) {
431431
return rc;
432432
}
433-
433+
434434
// set password to unlock the tag
435435
rc = setPassword(password, random);
436-
return rc;
436+
return rc;
437437
}
438438

439439
// lock a ICODE SLIX2 tag with given password (set to privacy mode)
@@ -444,10 +444,10 @@ ISO15693ErrorCode PN5180ISO15693::lockICODESLIX2(uint8_t *password) {
444444
if (rc != ISO15693_EC_OK) {
445445
return rc;
446446
}
447-
447+
448448
// enable privacy command to lock the tag
449449
rc = enablePrivacy(password, random);
450-
return rc;
450+
return rc;
451451
}
452452

453453

@@ -518,15 +518,15 @@ ISO15693ErrorCode PN5180ISO15693::issueISO15693Command(uint8_t *cmd, uint8_t cmd
518518
if (0 == (getIRQStatus() & RX_SOF_DET_IRQ_STAT)) {
519519
return EC_NO_CARD;
520520
}
521-
521+
522522
uint32_t rxStatus;
523523
readRegister(RX_STATUS, &rxStatus);
524-
524+
525525
PN5180DEBUG(F("RX-Status="));
526526
PN5180DEBUG(formatHex(rxStatus));
527527

528528
uint16_t len = (uint16_t)(rxStatus & 0x000001ff);
529-
529+
530530
PN5180DEBUG(", len=");
531531
PN5180DEBUG(len);
532532
PN5180DEBUG("\n");
@@ -536,7 +536,7 @@ ISO15693ErrorCode PN5180ISO15693::issueISO15693Command(uint8_t *cmd, uint8_t cmd
536536
PN5180DEBUG(F("*** ERROR in readData!\n"));
537537
return ISO15693_EC_UNKNOWN_ERROR;
538538
}
539-
539+
540540
#ifdef DEBUG
541541
Serial.print("Read=");
542542
for (int i=0; i<len; i++) {
@@ -555,7 +555,7 @@ ISO15693ErrorCode PN5180ISO15693::issueISO15693Command(uint8_t *cmd, uint8_t cmd
555555
uint8_t responseFlags = (*resultPtr)[0];
556556
if (responseFlags & (1<<0)) { // error flag
557557
uint8_t errorCode = (*resultPtr)[1];
558-
558+
559559
PN5180DEBUG("ERROR code=");
560560
PN5180DEBUG(formatHex(errorCode));
561561
PN5180DEBUG(" - ");
@@ -601,7 +601,7 @@ const __FlashStringHelper *PN5180ISO15693::strerror(ISO15693ErrorCode errno) {
601601
PN5180DEBUG(F("ISO15693ErrorCode="));
602602
PN5180DEBUG(errno);
603603
PN5180DEBUG("\n");
604-
604+
605605
switch (errno) {
606606
case EC_NO_CARD: return F("No card detected!");
607607
case ISO15693_EC_OK: return F("OK!");

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ Arduino Uno / Arduino ESP-32 library for PN5180-NFC Module from NXP Semiconducto
77

88
Release Notes:
99

10+
Version 1.5 - 29.01.2020
11+
12+
* Fixed offset in readSingleBlock. Was off by 1.
13+
1014
Version 1.4 - 13.11.2019
1115

1216
* ICODE SLIX2 specific commands, see https://www.nxp.com/docs/en/data-sheet/SL2S2602.pdf

library.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "PN5180-Library",
3+
"frameworks": "Arduino",
4+
"keywords": "NXP NFC PN5180",
5+
"description": "NXP NFC PN5180 Library for Arduino",
6+
"authors":
7+
[
8+
{
9+
"name": "Andreas Trappmann",
10+
"email": "[email protected]",
11+
"url": "https://github.com/ATrappmann/PN5180-Library",
12+
"maintainer": true
13+
}
14+
],
15+
"repository":
16+
{
17+
"type": "git",
18+
"url": "https://github.com/ATrappmann/PN5180-Library"
19+
}
20+
}

library.properties

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name=PN5180 Library
2-
version=1.1.0
2+
version=1.5
33
author=Andreas Trappmann
44
maintainer=Andreas Trappmann <[email protected]>
5-
sentence=NXP NFC PN5180 Library
5+
sentence=NXP NFC PN5180 Library for Arduino
66
paragraph=NXP NFC PN5180 Library
77
category=Sensors
88
url=https://github.com/ATrappmann/PN5180-Library
9-
architectures=*
9+
architectures=*

0 commit comments

Comments
 (0)