Class Gamepad
- All Implemented Interfaces:
HIDDevice, TelemetryLoggable
This class handles Gamepad input that comes from the Driver Station. Each time a value is requested the most recent value is returned. There is a single class instance for each controller and the mapping of ports to hardware buttons depends on the code in the Driver Station.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents an axis on an Gamepad.static enumRepresents a digital button on a Gamepad. -
Constructor Summary
ConstructorsConstructorDescriptionGamepad(int port) Construct an instance of a gamepad.Gamepad(GenericHID hid) Construct an instance of a gamepad with a GenericHID object. -
Method Summary
Modifier and TypeMethodDescriptionaxisGreaterThan(Gamepad.Axis axis, double threshold, EventLoop loop) Constructs an event instance that is true when the axis value is greater thanthreshold, attached to the given loop.axisLessThan(Gamepad.Axis axis, double threshold, EventLoop loop) Constructs an event instance that is true when the axis value is less thanthreshold, attached to the given loop.Constructs an event instance around the Back button's digital signal.button(Gamepad.Button button, EventLoop loop) Constructs an event instance around this button's digital signal.Constructs an event instance around the D-pad down button's digital signal.Constructs an event instance around the D-pad left button's digital signal.Constructs an event instance around the D-pad right button's digital signal.Constructs an event instance around the D-pad up button's digital signal.Constructs an event instance around the Face Down button's digital signal.Constructs an event instance around the Face Left button's digital signal.Constructs an event instance around the Face Right button's digital signal.Constructs an event instance around the Face Up button's digital signal.intGet the bitmask of axes for the gamepad.doublegetAxis(Gamepad.Axis axis) Get the value of the axis.booleanRead the value of the Back button on the controller.booleanWhether the Back button was pressed since the last check.booleanWhether the Back button was released since the last check.booleangetButton(Gamepad.Button button) Get the button value (starting at button 1).booleangetButtonPressed(Gamepad.Button button) Whether the button was pressed since the last check.booleangetButtonReleased(Gamepad.Button button) Whether the button was released since the last check.longFor the current gamepad, return the bitmask of available buttons.booleanRead the value of the D-pad down button on the controller.booleanWhether the D-pad down button was pressed since the last check.booleanWhether the D-pad down button was released since the last check.booleanRead the value of the D-pad left button on the controller.booleanWhether the D-pad left button was pressed since the last check.booleanWhether the D-pad left button was released since the last check.booleanRead the value of the D-pad right button on the controller.booleanWhether the D-pad right button was pressed since the last check.booleanWhether the D-pad right button was released since the last check.booleanRead the value of the D-pad up button on the controller.booleanWhether the D-pad up button was pressed since the last check.booleanWhether the D-pad up button was released since the last check.booleanRead the value of the Face Down button on the controller.booleanWhether the Face Down button was pressed since the last check.booleanWhether the Face Down button was released since the last check.booleanRead the value of the Face Left button on the controller.booleanWhether the Face Left button was pressed since the last check.booleanWhether the Face Left button was released since the last check.booleanRead the value of the Face Right button on the controller.booleanWhether the Face Right button was pressed since the last check.booleanWhether the Face Right button was released since the last check.booleanRead the value of the Face Up button on the controller.booleanWhether the Face Up button was pressed since the last check.booleanWhether the Face Up button was released since the last check.Get the type of the gamepad.booleanRead the value of the Guide button on the controller.booleanWhether the Guide button was pressed since the last check.booleanWhether the Guide button was released since the last check.getHID()Get the underlying GenericHID object.booleanRead the value of the right bumper button on the controller.booleanWhether the right bumper button was pressed since the last check.booleanWhether the right bumper button was released since the last check.booleanRead the value of the Left Paddle 1 button on the controller.booleanWhether the Left Paddle 1 button was pressed since the last check.booleanWhether the Left Paddle 1 button was released since the last check.booleanRead the value of the Left Paddle 2 button on the controller.booleanWhether the Left Paddle 2 button was pressed since the last check.booleanWhether the Left Paddle 2 button was released since the last check.booleanRead the value of the left stick button on the controller.booleanWhether the left stick button was pressed since the last check.booleanWhether the left stick button was released since the last check.doubleGet the left trigger value of the controller.doublegetLeftX()Get the X axis value of left side of the controller.doublegetLeftY()Get the Y axis value of left side of the controller.booleanRead the value of the Miscellaneous 1 button on the controller.booleanWhether the Miscellaneous 1 button was pressed since the last check.booleanWhether the Miscellaneous 1 button was released since the last check.booleanRead the value of the Miscellaneous 2 button on the controller.booleanWhether the Miscellaneous 2 button was pressed since the last check.booleanWhether the Miscellaneous 2 button was released since the last check.booleanRead the value of the Miscellaneous 3 button on the controller.booleanWhether the Miscellaneous 3 button was pressed since the last check.booleanWhether the Miscellaneous 3 button was released since the last check.booleanRead the value of the Miscellaneous 4 button on the controller.booleanWhether the Miscellaneous 4 button was pressed since the last check.booleanWhether the Miscellaneous 4 button was released since the last check.booleanRead the value of the Miscellaneous 5 button on the controller.booleanWhether the Miscellaneous 5 button was pressed since the last check.booleanWhether the Miscellaneous 5 button was released since the last check.booleanRead the value of the Miscellaneous 6 button on the controller.booleanWhether the Miscellaneous 6 button was pressed since the last check.booleanWhether the Miscellaneous 6 button was released since the last check.getName()Get the name of the gamepad.booleanRead the value of the right bumper button on the controller.booleanWhether the right bumper button was pressed since the last check.booleanWhether the right bumper button was released since the last check.booleanRead the value of the Right Paddle 1 button on the controller.booleanWhether the Right Paddle 1 button was pressed since the last check.booleanWhether the Right Paddle 1 button was released since the last check.booleanRead the value of the Right Paddle 2 button on the controller.booleanWhether the Right Paddle 2 button was pressed since the last check.booleanWhether the Right Paddle 2 button was released since the last check.booleanRead the value of the right stick button on the controller.booleanWhether the right stick button was pressed since the last check.booleanWhether the right stick button was released since the last check.doubleGet the right trigger value of the controller.doubleGet the X axis value of right side of the controller.doubleGet the Y axis value of right side of the controller.booleanRead the value of the Start button on the controller.booleanWhether the Start button was pressed since the last check.booleanWhether the Start button was released since the last check.Get the supported outputs for the gamepad.Gets the telemetry table type.booleanRead the value of the Touchpad button on the controller.booleanWhether the Touchpad button was pressed since the last check.booleanWhether the Touchpad button was released since the last check.getTouchpadFinger(int touchpad, int finger) Get the touchpad finger data.booleangetTouchpadFingerAvailable(int touchpad, int finger) Check if a touchpad finger is available.Constructs an event instance around the Guide button's digital signal.booleanGet if the gamepad is connected.leftBumper(EventLoop loop) Constructs an event instance around the right bumper button's digital signal.leftPaddle1(EventLoop loop) Constructs an event instance around the Left Paddle 1 button's digital signal.leftPaddle2(EventLoop loop) Constructs an event instance around the Left Paddle 2 button's digital signal.Constructs an event instance around the left stick button's digital signal.leftTrigger(double threshold, EventLoop loop) Constructs an event instance around the axis value of the left trigger.leftTrigger(EventLoop loop) Constructs an event instance around the axis value of the left trigger.voidlogTo(TelemetryTable table) Logs the object to aTelemetryTable.Constructs an event instance around the Miscellaneous 1 button's digital signal.Constructs an event instance around the Miscellaneous 2 button's digital signal.Constructs an event instance around the Miscellaneous 3 button's digital signal.Constructs an event instance around the Miscellaneous 4 button's digital signal.Constructs an event instance around the Miscellaneous 5 button's digital signal.Constructs an event instance around the Miscellaneous 6 button's digital signal.rightBumper(EventLoop loop) Constructs an event instance around the right bumper button's digital signal.rightPaddle1(EventLoop loop) Constructs an event instance around the Right Paddle 1 button's digital signal.rightPaddle2(EventLoop loop) Constructs an event instance around the Right Paddle 2 button's digital signal.rightStick(EventLoop loop) Constructs an event instance around the right stick button's digital signal.rightTrigger(double threshold, EventLoop loop) Constructs an event instance around the axis value of the right trigger.rightTrigger(EventLoop loop) Constructs an event instance around the axis value of the right trigger.voidsetLeds(int r, int g, int b) Set leds on the gamepad.voidsetLeftTriggerDeadband(double deadband) Set the deadband for the left trigger axis.voidsetLeftXDeadband(double deadband) Set the deadband for the left X axis.voidsetLeftYDeadband(double deadband) Set the deadband for the left Y axis.voidsetRightTriggerDeadband(double deadband) Set the deadband for the right trigger axis.voidsetRightXDeadband(double deadband) Set the deadband for the right X axis.voidsetRightYDeadband(double deadband) Set the deadband for the right Y axis.voidsetRumble(GenericHID.RumbleType type, double value) Set the rumble output for the HID.Constructs an event instance around the Start button's digital signal.Constructs an event instance around the Touchpad button's digital signal.
-
Constructor Details
-
Gamepad
public Gamepad(int port) Construct an instance of a gamepad.- Parameters:
port- The port index on the Driver Station that the gamepad is plugged into (0-5).
-
Gamepad
Construct an instance of a gamepad with a GenericHID object.- Parameters:
hid- The GenericHID object to use for this gamepad.
-
-
Method Details
-
getHID
Get the underlying GenericHID object. -
setLeftXDeadband
public void setLeftXDeadband(double deadband) Set the deadband for the left X axis.The deadband is clamped to [0, 1).
- Parameters:
deadband- The deadband to apply.
-
setLeftYDeadband
public void setLeftYDeadband(double deadband) Set the deadband for the left Y axis.The deadband is clamped to [0, 1).
- Parameters:
deadband- The deadband to apply.
-
setRightXDeadband
public void setRightXDeadband(double deadband) Set the deadband for the right X axis.The deadband is clamped to [0, 1).
- Parameters:
deadband- The deadband to apply.
-
setRightYDeadband
public void setRightYDeadband(double deadband) Set the deadband for the right Y axis.The deadband is clamped to [0, 1).
- Parameters:
deadband- The deadband to apply.
-
setLeftTriggerDeadband
public void setLeftTriggerDeadband(double deadband) Set the deadband for the left trigger axis.The deadband is clamped to [0, 1).
- Parameters:
deadband- The deadband to apply.
-
setRightTriggerDeadband
public void setRightTriggerDeadband(double deadband) Set the deadband for the right trigger axis.The deadband is clamped to [0, 1).
- Parameters:
deadband- The deadband to apply.
-
getLeftX
public double getLeftX()Get the X axis value of left side of the controller. Right is positive.A deadband of 0.1 is applied by default. Use
setLeftXDeadband(double)to change it.- Returns:
- The axis value.
-
getLeftY
public double getLeftY()Get the Y axis value of left side of the controller. Back is positive.A deadband of 0.1 is applied by default. Use
setLeftYDeadband(double)to change it.- Returns:
- The axis value.
-
getRightX
public double getRightX()Get the X axis value of right side of the controller. Right is positive.A deadband of 0.1 is applied by default. Use
setRightXDeadband(double)to change it.- Returns:
- The axis value.
-
getRightY
public double getRightY()Get the Y axis value of right side of the controller. Back is positive.A deadband of 0.1 is applied by default. Use
setRightYDeadband(double)to change it.- Returns:
- The axis value.
-
getLeftTrigger
public double getLeftTrigger()Get the left trigger value of the controller. Note that this axis is bound to the range of [0, 1] as opposed to the usual [-1, 1].A deadband of 0.01 is applied by default. Use
setLeftTriggerDeadband(double)to change it.- Returns:
- The axis value.
-
leftTrigger
Constructs an event instance around the axis value of the left trigger. The returned trigger will be true when the axis value is greater thanthreshold.- Parameters:
threshold- the minimum axis value for the returnedBooleanEventto be true. This value should be in the range [0, 1] where 0 is the unpressed state of the axis.loop- the event loop instance to attach the event to.- Returns:
- an event instance that is true when the left trigger's axis exceeds the provided threshold, attached to the given event loop
-
leftTrigger
Constructs an event instance around the axis value of the left trigger. The returned trigger will be true when the axis value is greater than 0.5.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance that is true when the left trigger's axis exceeds the provided threshold, attached to the given event loop
-
getRightTrigger
public double getRightTrigger()Get the right trigger value of the controller. Note that this axis is bound to the range of [0, 1] as opposed to the usual [-1, 1].A deadband of 0.01 is applied by default. Use
setRightTriggerDeadband(double)to change it.- Returns:
- The axis value.
-
rightTrigger
Constructs an event instance around the axis value of the right trigger. The returned trigger will be true when the axis value is greater thanthreshold.- Parameters:
threshold- the minimum axis value for the returnedBooleanEventto be true. This value should be in the range [0, 1] where 0 is the unpressed state of the axis.loop- the event loop instance to attach the event to.- Returns:
- an event instance that is true when the right trigger's axis exceeds the provided threshold, attached to the given event loop
-
rightTrigger
Constructs an event instance around the axis value of the right trigger. The returned trigger will be true when the axis value is greater than 0.5.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance that is true when the right trigger's axis exceeds the provided threshold, attached to the given event loop
-
getFaceDownButton
public boolean getFaceDownButton()Read the value of the Face Down button on the controller.- Returns:
- The state of the button.
-
getFaceDownButtonPressed
public boolean getFaceDownButtonPressed()Whether the Face Down button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getFaceDownButtonReleased
public boolean getFaceDownButtonReleased()Whether the Face Down button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
faceDown
Constructs an event instance around the Face Down button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the Face Down button's digital signal attached to the given loop.
-
getFaceRightButton
public boolean getFaceRightButton()Read the value of the Face Right button on the controller.- Returns:
- The state of the button.
-
getFaceRightButtonPressed
public boolean getFaceRightButtonPressed()Whether the Face Right button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getFaceRightButtonReleased
public boolean getFaceRightButtonReleased()Whether the Face Right button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
faceRight
Constructs an event instance around the Face Right button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the Face Right button's digital signal attached to the given loop.
-
getFaceLeftButton
public boolean getFaceLeftButton()Read the value of the Face Left button on the controller.- Returns:
- The state of the button.
-
getFaceLeftButtonPressed
public boolean getFaceLeftButtonPressed()Whether the Face Left button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getFaceLeftButtonReleased
public boolean getFaceLeftButtonReleased()Whether the Face Left button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
faceLeft
Constructs an event instance around the Face Left button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the Face Left button's digital signal attached to the given loop.
-
getFaceUpButton
public boolean getFaceUpButton()Read the value of the Face Up button on the controller.- Returns:
- The state of the button.
-
getFaceUpButtonPressed
public boolean getFaceUpButtonPressed()Whether the Face Up button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getFaceUpButtonReleased
public boolean getFaceUpButtonReleased()Whether the Face Up button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
faceUp
Constructs an event instance around the Face Up button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the Face Up button's digital signal attached to the given loop.
-
getBackButton
public boolean getBackButton()Read the value of the Back button on the controller.- Returns:
- The state of the button.
-
getBackButtonPressed
public boolean getBackButtonPressed()Whether the Back button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getBackButtonReleased
public boolean getBackButtonReleased()Whether the Back button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
back
Constructs an event instance around the Back button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the Back button's digital signal attached to the given loop.
-
getGuideButton
public boolean getGuideButton()Read the value of the Guide button on the controller.- Returns:
- The state of the button.
-
getGuideButtonPressed
public boolean getGuideButtonPressed()Whether the Guide button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getGuideButtonReleased
public boolean getGuideButtonReleased()Whether the Guide button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
guide
Constructs an event instance around the Guide button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the Guide button's digital signal attached to the given loop.
-
getStartButton
public boolean getStartButton()Read the value of the Start button on the controller.- Returns:
- The state of the button.
-
getStartButtonPressed
public boolean getStartButtonPressed()Whether the Start button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getStartButtonReleased
public boolean getStartButtonReleased()Whether the Start button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
start
Constructs an event instance around the Start button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the Start button's digital signal attached to the given loop.
-
getLeftStickButton
public boolean getLeftStickButton()Read the value of the left stick button on the controller.- Returns:
- The state of the button.
-
getLeftStickButtonPressed
public boolean getLeftStickButtonPressed()Whether the left stick button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getLeftStickButtonReleased
public boolean getLeftStickButtonReleased()Whether the left stick button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
leftStick
Constructs an event instance around the left stick button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the left stick button's digital signal attached to the given loop.
-
getRightStickButton
public boolean getRightStickButton()Read the value of the right stick button on the controller.- Returns:
- The state of the button.
-
getRightStickButtonPressed
public boolean getRightStickButtonPressed()Whether the right stick button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getRightStickButtonReleased
public boolean getRightStickButtonReleased()Whether the right stick button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
rightStick
Constructs an event instance around the right stick button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the right stick button's digital signal attached to the given loop.
-
getLeftBumperButton
public boolean getLeftBumperButton()Read the value of the right bumper button on the controller.- Returns:
- The state of the button.
-
getLeftBumperButtonPressed
public boolean getLeftBumperButtonPressed()Whether the right bumper button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getLeftBumperButtonReleased
public boolean getLeftBumperButtonReleased()Whether the right bumper button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
leftBumper
Constructs an event instance around the right bumper button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the right bumper button's digital signal attached to the given loop.
-
getRightBumperButton
public boolean getRightBumperButton()Read the value of the right bumper button on the controller.- Returns:
- The state of the button.
-
getRightBumperButtonPressed
public boolean getRightBumperButtonPressed()Whether the right bumper button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getRightBumperButtonReleased
public boolean getRightBumperButtonReleased()Whether the right bumper button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
rightBumper
Constructs an event instance around the right bumper button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the right bumper button's digital signal attached to the given loop.
-
getDpadUpButton
public boolean getDpadUpButton()Read the value of the D-pad up button on the controller.- Returns:
- The state of the button.
-
getDpadUpButtonPressed
public boolean getDpadUpButtonPressed()Whether the D-pad up button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getDpadUpButtonReleased
public boolean getDpadUpButtonReleased()Whether the D-pad up button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
dpadUp
Constructs an event instance around the D-pad up button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the D-pad up button's digital signal attached to the given loop.
-
getDpadDownButton
public boolean getDpadDownButton()Read the value of the D-pad down button on the controller.- Returns:
- The state of the button.
-
getDpadDownButtonPressed
public boolean getDpadDownButtonPressed()Whether the D-pad down button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getDpadDownButtonReleased
public boolean getDpadDownButtonReleased()Whether the D-pad down button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
dpadDown
Constructs an event instance around the D-pad down button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the D-pad down button's digital signal attached to the given loop.
-
getDpadLeftButton
public boolean getDpadLeftButton()Read the value of the D-pad left button on the controller.- Returns:
- The state of the button.
-
getDpadLeftButtonPressed
public boolean getDpadLeftButtonPressed()Whether the D-pad left button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getDpadLeftButtonReleased
public boolean getDpadLeftButtonReleased()Whether the D-pad left button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
dpadLeft
Constructs an event instance around the D-pad left button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the D-pad left button's digital signal attached to the given loop.
-
getDpadRightButton
public boolean getDpadRightButton()Read the value of the D-pad right button on the controller.- Returns:
- The state of the button.
-
getDpadRightButtonPressed
public boolean getDpadRightButtonPressed()Whether the D-pad right button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getDpadRightButtonReleased
public boolean getDpadRightButtonReleased()Whether the D-pad right button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
dpadRight
Constructs an event instance around the D-pad right button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the D-pad right button's digital signal attached to the given loop.
-
getMisc1Button
public boolean getMisc1Button()Read the value of the Miscellaneous 1 button on the controller.- Returns:
- The state of the button.
-
getMisc1ButtonPressed
public boolean getMisc1ButtonPressed()Whether the Miscellaneous 1 button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getMisc1ButtonReleased
public boolean getMisc1ButtonReleased()Whether the Miscellaneous 1 button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
misc1
Constructs an event instance around the Miscellaneous 1 button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the Miscellaneous 1 button's digital signal attached to the given loop.
-
getRightPaddle1Button
public boolean getRightPaddle1Button()Read the value of the Right Paddle 1 button on the controller.- Returns:
- The state of the button.
-
getRightPaddle1ButtonPressed
public boolean getRightPaddle1ButtonPressed()Whether the Right Paddle 1 button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getRightPaddle1ButtonReleased
public boolean getRightPaddle1ButtonReleased()Whether the Right Paddle 1 button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
rightPaddle1
Constructs an event instance around the Right Paddle 1 button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the Right Paddle 1 button's digital signal attached to the given loop.
-
getLeftPaddle1Button
public boolean getLeftPaddle1Button()Read the value of the Left Paddle 1 button on the controller.- Returns:
- The state of the button.
-
getLeftPaddle1ButtonPressed
public boolean getLeftPaddle1ButtonPressed()Whether the Left Paddle 1 button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getLeftPaddle1ButtonReleased
public boolean getLeftPaddle1ButtonReleased()Whether the Left Paddle 1 button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
leftPaddle1
Constructs an event instance around the Left Paddle 1 button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the Left Paddle 1 button's digital signal attached to the given loop.
-
getRightPaddle2Button
public boolean getRightPaddle2Button()Read the value of the Right Paddle 2 button on the controller.- Returns:
- The state of the button.
-
getRightPaddle2ButtonPressed
public boolean getRightPaddle2ButtonPressed()Whether the Right Paddle 2 button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getRightPaddle2ButtonReleased
public boolean getRightPaddle2ButtonReleased()Whether the Right Paddle 2 button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
rightPaddle2
Constructs an event instance around the Right Paddle 2 button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the Right Paddle 2 button's digital signal attached to the given loop.
-
getLeftPaddle2Button
public boolean getLeftPaddle2Button()Read the value of the Left Paddle 2 button on the controller.- Returns:
- The state of the button.
-
getLeftPaddle2ButtonPressed
public boolean getLeftPaddle2ButtonPressed()Whether the Left Paddle 2 button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getLeftPaddle2ButtonReleased
public boolean getLeftPaddle2ButtonReleased()Whether the Left Paddle 2 button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
leftPaddle2
Constructs an event instance around the Left Paddle 2 button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the Left Paddle 2 button's digital signal attached to the given loop.
-
getTouchpadButton
public boolean getTouchpadButton()Read the value of the Touchpad button on the controller.- Returns:
- The state of the button.
-
getTouchpadButtonPressed
public boolean getTouchpadButtonPressed()Whether the Touchpad button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getTouchpadButtonReleased
public boolean getTouchpadButtonReleased()Whether the Touchpad button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
touchpad
Constructs an event instance around the Touchpad button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the Touchpad button's digital signal attached to the given loop.
-
getMisc2Button
public boolean getMisc2Button()Read the value of the Miscellaneous 2 button on the controller.- Returns:
- The state of the button.
-
getMisc2ButtonPressed
public boolean getMisc2ButtonPressed()Whether the Miscellaneous 2 button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getMisc2ButtonReleased
public boolean getMisc2ButtonReleased()Whether the Miscellaneous 2 button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
misc2
Constructs an event instance around the Miscellaneous 2 button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the Miscellaneous 2 button's digital signal attached to the given loop.
-
getMisc3Button
public boolean getMisc3Button()Read the value of the Miscellaneous 3 button on the controller.- Returns:
- The state of the button.
-
getMisc3ButtonPressed
public boolean getMisc3ButtonPressed()Whether the Miscellaneous 3 button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getMisc3ButtonReleased
public boolean getMisc3ButtonReleased()Whether the Miscellaneous 3 button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
misc3
Constructs an event instance around the Miscellaneous 3 button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the Miscellaneous 3 button's digital signal attached to the given loop.
-
getMisc4Button
public boolean getMisc4Button()Read the value of the Miscellaneous 4 button on the controller.- Returns:
- The state of the button.
-
getMisc4ButtonPressed
public boolean getMisc4ButtonPressed()Whether the Miscellaneous 4 button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getMisc4ButtonReleased
public boolean getMisc4ButtonReleased()Whether the Miscellaneous 4 button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
misc4
Constructs an event instance around the Miscellaneous 4 button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the Miscellaneous 4 button's digital signal attached to the given loop.
-
getMisc5Button
public boolean getMisc5Button()Read the value of the Miscellaneous 5 button on the controller.- Returns:
- The state of the button.
-
getMisc5ButtonPressed
public boolean getMisc5ButtonPressed()Whether the Miscellaneous 5 button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getMisc5ButtonReleased
public boolean getMisc5ButtonReleased()Whether the Miscellaneous 5 button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
misc5
Constructs an event instance around the Miscellaneous 5 button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the Miscellaneous 5 button's digital signal attached to the given loop.
-
getMisc6Button
public boolean getMisc6Button()Read the value of the Miscellaneous 6 button on the controller.- Returns:
- The state of the button.
-
getMisc6ButtonPressed
public boolean getMisc6ButtonPressed()Whether the Miscellaneous 6 button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getMisc6ButtonReleased
public boolean getMisc6ButtonReleased()Whether the Miscellaneous 6 button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
misc6
Constructs an event instance around the Miscellaneous 6 button's digital signal.- Parameters:
loop- the event loop instance to attach the event to.- Returns:
- an event instance representing the Miscellaneous 6 button's digital signal attached to the given loop.
-
getButton
Get the button value (starting at button 1).This method returns true if the button is being held down at the time that this method is being called.
- Parameters:
button- The button- Returns:
- The state of the button.
-
getButtonPressed
Whether the button was pressed since the last check.This method returns true if the button went from not pressed to held down since the last time this method was called. This is useful if you only want to call a function once when you press the button.
- Parameters:
button- The button- Returns:
- Whether the button was pressed since the last check.
-
getButtonReleased
Whether the button was released since the last check.This method returns true if the button went from held down to not pressed since the last time this method was called. This is useful if you only want to call a function once when you release the button.
- Parameters:
button- The button- Returns:
- Whether the button was released since the last check.
-
button
Constructs an event instance around this button's digital signal.- Parameters:
button- the buttonloop- the event loop instance to attach the event to.- Returns:
- an event instance representing the button's digital signal attached to the given loop.
-
getAxis
Get the value of the axis.- Parameters:
axis- The axis to read- Returns:
- The value of the axis.
-
axisLessThan
Constructs an event instance that is true when the axis value is less thanthreshold, attached to the given loop.- Parameters:
axis- The axis to read, starting at 0threshold- The value below which this event should return true.loop- the event loop instance to attach the event to.- Returns:
- an event instance that is true when the axis value is less than the provided threshold.
-
axisGreaterThan
Constructs an event instance that is true when the axis value is greater thanthreshold, attached to the given loop.- Parameters:
axis- The axis to read, starting at 0threshold- The value above which this event should return true.loop- the event loop instance to attach the event to.- Returns:
- an event instance that is true when the axis value is greater than the provided threshold.
-
getAxesAvailable
public int getAxesAvailable()Get the bitmask of axes for the gamepad.- Returns:
- the number of axis for the current gamepad
-
getButtonsAvailable
public long getButtonsAvailable()For the current gamepad, return the bitmask of available buttons.- Returns:
- the bitmask of buttons for the current gamepad
-
isConnected
public boolean isConnected()Get if the gamepad is connected.- Returns:
- true if the gamepad is connected
-
getGamepadType
Get the type of the gamepad.- Returns:
- the type of the gamepad.
-
getSupportedOutputs
Get the supported outputs for the gamepad.- Returns:
- the supported outputs for the gamepad.
-
getName
-
setLeds
public void setLeds(int r, int g, int b) Set leds on the gamepad. If only mono is supported, the system will use the highest value passed in.- Parameters:
r- Red value from 0-255g- Green value from 0-255b- Blue value from 0-255
-
setRumble
Set the rumble output for the HID. The DS currently supports 4 rumble values: left rumble, right rumble, left trigger rumble, and right trigger rumble.- Parameters:
type- Which rumble value to setvalue- The normalized value (0 to 1) to set the rumble to
-
getTouchpadFingerAvailable
public boolean getTouchpadFingerAvailable(int touchpad, int finger) Check if a touchpad finger is available.- Parameters:
touchpad- The touchpad to check.finger- The finger to check.- Returns:
- true if the touchpad finger is available.
-
getTouchpadFinger
Get the touchpad finger data.- Parameters:
touchpad- The touchpad to read.finger- The finger to read.- Returns:
- The touchpad finger data.
-
logTo
Description copied from interface:TelemetryLoggableLogs the object to aTelemetryTable.- Specified by:
logToin interfaceTelemetryLoggable- Parameters:
table- telemetry table
-
getTelemetryType
Description copied from interface:TelemetryLoggableGets the telemetry table type. Default is no specified table type (null). A mismatch in type during logging results in a reported warning, so this should always return the same value.- Specified by:
getTelemetryTypein interfaceTelemetryLoggable- Returns:
- Table type
-