1
0

debug.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. debug.h - Definition von 2 Debugfunktionen - Version 0.1
  3. Copyright (c) 2012 Wilfried Klaas. All right reserved.
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with this library; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  15. */
  16. // Program im Debugmodus kompilieren, dann werden zus. Ausgaben auf die serielle Schnittstelle geschrieben.
  17. // Zum aktivieren der Debug Funktion bitte den Define VOR dem #include "debug.h" in die Hauptdatei eintragen.
  18. //#define debug
  19. #include <Arduino.h>
  20. #include <inttypes.h>
  21. #ifndef debug_lib
  22. #define debug_lib
  23. #if defined(debug) && !defined(__AVR_ATtiny84__)
  24. #define dbgOut(S) \
  25. Serial.print(S);
  26. #define dbgOut2(S,P) \
  27. Serial.print(S,P);
  28. #define dbgOutLn(S) \
  29. Serial.println(S);
  30. #define dbgOutLn2(S,P) \
  31. Serial.println(S,P);
  32. #define initDebug() \
  33. Serial.begin(9600); \
  34. Serial.flush(); \
  35. delay(100);
  36. #else
  37. #define dbgOut(S)
  38. #define dbgOut2(S,P)
  39. #define dbgOutLn(S)
  40. #define dbgOutLn2(S,P)
  41. #define initDebug()
  42. #endif
  43. /*
  44. void dbgOutHex(uint8_t data) {
  45. dbgOut(" 0x");
  46. if (data < 0x10) {
  47. dbgOut('0');
  48. }
  49. dbgOut2(data, HEX);
  50. }
  51. */
  52. #endif