debug.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * =====================================================================================
  3. *
  4. * ________ .__ __ ________ ____ ________
  5. * \_____ \ __ __|__| ____ | | __\______ \ _______ _/_ |/ _____/
  6. * / / \ \| | \ |/ ___\| |/ / | | \_/ __ \ \/ /| / __ \
  7. * / \_/. \ | / \ \___| < | ` \ ___/\ / | \ |__\ \
  8. * \_____\ \_/____/|__|\___ >__|_ \/_______ /\___ >\_/ |___|\_____ /
  9. * \__> \/ \/ \/ \/ \/
  10. *
  11. * www.optixx.org
  12. *
  13. *
  14. * Version: 1.0
  15. * Created: 07/21/2009 03:32:16 PM
  16. * Author: david@optixx.org
  17. *
  18. * =====================================================================================
  19. */
  20. #ifndef __DEBUG_H__
  21. #define __DEBUG_H__
  22. #include <stdlib.h>
  23. #include <stdint.h>
  24. #include <stdarg.h>
  25. #include <avr/pgmspace.h>
  26. #if defined(NO_DEBUG) && defined(__GNUC__)
  27. /*
  28. * gcc's cpp has extensions; it allows for macros with a variable number of arguments. We use this extension here to preprocess pmesg away.
  29. */
  30. #define debug(level, format, args...) ((void)0)
  31. #else
  32. void debug(int level, char *format, ...);
  33. /*
  34. * print a message, if it is considered significant enough. Adapted from [K&R2], p. 174
  35. */
  36. #endif
  37. #if defined(NO_DEBUG) && defined(__GNUC__)
  38. /*
  39. * gcc's cpp has extensions; it allows for macros with a variable number of arguments. We use this extension here to preprocess pmesg away.
  40. */
  41. #define debug_P(level, format, args...) ((void)0)
  42. #else
  43. void debug_P(int level, PGM_P format, ...);
  44. /*
  45. * print a message, if it is considered significant enough. Adapted from [K&R2], p. 174
  46. */
  47. #endif
  48. #endif /* DEBUG_H */