diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..f9408bc --- /dev/null +++ b/.clang-format @@ -0,0 +1,91 @@ +# LLVM 12 +--- +BasedOnStyle: LLVM +AccessModifierOffset: -4 +AlignAfterOpenBracket: AlwaysBreak +AlignConsecutiveAssignments: None +AlignConsecutiveBitFields: None +AlignConsecutiveDeclarations: None +AlignConsecutiveMacros: AcrossComments +AlignEscapedNewlines: Right +AlignOperands: Align +AlignTrailingComments: false +AllowAllArgumentsOnNextLine: false +AllowAllConstructorInitializersOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: Always +AllowShortCaseLabelsOnASingleLine: false +AllowShortEnumsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: Yes +AttributeMacros: [] +BinPackArguments: false +BinPackParameters: false +BitFieldColonSpacing: After +BreakBeforeBraces: Allman +BreakBeforeBinaryOperators: None +BreakBeforeConceptDeclarations: true +BreakBeforeTernaryOperators: false +BreakConstructorInitializers: BeforeColon +BreakInheritanceList: BeforeColon +BreakStringLiterals: true +ColumnLimit: 120 +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DeriveLineEnding: false +UseCRLF: false +DerivePointerAlignment: false +EmptyLineBeforeAccessModifier: LogicalBlock +FixNamespaceComments: false +ForEachMacros: [] +IncludeBlocks: Preserve +IndentCaseBlocks: false +IndentCaseLabels: true +IndentExternBlock: NoIndent +IndentGotoLabels: true +IndentPPDirectives: None +IndentWidth: 4 +IndentWrappedFunctionNames: true +KeepEmptyLinesAtTheStartOfBlocks: false +Language: Cpp +MaxEmptyLinesToKeep: 2 +NamespaceIndentation: All +PointerAlignment: Left +ReflowComments: true +SortIncludes: false +SortUsingDeclarations: false +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: false +SpaceAroundPointerQualifiers: Default +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: Never +SpacesInCStyleCastParentheses: false +SpacesInConditionalStatement: false +SpacesInContainerLiterals: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: c++14 +StatementAttributeLikeMacros: [emit] +StatementMacros: [Q_UNUSED, Q_OBJECT] +TabWidth: 4 +UseCRLF: false +UseTab: Never diff --git a/firmware/firmware.ino b/firmware/firmware.ino index 0f495b4..1ee8dab 100644 --- a/firmware/firmware.ino +++ b/firmware/firmware.ino @@ -23,16 +23,17 @@ */ // the setup function runs once when you press reset or power the board -void setup() { - // initialize digital pin LED_BUILTIN as an output. - pinMode(LED_BUILTIN, OUTPUT); +void setup() +{ + // initialize digital pin LED_BUILTIN as an output. + pinMode(LED_BUILTIN, OUTPUT); } // the loop function runs over and over again forever -void loop() { - digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) - delay(1000); // wait for a second - digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW - delay(1000); // wait for a second +void loop() +{ + digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) + delay(1000); // wait for a second + digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW + delay(1000); // wait for a second } - diff --git a/library/cppcount/cppcount/src/characters.cpp b/library/cppcount/cppcount/src/characters.cpp index 49c3814..5418027 100644 --- a/library/cppcount/cppcount/src/characters.cpp +++ b/library/cppcount/cppcount/src/characters.cpp @@ -19,7 +19,7 @@ unordered_map countCharactersIgnoreCase(const string& str) { unordered_map counts; - for (auto& pair: countCharacters(str)) + for (auto& pair : countCharacters(str)) { counts[toupper(pair.first)] += pair.second; } diff --git a/library/cppcount/cppcount/tests/src/charactersTests.cpp b/library/cppcount/cppcount/tests/src/charactersTests.cpp index d666a93..57facb7 100644 --- a/library/cppcount/cppcount/tests/src/charactersTests.cpp +++ b/library/cppcount/cppcount/tests/src/charactersTests.cpp @@ -8,14 +8,7 @@ TEST(charactersTests, countCharacters) { unordered_map counts = countCharacters("Bonjour Bob"); unordered_map expected_counts( - {{'B', 2}, - {'o', 3}, - {'n', 1}, - {'j', 1}, - {'u', 1}, - {'r', 1}, - {' ', 1}, - {'b', 1}}); + {{'B', 2}, {'o', 3}, {'n', 1}, {'j', 1}, {'u', 1}, {'r', 1}, {' ', 1}, {'b', 1}}); EXPECT_TRUE(counts == expected_counts); } @@ -23,14 +16,7 @@ TEST(charactersTests, countCharacters) TEST(charactersTests, countCharactersIgnoreCase) { unordered_map counts = countCharactersIgnoreCase("BonjOur BOb"); - unordered_map expected_counts( - {{'B', 3}, - {'O', 3}, - {'N', 1}, - {'J', 1}, - {'U', 1}, - {'R', 1}, - {' ', 1}}); + unordered_map expected_counts({{'B', 3}, {'O', 3}, {'N', 1}, {'J', 1}, {'U', 1}, {'R', 1}, {' ', 1}}); EXPECT_TRUE(counts == expected_counts); }