Skip to content

Commit d3d1083

Browse files
committed
CRTP!!!! Totally untested
Signed-off-by: Sara Damiano <[email protected]>
1 parent 7d6aba2 commit d3d1083

31 files changed

+5226
-6661
lines changed

.clang-format

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: Google
4+
AccessModifierOffset: -1
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveMacros: false
7+
AlignConsecutiveAssignments: true
8+
AlignConsecutiveDeclarations: true
9+
AlignEscapedNewlines: Left
10+
AlignOperands: false
11+
AlignTrailingComments: true
12+
AllowAllArgumentsOnNextLine: true
13+
AllowAllConstructorInitializersOnNextLine: false
14+
AllowAllParametersOfDeclarationOnNextLine: false
15+
AllowShortBlocksOnASingleLine: true
16+
AllowShortCaseLabelsOnASingleLine: true
17+
AllowShortFunctionsOnASingleLine: Empty
18+
AllowShortLambdasOnASingleLine: All
19+
AllowShortIfStatementsOnASingleLine: WithoutElse
20+
AllowShortLoopsOnASingleLine: true
21+
AlwaysBreakAfterDefinitionReturnType: None
22+
AlwaysBreakAfterReturnType: None
23+
AlwaysBreakBeforeMultilineStrings: false
24+
AlwaysBreakTemplateDeclarations: Yes
25+
BinPackArguments: true
26+
BinPackParameters: true
27+
BreakBeforeBinaryOperators: None
28+
BreakBeforeBraces: Attach
29+
BreakBeforeInheritanceComma: false
30+
BreakInheritanceList: BeforeColon
31+
BreakBeforeTernaryOperators: true
32+
BreakConstructorInitializersBeforeComma: false
33+
BreakConstructorInitializers: BeforeColon
34+
BreakAfterJavaFieldAnnotations: false
35+
BreakStringLiterals: true
36+
ColumnLimit: 80
37+
CommentPragmas: "^ IWYU pragma:"
38+
CompactNamespaces: false
39+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
40+
ConstructorInitializerIndentWidth: 4
41+
ContinuationIndentWidth: 4
42+
Cpp11BracedListStyle: true
43+
DerivePointerAlignment: false
44+
DisableFormat: false
45+
ExperimentalAutoDetectBinPacking: false
46+
FixNamespaceComments: true
47+
ForEachMacros:
48+
- foreach
49+
- Q_FOREACH
50+
- BOOST_FOREACH
51+
IncludeBlocks: Preserve
52+
IncludeCategories:
53+
- Regex: '^<ext/.*\.h>'
54+
Priority: 2
55+
- Regex: '^<.*\.h>'
56+
Priority: 1
57+
- Regex: '^<.*'
58+
Priority: 2
59+
- Regex: '.*'
60+
Priority: 3
61+
IncludeIsMainRegex: '([-_](test|unittest))?$'
62+
IndentCaseLabels: true
63+
IndentPPDirectives: None
64+
IndentWidth: 2
65+
IndentWrappedFunctionNames: false
66+
JavaScriptQuotes: Leave
67+
JavaScriptWrapImports: true
68+
KeepEmptyLinesAtTheStartOfBlocks: false
69+
MacroBlockBegin: ""
70+
MacroBlockEnd: ""
71+
MaxEmptyLinesToKeep: 2
72+
NamespaceIndentation: None
73+
# ObjCBinPackProtocolList: Auto
74+
ObjCBlockIndentWidth: 2
75+
ObjCSpaceAfterProperty: false
76+
ObjCSpaceBeforeProtocolList: true
77+
PenaltyBreakAssignment: 2
78+
PenaltyBreakBeforeFirstCallParameter: 19
79+
PenaltyBreakComment: 300
80+
PenaltyBreakFirstLessLess: 120
81+
PenaltyBreakString: 1000
82+
PenaltyBreakTemplateDeclaration: 10
83+
PenaltyExcessCharacter: 60
84+
PenaltyReturnTypeOnItsOwnLine: 5
85+
PointerAlignment: Left
86+
PointerBindsToType: true
87+
ReflowComments: true
88+
SortIncludes: false
89+
SortUsingDeclarations: true
90+
SpaceAfterCStyleCast: false
91+
SpaceAfterLogicalNot: false
92+
SpaceAfterTemplateKeyword: true
93+
SpaceBeforeAssignmentOperators: true
94+
SpaceBeforeCpp11BracedList: false
95+
SpaceBeforeCtorInitializerColon: true
96+
SpaceBeforeInheritanceColon: true
97+
SpaceBeforeParens: ControlStatements
98+
SpaceBeforeRangeBasedForLoopColon: true
99+
SpaceInEmptyParentheses: false
100+
SpacesBeforeTrailingComments: 2
101+
SpacesInAngles: false
102+
SpacesInCStyleCastParentheses: false
103+
SpacesInContainerLiterals: true
104+
SpacesInCStyleCastParentheses: false
105+
SpacesInParentheses: false
106+
SpacesInSquareBrackets: false
107+
Standard: Cpp11
108+
TabWidth: 2
109+
UseTab: Never
110+
---

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
.clang_complete
2121
.gcc-flags.json
2222
platformio.ini
23+
extra_envs.ini
2324
lib/readme.txt
2425
include/readme.txt
2526
.atomrc.cson

