Prusa MINI Firmware overview
HexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE > Class Template Reference

#include <hexdump.h>

Inheritance diagram for HexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE >:
Collaboration diagram for HexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE >:

Public Member Functions

 HexDumper ()
 
void Initialize ()
 
void Parse (const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset)
 

Constructor & Destructor Documentation

◆ HexDumper()

template<class BASE_CLASS , class LEN_TYPE , class OFFSET_TYPE >
HexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE >::HexDumper ( )
40  : byteCount(0), byteTotal(0) {
41  };

Member Function Documentation

◆ Initialize()

template<class BASE_CLASS , class LEN_TYPE , class OFFSET_TYPE >
void HexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE >::Initialize ( )
43  {
44  byteCount = 0;
45  byteTotal = 0;
46  };

◆ Parse()

template<class BASE_CLASS , class LEN_TYPE , class OFFSET_TYPE >
void HexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE >::Parse ( const LEN_TYPE  len,
const uint8_t pbuf,
const OFFSET_TYPE &  offset 
)
52  {
53  if (UsbDEBUGlvl >= 0x80) { // Fully bypass this block of code if we do not debug.
54  for (LEN_TYPE j = 0; j < len; j++, byteCount++, byteTotal++) {
55  if (!byteCount) {
56  PrintHex<OFFSET_TYPE > (byteTotal, 0x80);
57  E_Notify(PSTR(": "), 0x80);
58  }
59  PrintHex<uint8_t > (pbuf[j], 0x80);
60  E_Notify(PSTR(" "), 0x80);
61 
62  if (byteCount == 15) {
63  E_Notify(PSTR("\r\n"), 0x80);
64  byteCount = 0xFF;
65  }
66  }
67  }
68 }
Here is the call graph for this function:
pbuf::len
u16_t len
Definition: pbuf.h:159
UsbDEBUGlvl
int UsbDEBUGlvl
PSTR
#define PSTR(str)
Definition: pgmspace.h:31
pbuf
Definition: pbuf.h:142
E_Notify
void E_Notify(char const *msg, int lvl)