Skip to content

Commit

Permalink
feat: rewriting library for useage with PKP-3500-SI-MT
Browse files Browse the repository at this point in the history
TODO: Update arduino examples

BREAKING CHANGE: ClassNames, Methods, Variables
  • Loading branch information
Stefan Hirschenberger committed May 25, 2024
1 parent 24c83be commit afec3cf
Show file tree
Hide file tree
Showing 24 changed files with 1,767 additions and 2,068 deletions.
197 changes: 197 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignArrayOfStructures: Right
AlignConsecutiveMacros:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignConsecutiveAssignments:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: true
PadOperators: true
AlignConsecutiveBitFields:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignConsecutiveDeclarations:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignEscapedNewlines: Right
AlignOperands: Align
SortIncludes: true
InsertBraces: true # Control statements must have curly brackets
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortLambdasOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeConceptDeclarations: true
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 150
CommentPragmas: "^ IWYU pragma:"
QualifierAlignment: Leave
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
PackConstructorInitializers: BinPack
BasedOnStyle: ""
ConstructorInitializerAllOnOneLineOrOnePerLine: false
AllowAllConstructorInitializersOnNextLine: true
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: "^<(.*)>"
Priority: 0
- Regex: '^"(.*)"'
Priority: 1
- Regex: "(.*)"
Priority: 2
IncludeIsMainRegex: "(Test)?$"
IncludeIsMainSourceRegex: ""
IndentAccessModifiers: false
IndentCaseLabels: true
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: true
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 50
PenaltyBreakBeforeFirstCallParameter: 9
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PenaltyIndentedWhitespace: 0
PointerAlignment: Left
PPIndentWidth: -1
ReferenceAlignment: Pointer
ReflowComments: false
RemoveBracesLLVM: false
SeparateDefinitionBlocks: Always
ShortNamespaceLines: 1
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
BeforeNonEmptyParentheses: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
70 changes: 70 additions & 0 deletions .github/workflows/ciWorkflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: CI Workflows

on: [push, pull_request]

jobs:
Run-Source-Code-Linters:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18' # Specify the Node.js version you need

- name: Install Clang-Format via npm
run: npm install -g clang-format

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.12'

- name: Install pre-commit
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Run pre-commit hooks
run: pre-commit run --all-files

Build-Arduino-Examples:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Arduino CLI
run: |
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
mv bin/arduino-cli /usr/local/bin/
- name: Set up Arduino CLI configuration
run: |
arduino-cli config init
arduino-cli core update-index
- name: Install Arduino Cores
run: |
arduino-cli core update-index --additional-urls "https://adafruit.github.io/arduino-board-index/package_adafruit_index.json"
arduino-cli core install arduino:avr
arduino-cli core install adafruit:samd --additional-urls "https://adafruit.github.io/arduino-board-index/package_adafruit_index.json"
- name: Install Arduino Libraries
run: |
arduino-cli lib install "autowp-mcp2515"
arduino-cli lib install "Adafruit CAN"
# Add more libraries as needed
- name: Compile Keypad configuration example
run: arduino-cli compile --fqbn arduino:avr:uno examples/PkpInitialConfiguration/PkpInitialConfiguration.ino

- name: Compile PKP-3500-SI-MT via MCP2515 example
run: arduino-cli compile --fqbn adafruit:samd:adafruit_feather_m4_can --libraries src examples/Pkp3500SiMt_Mcp2515/Pkp3500SiMt_Mcp2515.ino

- name: Compile PKP-3500-SI-MT via Adafruit Feather M4 CAN example
run: arduino-cli compile --fqbn adafruit:samd:adafruit_feather_m4_can --libraries src examples/Pkp3500SiMt_AdafruitFeatherM4Can/Pkp3500SiMt_AdafruitFeatherM4Can.ino
53 changes: 53 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Compiled object files, libraries, and executables
*.o
*.a
*.so
*.elf
*.bin
*.hex
*.eep
*.map
*.srec
*.dSYM/
*.su
*.idb
*.pdb

# Precompiled Headers
*.gch
*.pch

# Arduino IDE files
*.ino~
*.pde~

# Editor backup files
*~
*.bak
*.BAK
*.tmp
*.TMP

# Sublime Text files
*.sublime-workspace
*.sublime-project

# VS Code files
.vscode/

# Project folders
build/
output/

# Miscellaneous
.DS_Store
Thumbs.db
*.log
*.swp
*.lock

# Node.js dependencies
node_modules/

# Environment variables
.env
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md] #spell-checker: disable-line
- id: check-merge-conflict
- id: end-of-file-fixer
- id: mixed-line-ending
- id: check-yaml
- id: check-json
- id: check-added-large-files
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.6.1
hooks:
- id: cspell
- repo: https://gitlab.com/daverona/pre-commit/cpp
rev: 0.8.0
hooks:
- id: clang-format
args: ["-style=file"]
files: \.(ino|h|cpp)$
Binary file not shown.
Binary file not shown.

This file was deleted.

Loading

0 comments on commit afec3cf

Please sign in to comment.