forked from vshymanskyy/TinyGSM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TinyGsmCommon.h
71 lines (61 loc) · 1.32 KB
/
TinyGsmCommon.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/**
* @file TinyGsmCommon.h
* @author Volodymyr Shymanskyy
* @license LGPL-3.0
* @copyright Copyright (c) 2016 Volodymyr Shymanskyy
* @date Nov 2016
*/
#ifndef TinyGsmCommon_h
#define TinyGsmCommon_h
#if defined(SPARK) || defined(PARTICLE)
#include "Particle.h"
#elif defined(ARDUINO)
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#endif
#include <Client.h>
#include <TinyGsmFifo.h>
#ifndef TINY_GSM_YIELD
#define TINY_GSM_YIELD() { delay(0); }
#endif
#if defined(__AVR__)
#define TINY_GSM_PROGMEM PROGMEM
typedef const __FlashStringHelper* GsmConstStr;
#define GFP(x) (reinterpret_cast<GsmConstStr>(x))
#define GF(x) F(x)
#else
#define TINY_GSM_PROGMEM
typedef const char* GsmConstStr;
#define GFP(x) x
#define GF(x) x
#endif
#ifdef TINY_GSM_DEBUG
namespace {
template<typename T>
static void DBG(T last) {
TINY_GSM_DEBUG.println(last);
}
template<typename T, typename... Args>
static void DBG(T head, Args... tail) {
TINY_GSM_DEBUG.print(head);
TINY_GSM_DEBUG.print(' ');
DBG(tail...);
}
}
#else
#define DBG(...)
#endif
template<class T>
const T& TinyGsmMin(const T& a, const T& b)
{
return (b < a) ? b : a;
}
template<class T>
const T& TinyGsmMax(const T& a, const T& b)
{
return (b < a) ? a : b;
}
#endif