[MOD] Added helper hexdump function
This commit is contained in:
parent
e5e8947e94
commit
f8f73d2ccb
2 changed files with 29 additions and 0 deletions
|
@ -445,6 +445,26 @@ uint16_t Module::flipBits16(uint16_t i) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Module::hexdump(uint8_t* data, size_t len) {
|
||||||
|
for(int i = 0; i < len; i+=16) {
|
||||||
|
char str[80];
|
||||||
|
sprintf(str, "%07x ", i);
|
||||||
|
for(int j = 0; j < 16; j++) {
|
||||||
|
sprintf(&str[8 + j*3], "%02x ", data[i+j]);
|
||||||
|
}
|
||||||
|
str[56] = '|';
|
||||||
|
str[57] = ' ';
|
||||||
|
for(int j = 0; j < 16; j++) {
|
||||||
|
char c = data[i+j];
|
||||||
|
if((c < ' ') || (c > '~')) {
|
||||||
|
c = '.';
|
||||||
|
}
|
||||||
|
sprintf(&str[58 + j], "%c", c);
|
||||||
|
}
|
||||||
|
RADIOLIB_DEBUG_PRINTLN(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Module::setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn) {
|
void Module::setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn) {
|
||||||
_useRfSwitch = true;
|
_useRfSwitch = true;
|
||||||
_rxEn = rxEn;
|
_rxEn = rxEn;
|
||||||
|
|
|
@ -377,6 +377,15 @@ class Module {
|
||||||
*/
|
*/
|
||||||
static uint16_t flipBits16(uint16_t i);
|
static uint16_t flipBits16(uint16_t i);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Function to dump data as hex into the debug port.
|
||||||
|
|
||||||
|
\param data Data to dump.
|
||||||
|
|
||||||
|
\param data Number of bytes to dump.
|
||||||
|
*/
|
||||||
|
static void hexdump(uint8_t* data, size_t len);
|
||||||
|
|
||||||
// hardware abstraction layer callbacks
|
// hardware abstraction layer callbacks
|
||||||
RADIOLIB_GENERATE_CALLBACK(RADIOLIB_CB_ARGS_PIN_MODE);
|
RADIOLIB_GENERATE_CALLBACK(RADIOLIB_CB_ARGS_PIN_MODE);
|
||||||
RADIOLIB_GENERATE_CALLBACK(RADIOLIB_CB_ARGS_DIGITAL_WRITE);
|
RADIOLIB_GENERATE_CALLBACK(RADIOLIB_CB_ARGS_DIGITAL_WRITE);
|
||||||
|
|
Loading…
Add table
Reference in a new issue