Skip to content
This repository was archived by the owner on Dec 1, 2020. It is now read-only.

Commit 15ac008

Browse files
authored
Merge pull request #40 from project-march/feature/add-clang-format
Add clang format
2 parents dd5b365 + 7c446d9 commit 15ac008

32 files changed

+1602
-1412
lines changed

.clang-format

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
BasedOnStyle: Google
3+
AccessModifierOffset: -2
4+
ConstructorInitializerIndentWidth: 2
5+
AlignEscapedNewlinesLeft: false
6+
AlignTrailingComments: true
7+
AllowAllParametersOfDeclarationOnNextLine: false
8+
AllowShortIfStatementsOnASingleLine: false
9+
AllowShortLoopsOnASingleLine: false
10+
AllowShortFunctionsOnASingleLine: None
11+
AlwaysBreakTemplateDeclarations: true
12+
AlwaysBreakBeforeMultilineStrings: false
13+
BreakBeforeBinaryOperators: false
14+
BreakBeforeTernaryOperators: false
15+
BreakConstructorInitializersBeforeComma: true
16+
BinPackParameters: true
17+
ColumnLimit: 120
18+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
19+
DerivePointerBinding: false
20+
PointerBindsToType: true
21+
ExperimentalAutoDetectBinPacking: false
22+
IndentCaseLabels: true
23+
MaxEmptyLinesToKeep: 1
24+
NamespaceIndentation: None
25+
ObjCSpaceBeforeProtocolList: true
26+
PenaltyBreakBeforeFirstCallParameter: 19
27+
PenaltyBreakComment: 60
28+
PenaltyBreakString: 1
29+
PenaltyBreakFirstLessLess: 1000
30+
PenaltyExcessCharacter: 1000
31+
PenaltyReturnTypeOnItsOwnLine: 90
32+
SpacesBeforeTrailingComments: 2
33+
Cpp11BracedListStyle: false
34+
Standard: Auto
35+
IndentWidth: 2
36+
TabWidth: 2
37+
UseTab: Never
38+
IndentFunctionDeclarationAfterType: false
39+
SpacesInParentheses: false
40+
SpacesInAngles: false
41+
SpaceInEmptyParentheses: false
42+
SpacesInCStyleCastParentheses: false
43+
SpaceAfterControlStatementKeyword: true
44+
SpaceBeforeAssignmentOperators: true
45+
ContinuationIndentWidth: 4
46+
SortIncludes: false
47+
SpaceAfterCStyleCast: false
48+
49+
# Configure each individual brace in BraceWrapping
50+
BreakBeforeBraces: Custom
51+
52+
# Control of individual brace wrapping cases
53+
BraceWrapping: {
54+
AfterClass: 'true'
55+
AfterControlStatement: 'true'
56+
AfterEnum : 'true'
57+
AfterFunction : 'true'
58+
AfterNamespace : 'true'
59+
AfterStruct : 'true'
60+
AfterUnion : 'true'
61+
BeforeCatch : 'true'
62+
BeforeElse : 'true'
63+
IndentBraces : 'false'
64+
}
65+
...

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
os: linux
22
language: python
33

4+
addons:
5+
apt:
6+
packages:
7+
- clang-format
8+
49
notifications:
510
slack:
611
secure: mCWNJ6yjkotu6P4oV0J1BnOboTPWpLjaBKt6vb2cGcvKZ858DMSib2qaHb1lAVh27HdH9e4+yNOZuQf4/GSvFUgJfLogWMz01zwyQXhTkzMpWPcTt46biFi1jMnzgIn+AhiaH87e82bGr06zAsCNu6A1iJeieVOXJcyVhlUGVkc4hzMir49rXWGvQOfID+WtQ9ChKIcu1UVWO3tiBGtOAqgaJu7qT9fuCJ1ggx+0wT1WLCwWrZyuO7SenshdzmeJIIPvdVzaNM7nTqdDI+GwsOcPXiOU4A1MhTN9OQrhG7YDbTj24Do2wxrC/cmVi/5Xpek/+num/dO+2/7LihSkhfM4V62roMWwinWOuz/18S8vnQEhu+THOmWHJEHtVGbq5VoBFyXaP6wWEWh58xWHgI7ppj9wlRX+Hau/pcIjJxArfL+vy9YBL3V2TEG5TrLPxfxFRRx8l7ugY+wAC7v3T7YxGGV3yfNIg4tLIG6DDsiK5Ti8l/zyDdSvbmpy+le5yHEpFxi2yyBeje5+hzj4HFykfKK56NYiPhoT5hIWluSLizzLogEB53qEuYe3H163qI1JPVPAn5/nNtsfChPDZ0eVaqLm4jLXATkI19Km/peZOmAE7B2A9Ar7DHk3tVDbaxMRz9IH0nSREp6yp7dwfAcUHWv/pK1idOoHTFJO5zg=
@@ -16,3 +21,4 @@ install:
1621

