Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2bef556
Add ability to specify disableCollisionAvoidance and activeCommunicat…
mjmeans Oct 29, 2024
b5e604e
Add missing IRQ_STATUS register defines
mjmeans Oct 29, 2024
93bf527
Revert "Add ability to specify disableCollisionAvoidance and activeCo…
mjmeans Nov 9, 2024
cf0703d
Update Debug.cpp
mjmeans Nov 9, 2024
c91f0b5
Add missing register defines
mjmeans Nov 9, 2024
8221128
Add missing Host Interface Command defines
mjmeans Nov 9, 2024
43bdde7
Bugfix: Collision resolution needs to adjust by 4 bits, not 2
mjmeans Nov 14, 2024
22fca71
Update Debug.h
mjmeans Nov 17, 2024
644bc81
Add #defines for ISO18593-3
mjmeans Nov 17, 2024
4c56401
Fix typo
mjmeans Nov 17, 2024
0a620a5
Debug tracing for getInventory()
mjmeans Nov 17, 2024
1744010
This call too
mjmeans Nov 17, 2024
b88aea2
Show error results of calls without full debug
mjmeans Nov 17, 2024
27fb8f3
Add more error debug messages
mjmeans Nov 17, 2024
3113ec1
Add direct commands for SendData, RfOn and RfOff
mjmeans Nov 17, 2024
75ad48c
Debug errors using PN5180ERROR instead
mjmeans Nov 17, 2024
b8c5ee5
Report error returns on most other library calls
mjmeans Nov 17, 2024
7b83305
More comment detail for getInventory*
mjmeans Nov 17, 2024
b09a07d
A few more PN5180ERRORs
mjmeans Nov 17, 2024
65769a6
More PN5180ERROR detail
mjmeans Nov 17, 2024
9c9d531
#define for rf on and off timeouts
mjmeans Nov 17, 2024
0cf3023
More debugging changes
mjmeans Nov 17, 2024
96dbd4f
Remove unneeded declare
mjmeans Nov 17, 2024
c3d34b1
fix typos and debug text
mjmeans Nov 17, 2024
3a23feb
restore accidentally deleted line
mjmeans Nov 17, 2024
8f18ace
typo
mjmeans Nov 17, 2024
aab3eaf
Watcch for readRegiser return failure checks in wait loops
mjmeans Nov 17, 2024
c31ba61
fix typos
mjmeans Nov 17, 2024
63a2416
add comments and remove unneeded code
mjmeans Nov 17, 2024
a606160
tidy up the code a bit
mjmeans Nov 17, 2024
95aa721
Comment out the DEBUG flags
mjmeans Nov 17, 2024
8f541a4
Fix references when not using any DEBUG defines
mjmeans Nov 21, 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
2 changes: 2 additions & 0 deletions Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
//#define DEBUG 1

#include <inttypes.h>
#include "Debug.h"

Expand Down
46 changes: 31 additions & 15 deletions Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@
#ifndef DEBUG_H
#define DEBUG_H

#ifdef DEBUG
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:
Expand Down Expand Up @@ -83,6 +73,17 @@ extern uint8_t _pn5180_debugSilent;
// | IRQ-Status=0x00000004
// ----------------------------------

#if defined(DEBUG) || defined(DEBUG_ERROR)
extern uint8_t _pn5180_debugIndent;
extern uint8_t _pn5180_debugIndentN;
extern bool _pn5180_debugNL;
extern uint8_t _pn5180_debugSilent;

#ifdef DEBUG
// These macros are helper macros to make c compiler treat 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)

#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__
Expand All @@ -92,7 +93,24 @@ extern uint8_t _pn5180_debugSilent;
#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
#endif /* DEBUG */

#ifdef DEBUG_ERROR
// These macros are helper macros to make c compiler treat 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 __ERROR_BEGIN__ do{if(DEBUG_ERROR){
#define __ERROR_END__ }}while(0)

#define PN5180ERROR(...) __ERROR_BEGIN__ if (!_pn5180_debugSilent) { if (!_pn5180_debugNL) Serial.print(F("\n"));; Serial.print(F("*** ERROR: ")); Serial.printf(__VA_ARGS__); Serial.print(F("\n"));}; __ERROR_END__
#endif /* DEBUG_ERROR */

extern char * formatHex(const uint8_t val);
extern char * formatHex(const uint16_t val);
extern char * formatHex(const uint32_t val);

#else /* defined(DEBUG) || defined(DEBUG_ERROR) */
#endif /* defined(DEBUG) || defined(DEBUG_ERROR) */

#ifndef DEBUG
#define PN5180DEBUG_OFF
#define PN5180DEBUG_ON
#define PN5180DEBUG_ENTER
Expand All @@ -104,10 +122,8 @@ extern uint8_t _pn5180_debugSilent;
#define PN5180DEBUG(msg)
#endif

#ifdef DEBUG
extern char * formatHex(const uint8_t val);
extern char * formatHex(const uint16_t val);
extern char * formatHex(const uint32_t val);
#ifndef DEBUG_ERROR
#define PN5180ERROR(...)
#endif

#endif /* DEBUG_H */
Loading