Update RetroJoystickAdapter_PsxNewLib_XB360.ino

This commit is contained in:
Jarno Lehtinen 2021-11-06 15:21:26 +02:00 committed by GitHub
parent 53d0a5ac91
commit 26ac21030c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 1 deletions

View File

@ -212,7 +212,7 @@ void setup () {
}
void loop () {
static byte slx, sly, srx, sry;
static byte slx, sly, srx, sry, sl2, sr2;
fastDigitalWrite (PIN_HAVECONTROLLER, haveController);
if (!haveController) {
@ -292,6 +292,27 @@ void loop () {
srx = rx;
sry = ry;
}
byte l2 = psx.getAnalogButton(PSAB_L2);
if (l2 != 0 && l2 != sl2) {
#ifdef DEBUG
Serial.println(l2);
#endif
XInput.setTrigger(TRIGGER_LEFT, l2);
dirty = true;
sl2 = l2;
}
byte r2 = psx.getAnalogButton(PSAB_R2);
if (r2 != 0 && r2 != sr2) {
#ifdef DEBUG
Serial.println(r2);
#endif
XInput.setTrigger(TRIGGER_RIGHT, r2);
dirty = true;
sr2 = r2;
}
}
}