Skip to content

Commit

Permalink
CRTP!!!! Totally untested
Browse files Browse the repository at this point in the history
Signed-off-by: Sara Damiano <[email protected]>
  • Loading branch information
SRGDamia1 committed Feb 6, 2020
1 parent 7d6aba2 commit d3d1083
Show file tree
Hide file tree
Showing 31 changed files with 5,226 additions and 6,661 deletions.
110 changes: 110 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Left
AlignOperands: false
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Empty
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: "^ IWYU pragma:"
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
# ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 60
PenaltyReturnTypeOnItsOwnLine: 5
PointerAlignment: Left
PointerBindsToType: true
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 2
UseTab: Never
---
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
.clang_complete
.gcc-flags.json
platformio.ini
extra_envs.ini
lib/readme.txt
include/readme.txt
.atomrc.cson
Expand Down
3 changes: 3 additions & 0 deletions cpplint.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Allow references to be used to change values
filter=-runtime/references
filter=-build/namespaces
6 changes: 3 additions & 3 deletions examples/AllFunctions/AllFunctions.ino
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
//SoftwareSerial SerialAT(2, 3); // RX, TX

// See all AT commands, if wanted
//#define DUMP_AT_COMMANDS
// #define DUMP_AT_COMMANDS

// Define the serial console for debug prints, if needed
#define TINY_GSM_DEBUG SerialMon
Expand All @@ -68,8 +68,8 @@
#define GSM_PIN ""

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

// Your GPRS credentials, if any
const char apn[] = "YourAPN";
Expand Down
2 changes: 1 addition & 1 deletion examples/BlynkClient/BlynkClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

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

// Select your modem:
#define TINY_GSM_MODEM_SIM800
Expand Down
12 changes: 6 additions & 6 deletions examples/FileDownload/FileDownload.ino
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@
#define TINY_GSM_RX_BUFFER 1024

// See all AT commands, if wanted
//#define DUMP_AT_COMMANDS
// #define DUMP_AT_COMMANDS

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

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

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

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

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

Expand Down Expand Up @@ -246,7 +246,7 @@ void loop() {
// SerialMon.print(c, HEX);
// SerialMon.print(' ');
// if (isprint(c))
// SerialMon.print((char) c);
// SerialMon.print(reinterpret_cast<char> c);
// else
// SerialMon.print('*');
// SerialMon.print(' ');
Expand Down Expand Up @@ -301,7 +301,7 @@ void loop() {
while (readLength < contentLength && client.connected() && millis() - clientReadStartTime < clientReadTimeout) {
while (client.available()) {
uint8_t c = client.read();
//SerialMon.print((char)c); // Uncomment this to show data
//SerialMon.print(reinterpret_cast<char>c); // Uncomment this to show data
crc.update(c);
readLength++;
if (readLength % (contentLength / 13) == 0) {
Expand Down
6 changes: 3 additions & 3 deletions examples/HttpClient/HttpClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,18 @@
#define TINY_GSM_RX_BUFFER 650

// See all AT commands, if wanted
//#define DUMP_AT_COMMANDS
// #define DUMP_AT_COMMANDS

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

// Range to attempt to autobaud
#define GSM_AUTOBAUD_MIN 9600
#define GSM_AUTOBAUD_MAX 115200

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

// Define how you're planning to connect to the internet
#define TINY_GSM_USE_GPRS true
Expand Down
6 changes: 3 additions & 3 deletions examples/HttpsClient/HttpsClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@
#define TINY_GSM_RX_BUFFER 650

// See all AT commands, if wanted
//#define DUMP_AT_COMMANDS
// #define DUMP_AT_COMMANDS

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

// Range to attempt to autobaud
#define GSM_AUTOBAUD_MIN 9600
#define GSM_AUTOBAUD_MAX 115200

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

// Define how you're planning to connect to the internet
#define TINY_GSM_USE_GPRS true
Expand Down
8 changes: 4 additions & 4 deletions examples/MqttClient/MqttClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
//SoftwareSerial SerialAT(2, 3); // RX, TX

// See all AT commands, if wanted
//#define DUMP_AT_COMMANDS
// #define DUMP_AT_COMMANDS

// Define the serial console for debug prints, if needed
#define TINY_GSM_DEBUG SerialMon
Expand All @@ -70,7 +70,7 @@
#define GSM_AUTOBAUD_MAX 115200

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

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

long lastReconnectAttempt = 0;
uint32_t lastReconnectAttempt = 0;

void mqttCallback(char* topic, byte* payload, unsigned int len) {
SerialMon.print("Message arrived [");
Expand Down Expand Up @@ -252,7 +252,7 @@ void loop() {
if (!mqtt.connected()) {
SerialMon.println("=== MQTT NOT CONNECTED ===");
// Reconnect every 10 seconds
unsigned long t = millis();
uint32_t t = millis();
if (t - lastReconnectAttempt > 10000L) {
lastReconnectAttempt = t;
if (mqttConnect()) {
Expand Down
8 changes: 4 additions & 4 deletions examples/WebClient/WebClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#define TINY_GSM_RX_BUFFER 650

// See all AT commands, if wanted
//#define DUMP_AT_COMMANDS
// #define DUMP_AT_COMMANDS

// Define the serial console for debug prints, if needed
#define TINY_GSM_DEBUG SerialMon
Expand All @@ -57,10 +57,10 @@
#define GSM_AUTOBAUD_MAX 115200

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

// Uncomment this if you want to use SSL
//#define USE_SSL
// #define USE_SSL

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

unsigned long timeout = millis();
uint32_t timeout = millis();
while (client.connected() && millis() - timeout < 10000L) {
// Print available data
while (client.available()) {
Expand Down
8 changes: 4 additions & 4 deletions examples/more/Hologram_Dash/Hologram_Dash.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
#define TINY_GSM_MODEM_UBLOX

// Increase RX buffer if needed
//#define TINY_GSM_RX_BUFFER 512
// #define TINY_GSM_RX_BUFFER 512

#include <TinyGsmClient.h>

// Uncomment this if you want to see all AT commands
//#define DUMP_AT_COMMANDS
// #define DUMP_AT_COMMANDS

// Uncomment this if you want to use SSL
//#define USE_SSL
// #define USE_SSL

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

unsigned long timeout = millis();
uint32_t timeout = millis();
while (client.connected() && millis() - timeout < 10000L) {
// Print available data
while (client.available()) {
Expand Down
6 changes: 3 additions & 3 deletions examples/more/Industruino/Industruino.ino
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
#define TINY_GSM_MODEM_SIM800

// Increase RX buffer if needed
//#define TINY_GSM_RX_BUFFER 512
// #define TINY_GSM_RX_BUFFER 512

#include <TinyGsmClient.h>
#include <ArduinoHttpClient.h>

// Uncomment this if you want to see all AT commands
//#define DUMP_AT_COMMANDS
// #define DUMP_AT_COMMANDS

// Uncomment this if you want to use SSL
//#define USE_SSL
// #define USE_SSL

// Set serial for debug console (to the Serial Monitor, speed 115200)
#define SerialMon SerialUSB
Expand Down
2 changes: 1 addition & 1 deletion examples/more/SIM800_SslSetCert/SIM800_SslSetCert.ino
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define SerialAT Serial1

// Uncomment this if you want to see all AT commands
//#define DUMP_AT_COMMANDS
// #define DUMP_AT_COMMANDS


#ifdef DUMP_AT_COMMANDS
Expand Down
Loading

0 comments on commit d3d1083

Please sign in to comment.