Notify again

This commit is contained in:
Oleg Mazurov 2013-06-11 21:06:13 -06:00
parent 7d981b4361
commit 1c3b6b79eb
2 changed files with 11 additions and 11 deletions

View file

@ -48,13 +48,13 @@ void HexDumper<BASE_CLASS, LEN_TYPE, OFFSET_TYPE>::Parse(const LEN_TYPE len, con
for(LEN_TYPE j = 0; j < len; j++, byteCount++, byteTotal++) { for(LEN_TYPE j = 0; j < len; j++, byteCount++, byteTotal++) {
if(!byteCount) { if(!byteCount) {
PrintHex<OFFSET_TYPE > (byteTotal, 0x80); PrintHex<OFFSET_TYPE > (byteTotal, 0x80);
Notify(PSTR(": "), 0x80); E_Notify(PSTR(": "), 0x80);
} }
PrintHex<uint8_t > (pbuf[j], 0x80); PrintHex<uint8_t > (pbuf[j], 0x80);
Notify(PSTR(" "), 0x80); E_Notify(PSTR(" "), 0x80);
if(byteCount == 15) { if(byteCount == 15) {
Notify(PSTR("\r\n"), 0x80); E_Notify(PSTR("\r\n"), 0x80);
byteCount = 0xFF; byteCount = 0xFF;
} }
} }

View file

@ -27,7 +27,7 @@ void E_Notifyc(char c, int lvl);
template <class T> template <class T>
void PrintHex(T val, int lvl) { void PrintHex(T val, int lvl) {
#ifdef DEBUG //#ifdef DEBUG
int num_nibbles = sizeof(T) * 2; int num_nibbles = sizeof(T) * 2;
do { do {
@ -35,23 +35,23 @@ void PrintHex(T val, int lvl) {
if(v > 57) v += 7; if(v > 57) v += 7;
E_Notifyc(v, lvl); E_Notifyc(v, lvl);
} while(--num_nibbles); } while(--num_nibbles);
#endif //#endif
} }
template <class T> template <class T>
void PrintBin(T val, int lvl) { void PrintBin(T val, int lvl) {
#ifdef DEBUG //#ifdef DEBUG
for(T mask = (((T) 1) << ((sizeof(T) << 3) - 1)); mask; mask >>= 1) for(T mask = (((T) 1) << ((sizeof(T) << 3) - 1)); mask; mask >>= 1)
if(val & mask) if(val & mask)
E_Notifyc('1', lvl); E_Notifyc('1', lvl);
else else
E_Notifyc('0', lvl); E_Notifyc('0', lvl);
#endif //#endif
} }
template <class T> template <class T>
void SerialPrintHex(T val) { void SerialPrintHex(T val) {
#ifdef DEBUG //#ifdef DEBUG
int num_nibbles = sizeof(T) * 2; int num_nibbles = sizeof(T) * 2;
do { do {
@ -59,12 +59,12 @@ void SerialPrintHex(T val) {
if(v > 57) v += 7; if(v > 57) v += 7;
Serial.print(v); Serial.print(v);
} while(--num_nibbles); } while(--num_nibbles);
#endif //#endif
} }
template <class T> template <class T>
void PrintHex2(Print *prn, T val) { void PrintHex2(Print *prn, T val) {
#ifdef DEBUG //#ifdef DEBUG
T mask = (((T) 1) << (((sizeof(T) << 1) - 1) << 2)); T mask = (((T) 1) << (((sizeof(T) << 1) - 1) << 2));
while(mask > 1) { while(mask > 1) {
@ -74,7 +74,7 @@ void PrintHex2(Print *prn, T val) {
mask >>= 4; mask >>= 4;
} }
prn->print((T) val, HEX); prn->print((T) val, HEX);
#endif //#endif
} }
#endif // __PRINTHEX_H__ #endif // __PRINTHEX_H__