Added the getButtons method back that reads all the buttons at the same time

Change-Id: I0f7f35b6a70f861911166de7be3802547ff4b2eb
This commit is contained in:
Brad Miller
2014-12-18 10:57:11 -05:00
parent 786e844a9f
commit c17ba98f72
3 changed files with 34 additions and 0 deletions

View File

@@ -289,6 +289,21 @@ public class DriverStation implements RobotState.Interface {
* @param stick The joystick to read.
* @return The state of the buttons on the joystick.
*/
public synchronized int getStickButtons(final int stick) {
if(stick < 0 || stick >= kJoystickPorts) {
throw new RuntimeException("Joystick index is out of range, should be 0-3");
}
return m_joystickButtons[stick].buttons;
}
/**
* The state of one joystick button. Button indexes begin at 1.
*
* @param stick The joystick to read.
* @param button The button index, beginning at 1.
* @return The state of the joystick button.
*/
public synchronized boolean getStickButton(final int stick, byte button) {
if(stick < 0 || stick >= kJoystickPorts) {
throw new RuntimeException("Joystick index is out of range, should be 0-3");