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

Merge upstream changes #4

Open
wants to merge 90 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
1fae7b0
make ISO14443 working
Dec 3, 2019
a0bd531
multi protocol demo
Dec 5, 2019
f78b4b4
Merge pull request #1 from tueddy/iso14443
tueddy Dec 6, 2019
7d7f9fe
print free heap
Dec 9, 2019
ae506be
Merge branch 'ISO14443' of https://github.com/tueddy/PN5180-Library i…
Dec 9, 2019
5ed5923
print free heap for ESP32
Dec 9, 2019
91fff23
diff between single size and double size uid (4/7 bytes)
Dec 9, 2019
9b7bfd6
new command: switch the mode to LPCD (low power card detection)
Dec 13, 2019
6493b9d
update README.md
Dec 13, 2019
2a211ef
bugfix: command buffer was two bytes too long
Dec 18, 2019
dd7b52b
rename helper functions lockICODESLIX2, unlockICODESLIX2 to enablePri…
Dec 18, 2019
977e106
sanity checks for card activation
Dec 18, 2019
ac7fb7c
set a random password
Dec 19, 2019
e5ffcde
add low power card detection (LPCD) example
Jan 5, 2020
7879748
check 0x88 (CT) for 7bit UID
Jan 17, 2020
2e3289f
Merge pull request #2 from tueddy/ISO14443
tueddy Dec 7, 2020
ff8c884
new demo for waking up the ESP-32 from deep-sleep with LPCD
Jan 16, 2021
2c254a1
fix warnings
Jan 31, 2021
0c200f5
update README
Jan 31, 2021
21ad124
https://github.com/ATrappmann/PN5180-Library/issues/38
Feb 15, 2021
0205891
allow to setup with other SPIClass than default SPI
Mar 27, 2021
b8408b8
Version 1.8 - 05.04.2021
Apr 5, 2021
3a16055
LPCD demo for ESP32: don't use static bitmask, simplify pin assignment
Jul 27, 2021
0353104
fix warning: array subscript is above array bounds
Aug 26, 2021
d72c22f
Version 1.9 - 05.10.2021
Oct 5, 2021
2d9ae3d
wait for RF field to set up (with timeout, max waiting time is 500ms)
Oct 6, 2021
b6bc33a
Load standard TypeA protocol already done in reset(), disable
Nov 23, 2021
0013f30
better handling of TypeA activation
Dec 10, 2021
5cc0b2c
TypeA: Add some delay() to:
Dec 28, 2021
f99e615
check for CT-flag (0x88) -> invalid response
Jan 1, 2022
ae0a4ff
more sanity checks for invalid UID's
Jan 24, 2022
8ca2d3e
Add support for non-default SPI class
mwick83 May 8, 2021
18ea244
Merge pull request #3 from mwick83/spiclass-support
tueddy Oct 17, 2022
d906c30
Update README.md
tueddy Oct 17, 2022
01b3e48
optimize SPI transfer
Oct 18, 2022
ae880b9
Add latest spec
Dec 24, 2022
2c7df75
issueISO15693Command: check timeout in while loop
Feb 5, 2023
0992751
fix missing bracket
Feb 5, 2023
de84909
functions for reading/writing the register/EEProm: return false if tr…
Feb 10, 2023
c203368
Fix examples/PN5180-ReadUID/PN5180-ReadUID.ino
Feb 11, 2023
f776e66
fix warning: comparison is always false due to limited range of data …
Mar 27, 2023
4812410
added readMultipleBlock, fixed bugs
Mar 30, 2023
8853a1e
Implementing getInventory for 16 time slots
Mar 30, 2023
a12d4f7
readInventoryMultiple implemented
Mar 31, 2023
0d597b0
Merge pull request #1 from laplacier/development
laplacier Mar 31, 2023
90846e5
Missed some commits
Mar 31, 2023
858eff1
Merge branch 'master' into development
laplacier Mar 31, 2023
75c7843
Merge pull request #2 from laplacier/development
laplacier Mar 31, 2023
cb0f002
Merge pull request #5 from laplacier/master
tueddy Apr 1, 2023
c9a41f9
Version 2.1 - 01.04.2023 - update README.md
Apr 1, 2023
ef6e7cf
Fixed some warnings (c++17)
Apr 2, 2023
3b42d52
replace FlashStringHelper with char (make compile with Arduino 2.0.8)
tueddy Apr 20, 2023
d218630
Remove F("") to compile with Arduino 2.0.8
tueddy Apr 21, 2023
4a1f139
remove ESP_LOGD() and use PN5180DEBUG() instead
tueddy May 21, 2023
89b00cb
Add code to allow authentication with Mifare Classic cards
golyalpha Dec 16, 2023
5de64d4
Fix Git URL in library.properties
golyalpha Dec 16, 2023
585202b
Fix indentation
golyalpha Dec 16, 2023
bf0fe93
More format fixes
golyalpha Dec 16, 2023
81761d9
Merge pull request #6 from golyalpha/master
tueddy Dec 16, 2023
9fcf24f
delete old docs
tueddy Jan 12, 2024
ec3ef64
Unify and simplify command creation
tueddy Jan 12, 2024
ec79d9a
Simplify response buffer initialisation
tueddy Jan 12, 2024
0cbdf65
return directly if there is no code in between
tueddy Jan 12, 2024
2128fd7
smaller memory footprint if reading UID only (save ~500 Bytes)
tueddy Jan 13, 2024
d5f623f
refactor SPI transaction into transceiveCommand()
tueddy Jan 13, 2024
6838d0b
Version 2.2
tueddy Jan 13, 2024
a14bafe
cppcheck
tueddy May 29, 2024
e7f0e8f
transceiveCommand: restore state of SS in case of anerror
tueddy May 29, 2024
47caf16
replace errno, which is often a macro
egnor Jun 3, 2024
7ba0289
Merge pull request #7 from egnor/master
tueddy Jun 3, 2024
3b7730a
Update README.md
tueddy Oct 1, 2024
ba7b81a
Create .gitattributes
mjmeans Oct 19, 2024
9779a0c
Revert "Create .gitattributes"
mjmeans Oct 25, 2024
5de5b8b
Fix buffer pointer alignment
mjmeans Oct 19, 2024
c44aadd
Revert "Fix buffer pointer alignment"
mjmeans Oct 25, 2024
1685804
Add ability to optionally specify custom pins or use -1 for defaults
mjmeans Oct 21, 2024
9b14dfe
Merge pull request #10 from mjmeans/Add-gitattributes
tueddy Oct 27, 2024
f7e04cb
Merge pull request #12 from mjmeans/use-custom-SPI-pins
tueddy Oct 27, 2024
56e02a8
Version 2.3.2
tueddy Oct 27, 2024
b22583f
Bugfix start with default SPI
tueddy Oct 27, 2024
d1128a0
Re-add .gitattributes that was mistakenly removed
mjmeans Oct 28, 2024
eaf73b3
Better DEBUG macros
mjmeans Oct 28, 2024
b4afb5c
turn off debug
mjmeans Oct 28, 2024
96cbd1f
Add PN5180DEBUG_ON and PN5180DEBUG_OFF
mjmeans Oct 29, 2024
10ed0a6
Merge pull request #13 from mjmeans/better-debug
tueddy Oct 31, 2024
805bf70
Fix warning "will be initialized after [-Wreorder]"
tueddy Oct 31, 2024
ebfc065
suppress [-Wunused-variable]
tueddy Oct 31, 2024
e070216
V2.3.5
tueddy Oct 31, 2024
09788e3
v2.3.4
tueddy Oct 31, 2024
d54712e
suppress another [-Wunused-variable]
tueddy Oct 31, 2024
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
5 changes: 5 additions & 0 deletions Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
#include <inttypes.h>
#include "Debug.h"

