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

Commit

Permalink
Merge pull request #40 from project-march/feature/add-clang-format
Browse files Browse the repository at this point in the history
Add clang format
  • Loading branch information
Olavhaasie authored Feb 28, 2020
2 parents dd5b365 + 7c446d9 commit 15ac008
Show file tree
Hide file tree
Showing 32 changed files with 1,602 additions and 1,412 deletions.
65 changes: 65 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
BasedOnStyle: Google
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 2
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: true
BinPackParameters: true
ColumnLimit: 120
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerBinding: false
PointerBindsToType: true
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 60
PenaltyBreakString: 1
PenaltyBreakFirstLessLess: 1000
PenaltyExcessCharacter: 1000
PenaltyReturnTypeOnItsOwnLine: 90
SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: false
Standard: Auto
IndentWidth: 2
TabWidth: 2
UseTab: Never
IndentFunctionDeclarationAfterType: false
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
SortIncludes: false
SpaceAfterCStyleCast: false

# Configure each individual brace in BraceWrapping
BreakBeforeBraces: Custom

# Control of individual brace wrapping cases
BraceWrapping: {
AfterClass: 'true'
AfterControlStatement: 'true'
AfterEnum : 'true'
AfterFunction : 'true'
AfterNamespace : 'true'
AfterStruct : 'true'
AfterUnion : 'true'
BeforeCatch : 'true'
BeforeElse : 'true'
IndentBraces : 'false'
}
...
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
os: linux
language: python

addons:
apt:
packages:
- clang-format

notifications:
slack:
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=
Expand All @@ -16,3 +21,4 @@ install:

script:
- platformio run
- wget -qO- https://raw.githubusercontent.com/Sarcasm/run-clang-format/master/run-clang-format.py | python - -r src include
64 changes: 32 additions & 32 deletions include/LPC1768_pindefs_M4.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,35 @@
#define LPC_PINDEFS_
// Pindefs for MARCH 4 PDB

#define LPC_ECAT_MOSI (p5)
#define LPC_ECAT_MISO (p6)
#define LPC_ECAT_SCK (p7)
#define LPC_ECAT_SCS (p8)
#define LPC_ECAT_RST (p11)
#define LPC_ECAT_IRQ (p12)

#define LPC_LED1 (LED1)
#define LPC_LED2 (LED2)
#define LPC_LED3 (LED3)
#define LPC_LED4 (LED4)

#define LPC_TX (p9)
#define LPC_RX (p10)

#define LPC_BUTTON_PRESSED (p13)
#define LPC_BUTTON_LED (p25)
#define LPC_KEEP_PDB_ON (p20)

#define LPC_EMERGENCY_SWITCH_STATUS (p18)
#define LPC_EMERGENCY_SWITCH (p19)
#define LPC_LVOKAY1 (p24)
#define LPC_LVOKAY2 (p23)
#define LPC_LVON1 (p22)
#define LPC_LVON2 (p21)

#define LPC_I2C_SDA (p28)
#define LPC_I2C_SCL (p27)
#define LPC_I2C_INTERRUPT (p26)

#endif //LPC_PINDEFS_
#define LPC_ECAT_MOSI (p5)
#define LPC_ECAT_MISO (p6)
#define LPC_ECAT_SCK (p7)
#define LPC_ECAT_SCS (p8)
#define LPC_ECAT_RST (p11)
#define LPC_ECAT_IRQ (p12)

#define LPC_LED1 (LED1)
#define LPC_LED2 (LED2)
#define LPC_LED3 (LED3)
#define LPC_LED4 (LED4)

#define LPC_TX (p9)
#define LPC_RX (p10)

#define LPC_BUTTON_PRESSED (p13)
#define LPC_BUTTON_LED (p25)
#define LPC_KEEP_PDB_ON (p20)

#define LPC_EMERGENCY_SWITCH_STATUS (p18)
#define LPC_EMERGENCY_SWITCH (p19)

#define LPC_LVOKAY1 (p24)
#define LPC_LVOKAY2 (p23)
#define LPC_LVON1 (p22)
#define LPC_LVON2 (p21)

#define LPC_I2C_SDA (p28)
#define LPC_I2C_SCL (p27)
#define LPC_I2C_INTERRUPT (p26)

#endif // LPC_PINDEFS_
44 changes: 24 additions & 20 deletions lib/MasterOnlineChecker/MasterOnlineChecker.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,32 @@
class MasterOnlineChecker
{
private:
bool lastPing;
int timeOutValue;
Timer pingTimer;
bool lastPing;
int timeOutValue;
Timer pingTimer;

public:
MasterOnlineChecker(int timeOutValue){
this->timeOutValue = timeOutValue;
this->lastPing = false;
this->pingTimer.start();
}
MasterOnlineChecker(int timeOutValue)
{
this->timeOutValue = timeOutValue;
this->lastPing = false;
this->pingTimer.start();
}

bool isOnline(uint8_t masterOnline){
bool ping = masterOnline & 1; // Last bit
if (ping != this->lastPing){
this->pingTimer.reset();
this->lastPing = ping;
}
else if(this->pingTimer.read_ms() > this->timeOutValue){
return false;
}
return true;
bool isOnline(uint8_t masterOnline)
{
bool ping = masterOnline & 1; // Last bit
if (ping != this->lastPing)
{
this->pingTimer.reset();
this->lastPing = ping;
}
else if (this->pingTimer.read_ms() > this->timeOutValue)
{
return false;
}
return true;
}
};


#endif // MASTERONLINECHECKER_H
#endif // MASTERONLINECHECKER_H
Loading

0 comments on commit 15ac008

Please sign in to comment.