Skip to content

Commit

Permalink
Add the reverse, margin and rest parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonPucheu committed Jan 21, 2023
1 parent 86b99d7 commit 44ee610
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/Joystick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@
/**
* Setup the joystick
*/
Joystick::Joystick(uint8_t xPin, uint8_t yPin, uint8_t cPin, bool xReversed = false, bool yReversed = false)
Joystick::Joystick(uint8_t xPin, uint8_t yPin, uint8_t cPin, bool xReversed, bool yReversed, int xRest, int yRest, int xMargin, int yMargin)
{
x = Potentiometer(xPin, xReversed);
y = Potentiometer(yPin, yReversed);
x = Potentiometer(xPin, xReversed, xRest, xMargin);
y = Potentiometer(yPin, yReversed, yRest, yMargin);
clck = Button(cPin);
}

Joystick::Joystick(uint8_t xPin, uint8_t yPin, uint8_t cPin)
{
x = Potentiometer(xPin);
y = Potentiometer(yPin);
clck = Button(cPin);
}
3 changes: 2 additions & 1 deletion src/Joystick.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
class Joystick
{
public:
Joystick(uint8_t xPin, uint8_t yPin, uint8_t cPin, bool xReversed = false, bool yReversed = false);
Joystick(uint8_t xPin, uint8_t yPin, uint8_t cPin, bool xReversed, bool yReversed, int xRest, int yRest, int xMargin, int yMargin);
Joystick(uint8_t xPin, uint8_t yPin, uint8_t cPin);
Potentiometer x = Potentiometer(1);
Potentiometer y = Potentiometer(1);
Button clck = Button(1);
Expand Down

0 comments on commit 44ee610

Please sign in to comment.