Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SX1276GenericLib USBDevice
Fork of PICO_LP1 by
utils.cpp
- Committer:
- walterluu
- Date:
- 2020-10-12
- Revision:
- 3:85fc843a9d7d
File content as of revision 3:85fc843a9d7d:
void dump(const char *title, const void *data, int len, bool dwords)
{
// dprintf("dump(\"%s\", 0x%x, %d bytes)", title, data, len);
// pc.printf("dump(\"%s\", 0x%x, %d bytes)", title, data, len);
int i, j, cnt;
unsigned char *u;
const int width = 16;
const int seppos = 7;
cnt = 0;
u = (unsigned char *)data;
while (len > 0) {
// rprintf("%08x: ", (unsigned int)data + cnt);
// pc.printf("%08x: ", (unsigned int)data + cnt); //comment out
if (dwords) {
unsigned int *ip = ( unsigned int *)u;
// rprintf(" 0x%08x\r\n", *ip);
// pc.printf(" 0x%08x\r\n", *ip); //comment out
u+= 4;
len -= 4;
cnt += 4;
continue;
}
cnt += width;
j = len < width ? len : width;
for (i = 0; i < j; i++) {
// rprintf("%2.2x ", *(u + i));
// pc.printf("%2.2x ", *(u + i)); //comment out
// if (i == seppos)
// rprintf(" ");
// pc.printf(" "); //comment out
}
// rprintf(" ");
// pc.printf(" "); //comment out
if (j < width) {
i = width - j;
// if (i > seppos + 1)
// rprintf(" ");
// pc.printf(" "); //comment out
while (i--) {
// rprintf("%s", " ");
// pc.printf("%s", " "); //comment out
}
}
for (i = 0; i < j; i++) {
int c = *(u + i);
// if (c >= ' ' && c <= '~')
// rprintf("%c", c);
// pc.printf("%c", c); //comment out
// else
// rprintf(".");
// pc.printf("."); //comment out
// if (i == seppos)
// rprintf(" ");
// pc.printf(" "); //comment out
}
len -= width;
u += width;
// rprintf("\r\n");
// pc.printf("\r\n"); //comment out
}
// rprintf("--\r\n");
// pc.printf("--\r\n"); //comment out
}
