digital-clock/src/DebugUtil.h

35 lines
774 B
C

/*
DebugUtils.h - Simple debugging utilities.
https://forum.arduino.cc/t/serial-debug-macro/64259/3
Posted: 2015-05-08 10:48 PM, by unknown author.
With modification by Joshua Purba.
*/
#ifndef DEBUGUTILS_H
#define DEBUGUTILS_H
#ifdef DEBUG
#define DEBUG_SETUP() Serial.begin(9600)
#define DEBUG_TEARDOWN() Serial.end()
#ifndef DEBUG_PRINT
#define DEBUG_PRINT(...) Serial.print(__VA_ARGS__)
#endif
#ifndef DEBUG_PRINTLN
#define DEBUG_PRINTLN(...) Serial.println(__VA_ARGS__)
#endif
#else
#define DEBUG_SETUP(...) {}
#define DEBUG_TEARDOWN() {}
#ifndef DEBUG_PRINT
#define DEBUG_PRINT(...) {}
#endif
#ifndef DEBUG_PRINTLN
#define DEBUG_PRINTLN(...) {}
#endif
#ifndef UNUSED
#define UNUSED(v) (void) (v)
#endif
#endif
#endif