diff --git a/wpilibc/athena/include/Joystick.h b/wpilibc/athena/include/Joystick.h index 60b864a95a..5c6f1fba40 100644 --- a/wpilibc/athena/include/Joystick.h +++ b/wpilibc/athena/include/Joystick.h @@ -95,6 +95,7 @@ class Joystick : public GenericHID, public ErrorBase { bool GetIsXbox() const; Joystick::HIDType GetType() const; std::string GetName() const; + int GetPort() const; int GetAxisType(uint8_t axis) const; int GetAxisCount() const; diff --git a/wpilibc/athena/src/Joystick.cpp b/wpilibc/athena/src/Joystick.cpp index 1d3538579e..10392cabc1 100644 --- a/wpilibc/athena/src/Joystick.cpp +++ b/wpilibc/athena/src/Joystick.cpp @@ -277,6 +277,13 @@ Joystick::HIDType Joystick::GetType() const { */ std::string Joystick::GetName() const { return m_ds.GetJoystickName(m_port); } +/** + * Get the port number of the joystick. + * + * @return The port number of the joystick. + */ +int Joystick::GetPort() const { return m_port; } + // int Joystick::GetAxisType(uint8_t axis) const //{ // return m_ds.GetJoystickAxisType(m_port, axis); diff --git a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Joystick.java b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Joystick.java index 3ca2aa3769..a6259f8847 100644 --- a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Joystick.java +++ b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Joystick.java @@ -446,6 +446,15 @@ public class Joystick extends GenericHID { return m_ds.getJoystickName(m_port); } + /** + * Get the port number of the joystick. + * + * @return The port number of the joystick. + */ + public int getPort() { + return m_port; + } + /** * Set the rumble output for the joystick. The DS currently supports 2 rumble values, left rumble * and right rumble.