cpplint.cfg

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Allow references to be used to change values
2+
filter=-runtime/references
3+
filter=-build/namespaces

examples/AllFunctions/AllFunctions.ino

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
//SoftwareSerial SerialAT(2, 3); // RX, TX
4343

4444
// See all AT commands, if wanted
45-
//#define DUMP_AT_COMMANDS
45+
// #define DUMP_AT_COMMANDS
4646

4747
// Define the serial console for debug prints, if needed
4848
#define TINY_GSM_DEBUG SerialMon
@@ -68,8 +68,8 @@
6868
#define GSM_PIN ""
6969

7070
// Set phone numbers, if you want to test SMS and Calls
71-
//#define SMS_TARGET "+380xxxxxxxxx"
72-
//#define CALL_TARGET "+380xxxxxxxxx"
71+
// #define SMS_TARGET "+380xxxxxxxxx"
72+
// #define CALL_TARGET "+380xxxxxxxxx"
7373

7474
// Your GPRS credentials, if any
7575
const char apn[] = "YourAPN";

examples/BlynkClient/BlynkClient.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
// Default heartbeat interval for GSM is 60
2828
// If you want override this value, uncomment and set this option:
29-
//#define BLYNK_HEARTBEAT 30
29+
// #define BLYNK_HEARTBEAT 30
3030

3131
// Select your modem:
3232
#define TINY_GSM_MODEM_SIM800

examples/FileDownload/FileDownload.ino

+6-6
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@
5252
#define TINY_GSM_RX_BUFFER 1024
5353

5454
// See all AT commands, if wanted
55-
//#define DUMP_AT_COMMANDS
55+
// #define DUMP_AT_COMMANDS
5656

5757
// Define the serial console for debug prints, if needed
5858
#define TINY_GSM_DEBUG SerialMon
59-
//#define LOGGING // <- Logging is for the HTTP library
59+
// #define LOGGING // <- Logging is for the HTTP library
6060

6161
// Add a reception delay - may be needed for a fast processor at a slow baud rate
62-
//#define TINY_GSM_YIELD() { delay(2); }
62+
// #define TINY_GSM_YIELD() { delay(2); }
6363

