diff --git a/src/Module.cpp b/src/Module.cpp index 2a6e35cd..eb20ff7b 100644 --- a/src/Module.cpp +++ b/src/Module.cpp @@ -465,6 +465,19 @@ void Module::hexdump(uint8_t* data, size_t len) { } } +void Module::regdump(uint8_t start, uint8_t len) { + #if defined(RADIOLIB_STATIC_ONLY) + uint8_t buff[RADIOLIB_STATIC_ARRAY_SIZE]; + #else + uint8_t* buff = new uint8_t[len]; + #endif + SPIreadRegisterBurst(start, len, buff); + hexdump(buff, len); + #if !defined(RADIOLIB_STATIC_ONLY) + delete[] buff; + #endif +} + void Module::setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn) { _useRfSwitch = true; _rxEn = rxEn; diff --git a/src/Module.h b/src/Module.h index 7b93d154..93ddf159 100644 --- a/src/Module.h +++ b/src/Module.h @@ -382,10 +382,19 @@ class Module { \param data Data to dump. - \param data Number of bytes to dump. + \param len Number of bytes to dump. */ static void hexdump(uint8_t* data, size_t len); + /*! + \brief Function to dump device registers as hex into the debug port. + + \param start First address to dump. + + \param len Number of bytes to dump. + */ + void regdump(uint8_t start, uint8_t len); + // hardware abstraction layer callbacks RADIOLIB_GENERATE_CALLBACK(RADIOLIB_CB_ARGS_PIN_MODE); RADIOLIB_GENERATE_CALLBACK(RADIOLIB_CB_ARGS_DIGITAL_WRITE);