Skip to content

Commit

Permalink
adding uno
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidTruyens committed Apr 28, 2022
1 parent d50cff8 commit 6701248
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 6 deletions.
111 changes: 111 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 8
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 4
UseTab: Never
6 changes: 6 additions & 0 deletions lib/inputs/grabberpinmapping.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once
#define JoyStickXPosPin 3
#define JoyStickXNegPin 4
#define JoyStickYPosPin 5
#define JoyStickYNegPin 6
#define ZButtonPin 7
36 changes: 31 additions & 5 deletions lib/inputs/machineinputs.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
#include "machineinputs.h"
#include "joystickpos.h"

void machineInputs::initialize(){

void machineInputs::initialize() {
pinMode(JoyStickXNegPin, INPUT_PULLUP);
pinMode(JoyStickXPosPin, INPUT_PULLUP);
pinMode(JoyStickYNegPin, INPUT_PULLUP);
pinMode(JoyStickYPosPin, INPUT_PULLUP);
pinMode(ZButtonPin, INPUT_PULLUP);
};

void machineInputs::run(){
void machineInputs::run() {
int XPos = digitalRead(JoyStickXPosPin);
int XNeg = digitalRead(JoyStickXNegPin);
int YPos = digitalRead(JoyStickYPosPin);
int YNeg = digitalRead(JoyStickYNegPin);
int ZActive = digitalRead(ZButtonPin);

};
if (XPos) {
thePosition = joystickPositions::Xplus;
} else if (XNeg) {
thePosition = joystickPositions::Xminus;
} else if (YPos) {
if (ZActive) {
thePosition = joystickPositions::Zplus;
} else {
thePosition = joystickPositions::Yplus;
}

} else if (YNeg) {
if (ZActive) {
thePosition = joystickPositions::Zminus;
} else {
thePosition = joystickPositions::Yminus;
}
}
};

joystickPositions machineInputs::getPosition(){
joystickPositions machineInputs::getPosition() {
return thePosition;
};
2 changes: 1 addition & 1 deletion lib/inputs/machineinputs.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include <Arduino.h>
#include "joystickpos.h"

#include "grabberpinmapping.h"

class machineInputs {
public:
Expand Down
7 changes: 7 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,12 @@ platform = atmelavr
board = megaatmega2560
framework = arduino
monitor_speed = 115200

[env:uno]
platform = atmelavr
board = uno
framework = arduino
monitor_speed = 9600

;lip_deps =
; https://github.com/CostinV92/CNCShield.git

0 comments on commit 6701248

Please sign in to comment.