#ifndef pauls_ugly_debug_included_yadda_yadda__ #define pauls_ugly_debug_included_yadda_yadda__ //#define SPEW_ALL_THIS_CRAP_TO_THE_SERIAL_PORT #ifdef SPEW_ALL_THIS_CRAP_TO_THE_SERIAL_PORT #define BAUD_RATE 115200UL #include #define print(s) print_P(PSTR(s)) #define print_hex(s, n) print_P_hex(PSTR(s), (n)) #define print_hex16(s, n) print_P_hex16(PSTR(s), (n)) #define print_hex32(s, n) print_P_hex32(PSTR(s), (n)) static void cout(char c) __attribute__((unused)); static void cout(char c) { if (!(UCSR1B & (1<> 4); phex1(n & 15); } static void phex16(uint16_t n) __attribute__((unused)); static void phex16(uint16_t n) { phex(n >> 8); phex(n & 255); } static void phex32(uint32_t n) __attribute__((unused)); static void phex32(uint32_t n) { phex(n >> 24); phex(n >> 16); phex(n >> 8); phex(n & 255); } static void print_P_hex(const char *s, uint8_t n) __attribute__((unused)); static void print_P_hex(const char *s, uint8_t n) { print_P(s); phex(n); cout('\r'); cout('\n'); } static void print_P_hex16(const char *s, uint16_t n) __attribute__((unused)); static void print_P_hex16(const char *s, uint16_t n) { print_P(s); phex16(n); cout('\r'); cout('\n'); } static void print_P_hex32(const char *s, uint32_t n) __attribute__((unused)); static void print_P_hex32(const char *s, uint32_t n) { print_P(s); phex32(n); cout('\r'); cout('\n'); } #else // do not SPEW_ALL_THIS_CRAP_TO_THE_SERIAL_PORT #define cout(c) #define print(s) #define phex1(n) #define phex(n) #define phex16(n) #define phex32(n) #define print_hex(s, n) #define print_hex16(s, n) #define print_hex32(s, n) #endif #endif