Skip to content

Commit 04ab25a

Browse files
committed
added an additional debug level: if enabled, print the actual data too
1 parent 204ccfa commit 04ab25a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Adafruit_SPIDevice.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
(defined(SPI_INTERFACES_COUNT) && (SPI_INTERFACES_COUNT > 0))
99

1010
// #define DEBUG_SERIAL Serial
11+
// #define DEBUG_VERBOSE
1112

1213
#ifdef DEBUG_SERIAL
1314
template <typename T>
@@ -16,6 +17,7 @@ static void printChunk(const char *title, const T &buffer, const uint8_t size) {
1617
DEBUG_SERIAL.print(title);
1718
DEBUG_SERIAL.print(F(" Chunk, size "));
1819
DEBUG_SERIAL.println(size);
20+
#ifdef DEBUG_VERBOSE
1921
DEBUG_SERIAL.print(F("\t"));
2022

2123
for (uint8_t i = 0; i < size; ++i) {
@@ -24,12 +26,14 @@ static void printChunk(const char *title, const T &buffer, const uint8_t size) {
2426
DEBUG_SERIAL.print(F(", "));
2527
}
2628
DEBUG_SERIAL.println();
29+
#endif
2730
}
2831

2932
static void printBuffer(const char *title, const uint8_t *buffer,
3033
const size_t len) {
3134
DEBUG_SERIAL.print(F("\t"));
3235
DEBUG_SERIAL.println(title);
36+
#ifdef DEBUG_VERBOSE
3337
for (size_t i = 0; i < len; i++) {
3438
DEBUG_SERIAL.print(F("0x"));
3539
DEBUG_SERIAL.print(buffer[i], HEX);
@@ -39,6 +43,7 @@ static void printBuffer(const char *title, const uint8_t *buffer,
3943
}
4044
}
4145
DEBUG_SERIAL.println();
46+
#endif
4247
}
4348
#endif
4449

0 commit comments

Comments
 (0)