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?
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
#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();
|
||||
}
|
||||
Reference in New Issue
Block a user