mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
Added Joystick::GetAxisType() (#98)
This commit is contained in:
committed by
Peter Johnson
parent
62a980d3c8
commit
6ef4745d86
@@ -436,6 +436,25 @@ public class DriverStation implements RobotState.Interface {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the types of Axes on a given joystick port.
|
||||
*
|
||||
* @param stick The joystick port number
|
||||
* @param axis The target axis
|
||||
* @return What type of axis the axis is reporting to be
|
||||
*/
|
||||
public int getJoystickAxisType(int stick, int axis) {
|
||||
if (stick < 0 || stick >= kJoystickPorts) {
|
||||
throw new RuntimeException("Joystick index is out of range, should be 0-5");
|
||||
}
|
||||
|
||||
int retVal = -1;
|
||||
synchronized (m_joystickMutex) {
|
||||
retVal = HAL.getJoystickAxisType((byte) stick, (byte) axis);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a value indicating whether the Driver Station requires the robot to be enabled.
|
||||
*
|
||||
|
||||
@@ -387,6 +387,15 @@ public class Joystick extends GenericHID {
|
||||
return m_port;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the axis type of a joystick axis.
|
||||
*
|
||||
* @return the axis type of a joystick axis.
|
||||
*/
|
||||
public int getAxisType(int axis) {
|
||||
return m_ds.getJoystickAxisType(m_port, axis);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the rumble output for the joystick. The DS currently supports 2 rumble values, left rumble
|
||||
* and right rumble.
|
||||
|
||||
Reference in New Issue
Block a user