From 47088c0354c217b5fd78d14fd68ae502e23e19ed Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Thu, 19 Mar 2015 22:45:21 -0700 Subject: [PATCH] CANTalon: Add getter methods for soft limits. Added functions: - getForwardSoftLimit - getReverseSoftLimit - isForwardSoftLimitEnabled - isReverseSoftLimitEnabled Change-Id: I03b8f692c08c326a6ff0bfd929b7fdd5d7406a0f --- .../java/edu/wpi/first/wpilibj/CANTalon.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/wpilibj/wpilibJavaDevices/src/main/java/edu/wpi/first/wpilibj/CANTalon.java b/wpilibj/wpilibJavaDevices/src/main/java/edu/wpi/first/wpilibj/CANTalon.java index b51f48f2ef..24e0e35db3 100644 --- a/wpilibj/wpilibJavaDevices/src/main/java/edu/wpi/first/wpilibj/CANTalon.java +++ b/wpilibj/wpilibJavaDevices/src/main/java/edu/wpi/first/wpilibj/CANTalon.java @@ -812,18 +812,42 @@ public class CANTalon implements MotorSafety, PIDOutput, SpeedController { m_impl.SetForwardSoftLimit(forwardLimit); } + public int getForwardSoftLimit() { + long valuep = CanTalonJNI.new_intp(); + m_impl.GetForwardSoftLimit(new SWIGTYPE_p_int(valuep, true)); + return CanTalonJNI.intp_value(valuep); + } + public void enableForwardSoftLimit(boolean enable) { m_impl.SetForwardSoftEnable(enable ? 1 : 0); } + public boolean isForwardSoftLimitEnabled() { + long valuep = CanTalonJNI.new_intp(); + m_impl.GetForwardSoftEnable(new SWIGTYPE_p_int(valuep, true)); + return (CanTalonJNI.intp_value(valuep)==0) ? false : true; + } + public void setReverseSoftLimit(int reverseLimit) { m_impl.SetReverseSoftLimit(reverseLimit); } + public int getReverseSoftLimit() { + long valuep = CanTalonJNI.new_intp(); + m_impl.GetReverseSoftLimit(new SWIGTYPE_p_int(valuep, true)); + return CanTalonJNI.intp_value(valuep); + } + public void enableReverseSoftLimit(boolean enable) { m_impl.SetReverseSoftEnable(enable ? 1 : 0); } + public boolean isReverseSoftLimitEnabled() { + long valuep = CanTalonJNI.new_intp(); + m_impl.GetReverseSoftEnable(new SWIGTYPE_p_int(valuep, true)); + return (CanTalonJNI.intp_value(valuep)==0) ? false : true; + } + public void clearStickyFaults() { m_impl.ClearStickyFaults(); }