diff --git a/.clang-format b/.clang-format
new file mode 100644
index 00000000..e7355499
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,136 @@
+---
+Language: Cpp
+AccessModifierOffset: -2
+AlignAfterOpenBracket: Align
+AlignConsecutiveMacros: true
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlines: Right
+AlignOperands: Align
+AlignTrailingComments: true
+AllowAllArgumentsOnNextLine: true
+AllowAllConstructorInitializersOnNextLine: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: Never
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: None
+AllowShortLambdasOnASingleLine: None
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: MultiLine
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+ AfterCaseLabel: false
+ AfterClass: false
+ AfterControlStatement: false
+ AfterEnum: false
+ AfterFunction: false
+ AfterNamespace: false
+ AfterObjCDeclaration: false
+ AfterStruct: false
+ AfterUnion: false
+ AfterExternBlock: false
+ BeforeCatch: false
+ BeforeElse: false
+ IndentBraces: true
+ SplitEmptyFunction: true
+ SplitEmptyRecord: true
+ SplitEmptyNamespace: true
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Attach
+BreakBeforeInheritanceComma: false
+BreakInheritanceList: BeforeColon
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+BreakConstructorInitializers: BeforeColon
+BreakAfterJavaFieldAnnotations: false
+BreakStringLiterals: true
+ColumnLimit: 140
+CommentPragmas: '^ IWYU pragma:'
+CompactNamespaces: false
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 2
+ContinuationIndentWidth: 2
+Cpp11BracedListStyle: true
+DeriveLineEnding: false
+DerivePointerAlignment: false
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: false
+ForEachMacros:
+ - foreach
+ - Q_FOREACH
+ - BOOST_FOREACH
+IncludeBlocks: Preserve
+IncludeCategories:
+ - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
+ Priority: 2
+ SortPriority: 0
+ - Regex: '^(<|"(gtest|gmock|isl|json)/)'
+ Priority: 3
+ SortPriority: 0
+ - Regex: '.*'
+ Priority: 1
+ SortPriority: 0
+IncludeIsMainRegex: '(Test)?$'
+IncludeIsMainSourceRegex: ''
+IndentCaseLabels: true
+IndentGotoLabels: true
+IndentPPDirectives: BeforeHash
+IndentWidth: 2
+IndentWrappedFunctionNames: false
+JavaScriptQuotes: Leave
+JavaScriptWrapImports: true
+KeepEmptyLinesAtTheStartOfBlocks: true
+MacroBlockBegin: ''
+MacroBlockEnd: ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: All
+ObjCBinPackProtocolList: Auto
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 2
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Left
+ReflowComments: true
+SortIncludes: false
+SortUsingDeclarations: true
+SpaceAfterCStyleCast: true
+SpaceAfterLogicalNot: false
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: true
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+SpaceBeforeParens: ControlStatementsExceptForEachMacros
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceInEmptyBlock: false
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInConditionalStatement: false
+SpacesInContainerLiterals: false
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+SpaceBeforeSquareBrackets: false
+# Needs new Clang: SpaceAroundPointerQualifiers: After
+Standard: Latest
+StatementMacros:
+ - Q_UNUSED
+ - QT_REQUIRE_VERSION
+TabWidth: 8
+UseCRLF: false
+UseTab: Never
+...
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 00000000..d6036802
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1,26 @@
+Checks: '*,
+ -llvmlibc-callee-namespace,
+ -llvm-header-guard,
+ -llvm-namespace-comment,
+ -google-build-using-namespace,
+ -google-runtime-int,
+ -google-readability-namespace-comments,
+ -fuchsia-statically-constructed-objects,
+ -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
+ -cppcoreguidelines-pro-bounds-constant-array-index,
+ -cppcoreguidelines-pro-type-union-access,
+ -cppcoreguidelines-pro-type-cstyle-cast,
+ -cppcoreguidelines-pro-type-vararg,
+ -cppcoreguidelines-avoid-magic-numbers,
+ -cppcoreguidelines-avoid-non-const-global-variables,
+ -cppcoreguidelines-avoid-c-arrays,
+ -readability-magic-numbers,
+ -readability-uppercase-literal-suffix,
+ -modernize-use-trailing-return-type,
+ -modernize-avoid-c-arrays,
+ -hicpp-signed-bitwise,
+ -hicpp-no-assembler,
+ -hicpp-avoid-c-arrays,
+ -hicpp-uppercase-literal-suffix,
+ -cert-err58-cpp,
+ -cert-err60-cpp'
\ No newline at end of file
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 00000000..2257cac4
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,15 @@
+# Set the default behavior, in case people don't have core.autocrlf set.
+* text=auto
+
+# Explicitly declare text files you want to always be normalized and converted
+# to native line endings on checkout.
+*.c text
+*.cpp text
+*.h text
+*.hpp text
+
+# Denote all files that are truly binary and should not be modified.
+*.png binary
+*.bin binary
+*.jpg binary
+*.jpeg binary
diff --git a/.gitconfig b/.gitconfig
new file mode 100644
index 00000000..b2274475
--- /dev/null
+++ b/.gitconfig
@@ -0,0 +1,5 @@
+[core]
+ whitespace = blank-at-eol,blank-at-eof,space-before-tab
+ autocrlf = input
+[apply]
+ whitespace = fix
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index 7bdfbcb1..60a86f76 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -8,10 +8,30 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -27,5 +47,8 @@
+
+
+
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 00000000..a6fa6828
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,33 @@
+This contribution guide is in progress, improvements are welcome.
+
+### Code style
+
+Any C++ code PRs should aim to follow the style of existing code in the project.
+
+Using an autoformatter is heavily recommended, but make sure it's configured properly.
+
+There's currently preconfigured autoformatter rules for:
+
+ * CLion (IntelliJ) in .idea/codeStyles/Project.xml
+
+You can use those to configure your own IDE if it's not already on the list.
+
+#### Linting errors and compiler warnings
+
+Try to avoid any currently enabled warnings and try to reduce the amount of linter errors.
+
+#### Spelling
+
+Make sure you spellcheck your code before commiting it.
+
+#### TODO, FIXME
+
+Check before commiting that you haven't forgotten anything, preferably don't leave these in your commits.
+
+#### Licence headers
+
+You should add your name to the comma-space separated list of contributors if there's a license header.
+
+### License
+
+By contributing you agree to licence your code under the repository's general license (which is currently GPL-v3+).
diff --git a/bootloader/ota-dfu-python/unpacker.py b/bootloader/ota-dfu-python/unpacker.py
index 960ef9de..ab2ecbc5 100644
--- a/bootloader/ota-dfu-python/unpacker.py
+++ b/bootloader/ota-dfu-python/unpacker.py
@@ -13,7 +13,7 @@ class Unpacker(object):
#
#--------------------------------------------------------------------------
def entropy(self, length):
- return ''.join(random.choice('abcdefghijklmnopqrstuvwxyz') for i in range (length))
+ return ''.join(random.choice('abcdefghijklmnopqrstuvwxyz') for i in range (length))
#--------------------------------------------------------------------------
#
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fd8168c9..c55c77aa 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -662,7 +662,7 @@ include_directories(
"${NRF5_SDK_PATH}/modules/nrfx/drivers/include"
"${NRF5_SDK_PATH}/modules/nrfx/hal"
"${NRF5_SDK_PATH}/modules/nrfx/mdk"
- ${NRF5_SDK_PATH}/external/freertos/source/include
+ "${NRF5_SDK_PATH}/external/freertos/source/include"
"${NRF5_SDK_PATH}/components/toolchain/cmsis/include"
"${NRF5_SDK_PATH}/components/libraries/atomic"
"${NRF5_SDK_PATH}/components/libraries/atomic_fifo"
diff --git a/src/libs/mynewt-nimble/nimble/host/pts/tpg/94654-20170317-085122560.tpg b/src/libs/mynewt-nimble/nimble/host/pts/tpg/94654-20170317-085122560.tpg
index f5bb0ce9..3cc985fa 100644
--- a/src/libs/mynewt-nimble/nimble/host/pts/tpg/94654-20170317-085122560.tpg
+++ b/src/libs/mynewt-nimble/nimble/host/pts/tpg/94654-20170317-085122560.tpg
@@ -1,4 +1,4 @@
-
+
M'&/JP\$+#X83?)"[ M2E=\N*7*U 5)JSKT(5#=>@^/#]IP*[GTZ0%0]$F(/$
MEK[V7>349??;!JZJNFZ CK=QGD^FOYV^FU>"DK<@0U*##HV\H9&_%["5IK@1
MA9F,FJO2P^3:4_]04%-0T%9=^XCMWKF"L$[)%)G>_I 0Q?@:H)&1HX)7VY&.
@@ -1023,4 +1023,4 @@ M<74&Z:0BS4[#$;M2_1""EZVO@$B^"0'V'W:7^@-]G?*\B>0M(-
M6MF1FM+ ?,?3[N*1EI"$AXF#@6P-FU/4\QF?O!&%CE5*6J2'@QDYV?_04-O)
M7Z 6N;C7E_4
+
diff --git a/src/libs/mynewt-nimble/nimble/host/pts/tpg/94654-20170317-085441153.pts b/src/libs/mynewt-nimble/nimble/host/pts/tpg/94654-20170317-085441153.pts
index 92507b13..6760d5ec 100644
--- a/src/libs/mynewt-nimble/nimble/host/pts/tpg/94654-20170317-085441153.pts
+++ b/src/libs/mynewt-nimble/nimble/host/pts/tpg/94654-20170317-085441153.pts
@@ -286,4 +286,4 @@
3
-
+