mirror of
https://github.com/limyz/573controller
synced 2024-11-27 17:00:58 +01:00
Updated _gfxg
Minor button tweaks for out-of-box-experience with GITADORA PC version
This commit is contained in:
parent
c2566adb82
commit
f2815c0797
@ -70,11 +70,8 @@ void setup() {
|
|||||||
Joystick.setZAxisRange(-2048, 2048);
|
Joystick.setZAxisRange(-2048, 2048);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constant that maps the phyical pin to the joystick button.
|
byte keys[] = {6, 4, 5, 7, 8};
|
||||||
const int pinToButtonMap = 4;
|
byte pick[] = {9 ,10};
|
||||||
const int pinToHatSwitchMap = 9;
|
|
||||||
|
|
||||||
// Last state of the buttons
|
|
||||||
int lastButtonState[5] = {0,0,0,0,0};
|
int lastButtonState[5] = {0,0,0,0,0};
|
||||||
int lastHatSwitchState[2] = {0,0};
|
int lastHatSwitchState[2] = {0,0};
|
||||||
|
|
||||||
@ -92,7 +89,7 @@ void loop() {
|
|||||||
|
|
||||||
// Read pin values
|
// Read pin values
|
||||||
for (int index = 0; index < 5; index++) {
|
for (int index = 0; index < 5; index++) {
|
||||||
int currentButtonState = !digitalRead(index + pinToButtonMap);
|
int currentButtonState = !digitalRead(keys[index]);
|
||||||
if (currentButtonState != lastButtonState[index]) {
|
if (currentButtonState != lastButtonState[index]) {
|
||||||
Joystick.setButton(index, currentButtonState);
|
Joystick.setButton(index, currentButtonState);
|
||||||
lastButtonState[index] = currentButtonState;
|
lastButtonState[index] = currentButtonState;
|
||||||
@ -100,7 +97,7 @@ void loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int index = 0; index < 2; index++) {
|
for (int index = 0; index < 2; index++) {
|
||||||
int currentHatSwitchState = digitalRead(index + pinToHatSwitchMap);
|
int currentHatSwitchState = digitalRead(pick[index]);
|
||||||
if (currentHatSwitchState != lastHatSwitchState[index]) {
|
if (currentHatSwitchState != lastHatSwitchState[index]) {
|
||||||
valueChanged = true;
|
valueChanged = true;
|
||||||
lastHatSwitchState[index] = currentHatSwitchState;
|
lastHatSwitchState[index] = currentHatSwitchState;
|
||||||
|
Loading…
Reference in New Issue
Block a user