6464
// Define how you're planning to connect to the internet
6565
#define TINY_GSM_USE_GPRS true
@@ -217,7 +217,7 @@ void loop() {
217217
client.print("Connection: close\r\n\r\n");
218218

219219
// Let's see what the entire elapsed time is, from after we send the request.
220-
unsigned long timeElapsed = millis();
220+
uint32_t timeElapsed = millis();
221221

222222
SerialMon.println(F("Waiting for response header"));
223223

@@ -246,7 +246,7 @@ void loop() {
246246
// SerialMon.print(c, HEX);
247247
// SerialMon.print(' ');
248248
// if (isprint(c))
249-
// SerialMon.print((char) c);
249+
// SerialMon.print(reinterpret_cast<char> c);
250250
// else
251251
// SerialMon.print('*');
252252
// SerialMon.print(' ');
@@ -301,7 +301,7 @@ void loop() {
301301
while (readLength < contentLength && client.connected() && millis() - clientReadStartTime < clientReadTimeout) {
302302
while (client.available()) {
303303
uint8_t c = client.read();
304-
//SerialMon.print((char)c); // Uncomment this to show data
304+
//SerialMon.print(reinterpret_cast<char>c); // Uncomment this to show data
305305
crc.update(c);
306306
readLength++;
307307
if (readLength % (contentLength / 13) == 0) {

examples/HttpClient/HttpClient.ino

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,18 @@
5757
#define TINY_GSM_RX_BUFFER 650
5858

5959
// See all AT commands, if wanted
60-
//#define DUMP_AT_COMMANDS
60+
// #define DUMP_AT_COMMANDS
6161

6262
// Define the serial console for debug prints, if needed
6363
#define TINY_GSM_DEBUG SerialMon
64-
//#define LOGGING // <- Logging is for the HTTP library
64+
// #define LOGGING // <- Logging is for the HTTP library
6565

6666
// Range to attempt to autobaud
6767
#define GSM_AUTOBAUD_MIN 9600
6868
#define GSM_AUTOBAUD_MAX 115200
6969

7070
// Add a reception delay - may be needed for a fast processor at a slow baud rate
71-
//#define TINY_GSM_YIELD() { delay(2); }
71+
// #define TINY_GSM_YIELD() { delay(2); }
7272

7373
// Define how you're planning to connect to the internet
7474
#define TINY_GSM_USE_GPRS true

examples/HttpsClient/HttpsClient.ino

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@
4949
#define TINY_GSM_RX_BUFFER 650
5050

5151
// See all AT commands, if wanted
52-
//#define DUMP_AT_COMMANDS
52+
// #define DUMP_AT_COMMANDS
5353

5454
// Define the serial console for debug prints, if needed
5555
#define TINY_GSM_DEBUG SerialMon
56-
//#define LOGGING // <- Logging is for the HTTP library
56+
// #define LOGGING // <- Logging is for the HTTP library
5757

5858
// Range to attempt to autobaud
5959
#define GSM_AUTOBAUD_MIN 9600
6060
#define GSM_AUTOBAUD_MAX 115200
6161

6262
// Add a reception delay - may be needed for a fast processor at a slow baud rate
63-
//#define TINY_GSM_YIELD() { delay(2); }
63+
// #define TINY_GSM_YIELD() { delay(2); }
6464

6565
// Define how you're planning to connect to the internet
6666
#define TINY_GSM_USE_GPRS true

examples/MqttClient/MqttClient.ino

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
//SoftwareSerial SerialAT(2, 3); // RX, TX
6161

6262
// See all AT commands, if wanted
63-
//#define DUMP_AT_COMMANDS
63+
// #define DUMP_AT_COMMANDS
6464

6565
// Define the serial console for debug prints, if needed
6666
#define TINY_GSM_DEBUG SerialMon
@@ -70,7 +70,7 @@
7070
#define GSM_AUTOBAUD_MAX 115200
7171

7272
// Add a reception delay - may be needed for a fast processor at a slow baud rate
73-
//#define TINY_GSM_YIELD() { delay(2); }
73+
// #define TINY_GSM_YIELD() { delay(2); }
7474

7575
// Define how you're planning to connect to the internet
7676
#define TINY_GSM_USE_GPRS true
@@ -125,7 +125,7 @@ PubSubClient mqtt(client);
125125
#define LED_PIN 13
126126
int ledStatus = LOW;
127127

128-
long lastReconnectAttempt = 0;
128+
uint32_t lastReconnectAttempt = 0;
129129

130130
void mqttCallback(char* topic, byte* payload, unsigned int len) {
131131
SerialMon.print("Message arrived [");
@@ -252,7 +252,7 @@ void loop() {
252252
if (!mqtt.connected()) {
253253
SerialMon.println("=== MQTT NOT CONNECTED ===");
254254
// Reconnect every 10 seconds
255-
unsigned long t = millis();
255+
uint32_t t = millis();
256256
if (t - lastReconnectAttempt > 10000L) {
257257
lastReconnectAttempt = t;
258258
if (mqttConnect()) {

examples/WebClient/WebClient.ino

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
#define TINY_GSM_RX_BUFFER 650
4848

4949
// See all AT commands, if wanted
50-
//#define DUMP_AT_COMMANDS
50+
// #define DUMP_AT_COMMANDS
5151

5252
// Define the serial console for debug prints, if needed
5353
#define TINY_GSM_DEBUG SerialMon
@@ -57,10 +57,10 @@
5757
#define GSM_AUTOBAUD_MAX 115200
5858

5959
// Add a reception delay - may be needed for a fast processor at a slow baud rate
60-
//#define TINY_GSM_YIELD() { delay(2); }
60+
// #define TINY_GSM_YIELD() { delay(2); }
6161

6262
// Uncomment this if you want to use SSL
63-
//#define USE_SSL
63+
// #define USE_SSL
6464

6565
// Define how you're planning to connect to the internet
6666
#define TINY_GSM_USE_GPRS true
@@ -210,7 +210,7 @@ void loop() {
210210
client.print("Connection: close\r\n\r\n");
211211
client.println();
212212

213-
unsigned long timeout = millis();
213+
uint32_t timeout = millis();
214214
while (client.connected() && millis() - timeout < 10000L) {
215215
// Print available data
216216
while (client.available()) {

examples/more/Hologram_Dash/Hologram_Dash.ino

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
#define TINY_GSM_MODEM_UBLOX
1313

1414
// Increase RX buffer if needed
15-
//#define TINY_GSM_RX_BUFFER 512
15+
// #define TINY_GSM_RX_BUFFER 512
1616

1717
#include <TinyGsmClient.h>
1818

1919
// Uncomment this if you want to see all AT commands
20-
//#define DUMP_AT_COMMANDS
20+
// #define DUMP_AT_COMMANDS
2121

2222
// Uncomment this if you want to use SSL
23-
//#define USE_SSL
23+
// #define USE_SSL
2424

2525
// Set serial for debug console (to the Serial Monitor, speed 115200)
2626
#define SerialMon Serial
@@ -108,7 +108,7 @@ void loop() {
108108
client.print(String("Host: ") + server + "\r\n");
109109
client.print("Connection: close\r\n\r\n");
110110

111-
unsigned long timeout = millis();
111+
uint32_t timeout = millis();
112112
while (client.connected() && millis() - timeout < 10000L) {
113113
// Print available data
114114
while (client.available()) {

examples/more/Industruino/Industruino.ino

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
#define TINY_GSM_MODEM_SIM800
1919

2020
// Increase RX buffer if needed
21-
//#define TINY_GSM_RX_BUFFER 512
21+
// #define TINY_GSM_RX_BUFFER 512
2222

2323
#include <TinyGsmClient.h>
2424
#include <ArduinoHttpClient.h>
2525

2626
// Uncomment this if you want to see all AT commands
27-
//#define DUMP_AT_COMMANDS
27+
// #define DUMP_AT_COMMANDS
2828

2929
// Uncomment this if you want to use SSL
30-
//#define USE_SSL
30+
// #define USE_SSL
3131

3232
// Set serial for debug console (to the Serial Monitor, speed 115200)
3333
#define SerialMon SerialUSB

examples/more/SIM800_SslSetCert/SIM800_SslSetCert.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#define SerialAT Serial1
2929

3030
// Uncomment this if you want to see all AT commands
31-
//#define DUMP_AT_COMMANDS
31+
// #define DUMP_AT_COMMANDS
3232

3333

3434
#ifdef DUMP_AT_COMMANDS

0 commit comments

Comments
 (0)