Files
edgetx-gx12/radio/src/dump.cpp
T
bertrand 2b312fdbb4 Fixes #2595 - Cli added
Based on projectkk2glider work, with a lot of bugs I am sure. Still not
tested, this is why I preferred working on my own branch. I push it now
so that Jenkins do the first tests and you can review if I am on the
right track. 

I am really wondering if a merge with the Lua api would be possible /
nice, what do you think?
2015-08-10 22:52:26 +02:00

39 lines
660 B
C++

#include "opentx.h"
#if defined(SIMU)
#define dumpPrintf(...) debugPrintf(__VA_ARGS__)
#else
#define dumpPrintf(...) serialPrintf(__VA_ARGS__)
#endif
uint8_t dumpPosition;
void dumpStart(unsigned int size)
{
dumpPrintf("DUMP %d bytes ...\n\r", size);
dumpPosition = 0;
}
void dumpBody(const uint8_t *data, unsigned int size)
{
for (unsigned int i=0; i<size; i++) {
dumpPrintf("%.2X ", data[i]);
dumpPosition++;
if ((dumpPosition & (32-1)) == 0) {
dumpPrintf("\r\n");
}
}
}
void dumpEnd()
{
dumpPrintf("\r\n");
}
void dump(const uint8_t *data, unsigned int size)
{
dumpStart(size);
dumpBody(data, size);
dumpEnd();
}