1722
script:
1823
- platformio run
24+
- wget -qO- https://raw.githubusercontent.com/Sarcasm/run-clang-format/master/run-clang-format.py | python - -r src include

include/LPC1768_pindefs_M4.h

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,35 @@
22
#define LPC_PINDEFS_
33
// Pindefs for MARCH 4 PDB
44

5-
#define LPC_ECAT_MOSI (p5)
6-
#define LPC_ECAT_MISO (p6)
7-
#define LPC_ECAT_SCK (p7)
8-
#define LPC_ECAT_SCS (p8)
9-
#define LPC_ECAT_RST (p11)
10-
#define LPC_ECAT_IRQ (p12)
11-
12-
#define LPC_LED1 (LED1)
13-
#define LPC_LED2 (LED2)
14-
#define LPC_LED3 (LED3)
15-
#define LPC_LED4 (LED4)
16-
17-
#define LPC_TX (p9)
18-
#define LPC_RX (p10)
19-
20-
#define LPC_BUTTON_PRESSED (p13)
21-
#define LPC_BUTTON_LED (p25)
22-
#define LPC_KEEP_PDB_ON (p20)
23-
24-
#define LPC_EMERGENCY_SWITCH_STATUS (p18)
25-
#define LPC_EMERGENCY_SWITCH (p19)
26-
27-
#define LPC_LVOKAY1 (p24)
28-
#define LPC_LVOKAY2 (p23)
29-
#define LPC_LVON1 (p22)
30-
#define LPC_LVON2 (p21)
31-
32-
#define LPC_I2C_SDA (p28)
33-
#define LPC_I2C_SCL (p27)
34-
#define LPC_I2C_INTERRUPT (p26)
35-
36-
#endif //LPC_PINDEFS_
5+
#define LPC_ECAT_MOSI (p5)
6+
#define LPC_ECAT_MISO (p6)
7+
#define LPC_ECAT_SCK (p7)
8+
#define LPC_ECAT_SCS (p8)
9+
#define LPC_ECAT_RST (p11)
10+
#define LPC_ECAT_IRQ (p12)
11+
12+
#define LPC_LED1 (LED1)
13+
#define LPC_LED2 (LED2)
14+
#define LPC_LED3 (LED3)
15+
#define LPC_LED4 (LED4)
16+
17+
#define LPC_TX (p9)
18+
#define LPC_RX (p10)
19+
20+
#define LPC_BUTTON_PRESSED (p13)
21+
#define LPC_BUTTON_LED (p25)
22+
#define LPC_KEEP_PDB_ON (p20)
23+
24+
#define LPC_EMERGENCY_SWITCH_STATUS (p18)
25+
#define LPC_EMERGENCY_SWITCH (p19)
26+
27+
#define LPC_LVOKAY1 (p24)
28+
#define LPC_LVOKAY2 (p23)
29+
#define LPC_LVON1 (p22)
30+
#define LPC_LVON2 (p21)
31+
32+
#define LPC_I2C_SDA (p28)
33+
#define LPC_I2C_SCL (p27)
34+
#define LPC_I2C_INTERRUPT (p26)
35+
36+
#endif // LPC_PINDEFS_

lib/MasterOnlineChecker/MasterOnlineChecker.h

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,32 @@
66
class MasterOnlineChecker
77
{
88
private:
9-
bool lastPing;
10-
int timeOutValue;
11-
Timer pingTimer;
9+
bool lastPing;
10+
int timeOutValue;
11+
Timer pingTimer;
12+
1213
public:
13-
MasterOnlineChecker(int timeOutValue){
14-
this->timeOutValue = timeOutValue;
15-
this->lastPing = false;
16-
this->pingTimer.start();
17-
}
14+
MasterOnlineChecker(int timeOutValue)
15+
{
16+
this->timeOutValue = timeOutValue;
17+
this->lastPing = false;
18+
this->pingTimer.start();
19+
}
1820

19-
bool isOnline(uint8_t masterOnline){
20-
bool ping = masterOnline & 1; // Last bit
21-
if (ping != this->lastPing){
22-
this->pingTimer.reset();
23-
this->lastPing = ping;
24-
}
25-
else if(this->pingTimer.read_ms() > this->timeOutValue){
26-
return false;
27-
}
28-
return true;
21+
bool isOnline(uint8_t masterOnline)
22+
{
23+
bool ping = masterOnline & 1; // Last bit
24+
if (ping != this->lastPing)
25+
{
26+
this->pingTimer.reset();
27+
this->lastPing = ping;
2928
}
29+
else if (this->pingTimer.read_ms() > this->timeOutValue)
30+
{
31+
return false;
32+
}
33+
return true;
34+
}
3035
};
3136

32-
33-
#endif // MASTERONLINECHECKER_H
37+
#endif // MASTERONLINECHECKER_H

0 commit comments

Comments
 (0)