uint8_t _pn5180_debugIndent;
uint8_t _pn5180_debugIndentN;
bool _pn5180_debugNL = true;
uint8_t _pn5180_debugSilent;

#ifdef DEBUG

static const char hexChar[] = "0123456789ABCDEF";
Expand Down
81 changes: 80 additions & 1 deletion Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,87 @@
#define DEBUG_H

#ifdef DEBUG
#define PN5180DEBUG(msg) Serial.print(msg)
extern uint8_t _pn5180_debugIndent;
extern uint8_t _pn5180_debugIndentN;
extern bool _pn5180_debugNL;
extern uint8_t _pn5180_debugSilent;

// These macros are helper macros to make the see the debug macros like function calls so they do not alter any current code block structures when the macro contains if/else/break, etc.
#define __DEBUG_BEGIN__ do{if(DEBUG){
#define __DEBUG_END__ }}while(0)

// DEBUG print with indention macros:
//
// USAGE:
// 1. At the top of any function use PN5180DEBUG_PRINTLN(...) or PN5180DEBUG_PRINTF(...)or PN5180DEBUG_PRINT(...) to output that you've entered the function.
// 2. If you didn't use PN5180DEBUG_PRINTLN, then follow it with PN5180DEBUG_PRINTLN() without parameters.
// 3. Use PN5180DEBUG_ENTER, which will increment the indent level.
// 4. Before every return call in the method, use PN5180DEBUG_EXIT to decrement the indent level.
// 5. Use PN5180DEBUG_OFF and PN5180DEBUG_ON to block debug output for a call tree.
// You can see this used in the PN5180::setRF_on() which blcks the thousands repeated debug messages to readRegister() and tranceiveCommand() functions while allowing those functions to continue to issue debug messages when called from other functions.
//
// NOTES:
// 1. Always make sure you end any secuence of _PRINT* macros with a _PRINTNL. See example below for putputting the register value.
// 2. If you directly use PN5180DEBUG_INDENT, it will break the indention macros.
// 3. NOTE: The older PN5180DEBUG macro is kept for backward compatibility.
// 4. Code that uses Serial.print() function calls outside these macros will not have a prepended "| " at the beginning of each line, which helps you identify the code being debugged from other code.
//
// EXAMPLE: (from PN5180.cpp)
// bool PN5180::readRegister(uint8_t reg, uint32_t *value) {
// PN5180DEBUG_PRINTF(F("PN5180::readRegister(reg=0x%s, *value=%d"), formatHex(reg), (uint8_t*)value);
// PN5180DEBUG_PRINTLN();
// PN5180DEBUG_ENTER;
//
// uint8_t cmd[] = { PN5180_READ_REGISTER, reg };
//
// transceiveCommand(cmd, sizeof(cmd), (uint8_t*)value, 4);
//
// PN5180DEBUG(F("Register value=0x"));
// PN5180DEBUG(formatHex(*value));
// PN5180DEBUG_PRINTLN();
//
// PN5180DEBUG_EXIT;
// return true;
// }
//
// SAMPLE OUTPUT using PN5180 library
// ==================================
// Uploaded: Oct 28 2024 04:22:04
// PN5180 ISO14443 Demo Sketch
// | PN5180::begin(sck=19, miso=20, mosi=18, ss=-1)
// | Custom SPI pinout: SS=21, MOSI=18, MISO=20, SCK=19
// ----------------------------------
// PN5180 Hard-Reset...
// | PN5180::reset()
// | PN5180::getIRQStatus()
// | Read IRQ-Status register...
// | PN5180::readRegister(reg=0x02, *value=1082650700
// | PN5180::transceiveCommand(*sendBuffer, sendBufferLen=2, *recvBuffer, recvBufferLen=4)
// | Sending SPI frame: '04 02'
// | Receiving SPI frame...
// | Received: '04 00 00 00'
// | Register value=0x00000004
// | IRQ-Status=0x00000004
// ----------------------------------

