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.

59 lines
1.1 KiB

  1. /**
  2. * @file TinyGsmCommon.h
  3. * @author Volodymyr Shymanskyy
  4. * @license LGPL-3.0
  5. * @copyright Copyright (c) 2016 Volodymyr Shymanskyy
  6. * @date Nov 2016
  7. */
  8. #ifndef TinyGsmCommon_h
  9. #define TinyGsmCommon_h
  10. #if defined(SPARK) || defined(PARTICLE)
  11. #include "Particle.h"
  12. #elif defined(ARDUINO)
  13. #if ARDUINO >= 100
  14. #include "Arduino.h"
  15. #else
  16. #include "WProgram.h"
  17. #endif
  18. #endif
  19. #include <Client.h>
  20. #include <TinyGsmFifo.h>
  21. #ifndef TINY_GSM_YIELD
  22. #define TINY_GSM_YIELD() { delay(0); }
  23. #endif
  24. #if defined(__AVR__)
  25. #define TINY_GSM_PROGMEM PROGMEM
  26. typedef const __FlashStringHelper* GsmConstStr;
  27. #define GFP(x) (reinterpret_cast<GsmConstStr>(x))
  28. #define GF(x) F(x)
  29. #else
  30. #define TINY_GSM_PROGMEM
  31. typedef const char* GsmConstStr;
  32. #define GFP(x) x
  33. #define GF(x) x
  34. #endif
  35. #ifdef GSM_DEBUG
  36. namespace {
  37. template<typename T>
  38. static void DBG(T last) {
  39. GSM_DEBUG.println(last);
  40. }
  41. template<typename T, typename... Args>
  42. static void DBG(T head, Args... tail) {
  43. GSM_DEBUG.print(head);
  44. GSM_DEBUG.print(' ');
  45. DBG(tail...);
  46. }
  47. }
  48. #else
  49. #define DBG(...)
  50. #endif
  51. #endif