mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
[hal,wpilib] Use new DS available API from mrccomm (#8302)
Instead of just having a max count for joystick values, there's an available mask of values. This is because in the future we're expecting there to be holes in the list of available buttons and axes. This updates everything to support that scenario. Also, Joystick buttons, axes, and POVs all now start at 0 instead of 1.
This commit is contained in:
@@ -27,33 +27,33 @@ public class PS4Controller extends GenericHID implements Sendable {
|
||||
/** Represents a digital button on a PS4Controller. */
|
||||
public enum Button {
|
||||
/** Square button. */
|
||||
kSquare(1),
|
||||
kSquare(0),
|
||||
/** Cross button. */
|
||||
kCross(2),
|
||||
kCross(1),
|
||||
/** Circle button. */
|
||||
kCircle(3),
|
||||
kCircle(2),
|
||||
/** Triangle button. */
|
||||
kTriangle(4),
|
||||
kTriangle(3),
|
||||
/** Left trigger 1 button. */
|
||||
kL1(5),
|
||||
kL1(4),
|
||||
/** Right trigger 1 button. */
|
||||
kR1(6),
|
||||
kR1(5),
|
||||
/** Left trigger 2 button. */
|
||||
kL2(7),
|
||||
kL2(6),
|
||||
/** Right trigger 2 button. */
|
||||
kR2(8),
|
||||
kR2(7),
|
||||
/** Share button. */
|
||||
kShare(9),
|
||||
kShare(8),
|
||||
/** Options button. */
|
||||
kOptions(10),
|
||||
kOptions(9),
|
||||
/** L3 (left stick) button. */
|
||||
kL3(11),
|
||||
kL3(10),
|
||||
/** R3 (right stick) button. */
|
||||
kR3(12),
|
||||
kR3(11),
|
||||
/** PlayStation button. */
|
||||
kPS(13),
|
||||
kPS(12),
|
||||
/** Touchpad button. */
|
||||
kTouchpad(14);
|
||||
kTouchpad(13);
|
||||
|
||||
/** Button value. */
|
||||
public final int value;
|
||||
|
||||
@@ -27,33 +27,33 @@ public class PS5Controller extends GenericHID implements Sendable {
|
||||
/** Represents a digital button on a PS5Controller. */
|
||||
public enum Button {
|
||||
/** Square button. */
|
||||
kSquare(1),
|
||||
kSquare(0),
|
||||
/** Cross button. */
|
||||
kCross(2),
|
||||
kCross(1),
|
||||
/** Circle button. */
|
||||
kCircle(3),
|
||||
kCircle(2),
|
||||
/** Triangle button. */
|
||||
kTriangle(4),
|
||||
kTriangle(3),
|
||||
/** Left trigger 1 button. */
|
||||
kL1(5),
|
||||
kL1(4),
|
||||
/** Right trigger 1 button. */
|
||||
kR1(6),
|
||||
kR1(5),
|
||||
/** Left trigger 2 button. */
|
||||
kL2(7),
|
||||
kL2(6),
|
||||
/** Right trigger 2 button. */
|
||||
kR2(8),
|
||||
kR2(7),
|
||||
/** Create button. */
|
||||
kCreate(9),
|
||||
kCreate(8),
|
||||
/** Options button. */
|
||||
kOptions(10),
|
||||
kOptions(9),
|
||||
/** L3 (left stick) button. */
|
||||
kL3(11),
|
||||
kL3(10),
|
||||
/** R3 (right stick) button. */
|
||||
kR3(12),
|
||||
kR3(11),
|
||||
/** PlayStation button. */
|
||||
kPS(13),
|
||||
kPS(12),
|
||||
/** Touchpad button. */
|
||||
kTouchpad(14);
|
||||
kTouchpad(13);
|
||||
|
||||
/** Button value. */
|
||||
public final int value;
|
||||
|
||||
@@ -27,35 +27,35 @@ public class StadiaController extends GenericHID implements Sendable {
|
||||
/** Represents a digital button on a StadiaController. */
|
||||
public enum Button {
|
||||
/** A button. */
|
||||
kA(1),
|
||||
kA(0),
|
||||
/** B button. */
|
||||
kB(2),
|
||||
kB(1),
|
||||
/** X button. */
|
||||
kX(3),
|
||||
kX(2),
|
||||
/** Y button. */
|
||||
kY(4),
|
||||
kY(3),
|
||||
/** Left bumper button. */
|
||||
kLeftBumper(5),
|
||||
kLeftBumper(4),
|
||||
/** Right bumper button. */
|
||||
kRightBumper(6),
|
||||
kRightBumper(5),
|
||||
/** Left stick button. */
|
||||
kLeftStick(7),
|
||||
kLeftStick(6),
|
||||
/** Right stick button. */
|
||||
kRightStick(8),
|
||||
kRightStick(7),
|
||||
/** Ellipses button. */
|
||||
kEllipses(9),
|
||||
kEllipses(8),
|
||||
/** Hamburger button. */
|
||||
kHamburger(10),
|
||||
kHamburger(9),
|
||||
/** Stadia button. */
|
||||
kStadia(11),
|
||||
kStadia(10),
|
||||
/** Right trigger button. */
|
||||
kRightTrigger(12),
|
||||
kRightTrigger(11),
|
||||
/** Left trigger button. */
|
||||
kLeftTrigger(13),
|
||||
kLeftTrigger(12),
|
||||
/** Google button. */
|
||||
kGoogle(14),
|
||||
kGoogle(13),
|
||||
/** Frame button. */
|
||||
kFrame(15);
|
||||
kFrame(14);
|
||||
|
||||
/** Button value. */
|
||||
public final int value;
|
||||
|
||||
@@ -27,25 +27,25 @@ public class XboxController extends GenericHID implements Sendable {
|
||||
/** Represents a digital button on a XboxController. */
|
||||
public enum Button {
|
||||
/** A button. */
|
||||
kA(1),
|
||||
kA(0),
|
||||
/** B button. */
|
||||
kB(2),
|
||||
kB(1),
|
||||
/** X button. */
|
||||
kX(3),
|
||||
kX(2),
|
||||
/** Y button. */
|
||||
kY(4),
|
||||
kY(3),
|
||||
/** Left bumper button. */
|
||||
kLeftBumper(5),
|
||||
kLeftBumper(4),
|
||||
/** Right bumper button. */
|
||||
kRightBumper(6),
|
||||
kRightBumper(5),
|
||||
/** Back button. */
|
||||
kBack(7),
|
||||
kBack(6),
|
||||
/** Start button. */
|
||||
kStart(8),
|
||||
kStart(7),
|
||||
/** Left stick button. */
|
||||
kLeftStick(9),
|
||||
kLeftStick(8),
|
||||
/** Right stick button. */
|
||||
kRightStick(10);
|
||||
kRightStick(9);
|
||||
|
||||
/** Button value. */
|
||||
public final int value;
|
||||
|
||||
@@ -18,9 +18,9 @@ public class PS4ControllerSim extends GenericHIDSim {
|
||||
@SuppressWarnings("this-escape")
|
||||
public PS4ControllerSim(PS4Controller joystick) {
|
||||
super(joystick);
|
||||
setAxisCount(6);
|
||||
setButtonCount(14);
|
||||
setPOVCount(1);
|
||||
setAxesMaximumIndex(6);
|
||||
setButtonsMaximumIndex(14);
|
||||
setPOVsMaximumIndex(1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,9 +31,9 @@ public class PS4ControllerSim extends GenericHIDSim {
|
||||
@SuppressWarnings("this-escape")
|
||||
public PS4ControllerSim(int port) {
|
||||
super(port);
|
||||
setAxisCount(6);
|
||||
setButtonCount(14);
|
||||
setPOVCount(1);
|
||||
setAxesMaximumIndex(6);
|
||||
setButtonsMaximumIndex(14);
|
||||
setPOVsMaximumIndex(1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,9 +18,9 @@ public class PS5ControllerSim extends GenericHIDSim {
|
||||
@SuppressWarnings("this-escape")
|
||||
public PS5ControllerSim(PS5Controller joystick) {
|
||||
super(joystick);
|
||||
setAxisCount(6);
|
||||
setButtonCount(14);
|
||||
setPOVCount(1);
|
||||
setAxesMaximumIndex(6);
|
||||
setButtonsMaximumIndex(14);
|
||||
setPOVsMaximumIndex(1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,9 +31,9 @@ public class PS5ControllerSim extends GenericHIDSim {
|
||||
@SuppressWarnings("this-escape")
|
||||
public PS5ControllerSim(int port) {
|
||||
super(port);
|
||||
setAxisCount(6);
|
||||
setButtonCount(14);
|
||||
setPOVCount(1);
|
||||
setAxesMaximumIndex(6);
|
||||
setButtonsMaximumIndex(14);
|
||||
setPOVsMaximumIndex(1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,9 +18,9 @@ public class StadiaControllerSim extends GenericHIDSim {
|
||||
@SuppressWarnings("this-escape")
|
||||
public StadiaControllerSim(StadiaController joystick) {
|
||||
super(joystick);
|
||||
setAxisCount(4);
|
||||
setButtonCount(15);
|
||||
setPOVCount(1);
|
||||
setAxesMaximumIndex(4);
|
||||
setButtonsMaximumIndex(15);
|
||||
setPOVsMaximumIndex(1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,9 +31,9 @@ public class StadiaControllerSim extends GenericHIDSim {
|
||||
@SuppressWarnings("this-escape")
|
||||
public StadiaControllerSim(int port) {
|
||||
super(port);
|
||||
setAxisCount(4);
|
||||
setButtonCount(15);
|
||||
setPOVCount(1);
|
||||
setAxesMaximumIndex(4);
|
||||
setButtonsMaximumIndex(15);
|
||||
setPOVsMaximumIndex(1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,9 +18,9 @@ public class XboxControllerSim extends GenericHIDSim {
|
||||
@SuppressWarnings("this-escape")
|
||||
public XboxControllerSim(XboxController joystick) {
|
||||
super(joystick);
|
||||
setAxisCount(6);
|
||||
setButtonCount(10);
|
||||
setPOVCount(1);
|
||||
setAxesMaximumIndex(6);
|
||||
setButtonsMaximumIndex(10);
|
||||
setPOVsMaximumIndex(1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,9 +31,9 @@ public class XboxControllerSim extends GenericHIDSim {
|
||||
@SuppressWarnings("this-escape")
|
||||
public XboxControllerSim(int port) {
|
||||
super(port);
|
||||
setAxisCount(6);
|
||||
setButtonCount(10);
|
||||
setPOVCount(1);
|
||||
setAxesMaximumIndex(6);
|
||||
setButtonsMaximumIndex(10);
|
||||
setPOVsMaximumIndex(1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user