26 #define DINIT(baudrate,msg)
36 #define DSERIAL Serial
40 inline void DPRINT(T str) { DSERIAL.print(str); }
42 inline void DPRINTLN(T str) { DPRINT(str); DPRINT(F(
"\r\n")); }
43 inline void DHEX(uint8_t b) {
44 if( b<0x10 ) DSERIAL.print(
'0');
47 inline void DHEX(uint16_t b) {
48 if( b<0x10 ) DSERIAL.print(F(
"000"));
49 else if( b<0x100 ) DSERIAL.print(F(
"00"));
50 else if( b<0x1000 ) DSERIAL.print(F(
"0"));
53 inline void DHEX(uint32_t b) {
54 if( b<0x10 ) DSERIAL.print(F(
"0000000"));
55 else if( b<0x100 ) DSERIAL.print(F(
"000000"));
56 else if( b<0x1000 ) DSERIAL.print(F(
"00000"));
57 else if( b<0x10000 ) DSERIAL.print(F(
"0000"));
58 else if( b<0x100000 ) DSERIAL.print(F(
"000"));
59 else if( b<0x1000000 ) DSERIAL.print(F(
"00"));
60 else if( b<0x10000000 ) DSERIAL.print(F(
"0"));
64 template<
typename TYPE>
65 inline void DDEC(TYPE b) {
69 #define DINIT(baudrate,msg) \
70 DSERIAL.begin(baudrate); \
73 #define DDEVINFO(dev) \
75 dev.getDeviceID(devid); \
76 DPRINT(F("ID: "));devid.dump(); \
78 dev.getDeviceSerial(serial); \
80 DPRINT(F(" Serial: "));DPRINTLN((char*)serial);
92 inline void DPRINT(T str) { std::cout << str << std::flush; }
94 inline void DPRINTLN(T str) { std::cout << str << std::endl; }
95 inline void DHEX(uint8_t b) { std::cout << std::setw(2) << std::setfill(
'0') << std::hex << (int)b; }
96 inline void DHEX(uint16_t b) { std::cout << std::setw(4) << std::setfill(
'0') << std::hex << (int)b; }
97 inline void DHEX(uint32_t b) { std::cout << std::setw(8) << std::setfill(
'0') << std::hex << (int)b; }
99 template<
typename TYPE>
100 inline void DDEC(TYPE b) { std::cout << std::dec << (int)b; }
104 inline void DHEX(
const uint8_t* b,uint8_t l) {
105 for(
int i=0; i<l; i++, b++) {
106 DHEX(*b); DPRINT(F(
" "));
109 inline void DHEXLN(uint8_t b) { DHEX(b); DPRINT(F(
"\r\n")); }
110 inline void DHEXLN(uint16_t b) { DHEX(b); DPRINT(F(
"\r\n")); }
111 inline void DHEXLN(uint32_t b) { DHEX(b); DPRINT(F(
"\r\n")); }
112 template<
typename TYPE>
113 inline void DDECLN(TYPE b) { DDEC(b); DPRINT(F(
"\r\n")); }
114 inline void DHEXLN(
const uint8_t* b,uint8_t l) { DHEX(b,l); DPRINT(F(
"\r\n")); }