Skip to content

Commit 66e17ce

Browse files
committed
added an additional debug level: if enabled, print the actual data too
1 parent 28ff05d commit 66e17ce

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
@@ -4,6 +4,7 @@
44
(defined(SPI_INTERFACES_COUNT) && (SPI_INTERFACES_COUNT > 0))
55

66
// #define DEBUG_SERIAL Serial
7+
// #define DEBUG_VERBOSE
78

89
#ifdef DEBUG_SERIAL
910
template <typename T>
@@ -12,6 +13,7 @@ static void printChunk(const char *title, const T &buffer, const uint8_t size) {
1213
DEBUG_SERIAL.print(title);
1314
DEBUG_SERIAL.print(F(" Chunk, size "));
1415
DEBUG_SERIAL.println(size);
16+
#ifdef DEBUG_VERBOSE
1517
DEBUG_SERIAL.print(F("\t"));
1618

1719
for (uint8_t i = 0; i < size; ++i) {
@@ -20,12 +22,14 @@ static void printChunk(const char *title, const T &buffer, const uint8_t size) {
2022
DEBUG_SERIAL.print(F(", "));
2123
}
2224
DEBUG_SERIAL.println();
25+
#endif
2326
}
2427

2528
static void printBuffer(const char *title, const uint8_t *buffer,
2629
const size_t len) {
2730
DEBUG_SERIAL.print(F("\t"));
2831
DEBUG_SERIAL.println(title);
32+
#ifdef DEBUG_VERBOSE
2933
for (size_t i = 0; i < len; i++) {
3034
DEBUG_SERIAL.print(F("0x"));
3135
DEBUG_SERIAL.print(buffer[i], HEX);
@@ -35,6 +39,7 @@ static void printBuffer(const char *title, const uint8_t *buffer,
3539
}
3640
}
3741
DEBUG_SERIAL.println();
42+
#endif
3843
}
3944
#endif
4045

0 commit comments

Comments
 (0)