1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-23 08:15:26 +03:00

Add DEBUG_TRACE_BUFFER_HEX[_SYNC] macros

They implement support for printing an arbitrarily sized buffer
in hexadecimal via DEBUG_TRACE.
This commit is contained in:
Alberto García Hierro 2018-02-13 12:27:53 +00:00
parent 2f5575c351
commit bcfc8e7189
2 changed files with 66 additions and 14 deletions

View file

@ -15,6 +15,8 @@
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stddef.h>
#define DEBUG16_VALUE_COUNT 4
extern int16_t debug[DEBUG16_VALUE_COUNT];
extern uint8_t debugMode;
@ -61,9 +63,14 @@ typedef enum {
#if defined(USE_DEBUG_TRACE)
void debugTraceInit(void);
void debugTracePrintf(bool synchronous, const char *format, ...);
#define DEBUG_TRACE(fmt, ...) debugTracePrintf(false, fmt, ##__VA_ARGS__)
#define DEBUG_TRACE_SYNC(fmt, ...) debugTracePrintf(true, fmt, ##__VA_ARGS__)
void debugTracePrintBufferHex(bool synchronous, const void *buffer, size_t size);
#define DEBUG_TRACE(fmt, ...) debugTracePrintf(false, fmt, ##__VA_ARGS__)
#define DEBUG_TRACE_SYNC(fmt, ...) debugTracePrintf(true, fmt, ##__VA_ARGS__)
#define DEBUG_TRACE_BUFFER_HEX(buf, size) debugTracePrintBufferHex(false, buf, size)
#define DEBUG_TRACE_BUFFER_HEX_SYNC(buf, size) debugTracePrintBufferHex(true, buf, size)
#else
#define DEBUG_TRACE(fmt, ...)
#define DEBUG_TRACE_SYNC(fmt, ...)
#define DEBUG_TRACE_BUFFER_HEX(buf, size)
#define DEBUG_TRACE_BUFFER_HEX_SYNC(buf, size)
#endif