#define PN5180DEBUG_OFF __DEBUG_BEGIN__ ++_pn5180_debugSilent; __DEBUG_END__
#define PN5180DEBUG_ON __DEBUG_BEGIN__ _pn5180_debugSilent-=((_pn5180_debugSilent>0)?1:0); __DEBUG_END__
#define PN5180DEBUG_ENTER __DEBUG_BEGIN__ ++_pn5180_debugIndent; __DEBUG_END__
#define PN5180DEBUG_EXIT __DEBUG_BEGIN__ _pn5180_debugIndent-=((_pn5180_debugIndent>0)?1:0); __DEBUG_END__
#define PN5180DEBUG_INDENT __DEBUG_BEGIN__ Serial.print("| "); for (int _pn5180_debugIndentN=0; _pn5180_debugIndentN<_pn5180_debugIndent; _pn5180_debugIndentN++) Serial.print(" "); _pn5180_debugNL=false; __DEBUG_END__
#define PN5180DEBUG_PRINTLN(...) __DEBUG_BEGIN__ if (!_pn5180_debugSilent) { if (_pn5180_debugNL) PN5180DEBUG_INDENT; Serial.println(__VA_ARGS__); _pn5180_debugNL=true; }; __DEBUG_END__
#define PN5180DEBUG_PRINTF(...) __DEBUG_BEGIN__ if (!_pn5180_debugSilent) { if (_pn5180_debugNL) PN5180DEBUG_INDENT; Serial.printf(__VA_ARGS__); }; __DEBUG_END__
#define PN5180DEBUG_PRINT(...) __DEBUG_BEGIN__ if (!_pn5180_debugSilent) { if (_pn5180_debugNL) PN5180DEBUG_INDENT; Serial.print(__VA_ARGS__); }; __DEBUG_END__
#define PN5180DEBUG(msg) PN5180DEBUG_PRINT(msg)
#else
#define PN5180DEBUG_OFF
#define PN5180DEBUG_ON
#define PN5180DEBUG_ENTER
#define PN5180DEBUG_EXIT
#define PN5180DEBUG_INDENT
#define PN5180DEBUG_PRINTLN(...)
#define PN5180DEBUG_PRINTF(...)
#define PN5180DEBUG_PRINT(...)
#define PN5180DEBUG(msg)
#endif

Expand Down
Loading