mirror of
https://github.com/polhenarejos/pico-hsm.git
synced 2026-05-07 12:43:06 +00:00
Improving readability of debug payload
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
fd93f4779e
commit
bc7990b89a
1 changed files with 9 additions and 9 deletions
18
hsm2040.h
18
hsm2040.h
|
|
@ -14,19 +14,19 @@
|
|||
extern const uint8_t historical_bytes[];
|
||||
|
||||
#define DEBUG_PAYLOAD(p,s) { \
|
||||
TU_LOG3("Payload %s (%d bytes):\r\n", #p,s);\
|
||||
TU_LOG2("Payload %s (%d bytes):\r\n", #p,s);\
|
||||
for (int i = 0; i < s; i += 16) {\
|
||||
for (int j = 0; j < 16; j++) {\
|
||||
if (j < s-i) TU_LOG3("%02X ",p[i+j]);\
|
||||
else TU_LOG3(" ");\
|
||||
if (j == 7) TU_LOG3(" ");\
|
||||
} TU_LOG3(": "); \
|
||||
if (j < s-i) TU_LOG2("%02X ",p[i+j]);\
|
||||
else TU_LOG2(" ");\
|
||||
if (j == 7) TU_LOG2(" ");\
|
||||
} TU_LOG2(": "); \
|
||||
for (int j = 0; j < MIN(16,s-i); j++) {\
|
||||
TU_LOG3("%c",p[i+j]);\
|
||||
if (j == 7) TU_LOG3(" ");\
|
||||
TU_LOG2("%c",p[i+j] == 0x0a || p[i+j] == 0x0d ? '\\' : p[i+j]);\
|
||||
if (j == 7) TU_LOG2(" ");\
|
||||
}\
|
||||
TU_LOG3("\r\n");\
|
||||
} TU_LOG3("\r\n"); \
|
||||
TU_LOG2("\r\n");\
|
||||
} TU_LOG2("\r\n"); \
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue