Keyboard firmwares for Atmel AVR and Cortex-M
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

debug.h 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. Copyright 2011 Jun Wako <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #ifndef DEBUG_H
  15. #define DEBUG_H 1
  16. #include "print.h"
  17. #include "debug_config.h"
  18. #ifndef NO_DEBUG
  19. #define dprint(s) do { if (debug_enable) print(s); } while (0)
  20. #define dprintln() do { if (debug_enable) print_crlf(); } while (0)
  21. #define dprintf(fmt, ...) do { if (debug_enable) xprintf(fmt, ##__VA_ARGS__); } while (0)
  22. #define dmsg(s) dprintf("%s at %s: %S\n", __FILE__, __LINE__, PSTR(s))
  23. /* DO NOT USE these anymore */
  24. #define debug(s) do { if (debug_enable) print(s); } while (0)
  25. #define debugln(s) do { if (debug_enable) print_crlf(); } while (0)
  26. #define debug_S(s) do { if (debug_enable) print_S(s); } while (0)
  27. #define debug_P(s) do { if (debug_enable) print_P(s); } while (0)
  28. #define debug_msg(s) do { \
  29. if (debug_enable) { \
  30. print(__FILE__); print(" at "); print_dec(__LINE__); print(" in "); print(": "); print(s); \
  31. } \
  32. } while (0)
  33. #define debug_dec(data) do { if (debug_enable) print_dec(data); } while (0)
  34. #define debug_decs(data) do { if (debug_enable) print_decs(data); } while (0)
  35. #define debug_hex4(data) do { if (debug_enable) print_hex4(data); } while (0)
  36. #define debug_hex8(data) do { if (debug_enable) print_hex8(data); } while (0)
  37. #define debug_hex16(data) do { if (debug_enable) print_hex16(data); } while (0)
  38. #define debug_hex32(data) do { if (debug_enable) print_hex32(data); } while (0)
  39. #define debug_bin8(data) do { if (debug_enable) print_bin8(data); } while (0)
  40. #define debug_bin16(data) do { if (debug_enable) print_bin16(data); } while (0)
  41. #define debug_bin32(data) do { if (debug_enable) print_bin32(data); } while (0)
  42. #define debug_bin_reverse8(data) do { if (debug_enable) print_bin_reverse8(data); } while (0)
  43. #define debug_bin_reverse16(data) do { if (debug_enable) print_bin_reverse16(data); } while (0)
  44. #define debug_bin_reverse32(data) do { if (debug_enable) print_bin_reverse32(data); } while (0)
  45. #define debug_hex(data) debug_hex8(data)
  46. #define debug_bin(data) debug_bin8(data)
  47. #define debug_bin_reverse(data) debug_bin8(data)
  48. #else
  49. #include "nodebug.h"
  50. #endif
  51. #endif