Miscellaneous AnalogTrigger fixes

AnalogTrigger.createOutput is now public.  It was mistakenly made
package local before.

The AnalogTriggerType enum now uses the same naming convension
as other enumerations in WPILib.  There's no way that this breaks
existing code, since AnalogTrigger.createOutput wasn't public before
this commit.

Change-Id: I9a2b921a996012f61dac0e395602f8cc429d7611
This commit is contained in:
Thomas Clark
2015-01-08 00:31:36 -05:00
parent 87e1df068c
commit f21e4a9da5
4 changed files with 14 additions and 13 deletions

View File

@@ -7,16 +7,17 @@
package edu.wpi.first.wpilibj;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import edu.wpi.first.wpilibj.AnalogTriggerOutput.AnalogTriggerType;
import edu.wpi.first.wpilibj.communication.FRCNetworkCommunicationsLibrary.tResourceType;
import edu.wpi.first.wpilibj.communication.UsageReporting;
import edu.wpi.first.wpilibj.hal.AnalogJNI;
import edu.wpi.first.wpilibj.hal.HALUtil;
import edu.wpi.first.wpilibj.util.BoundaryException;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
//import com.sun.jna.Pointer;
import edu.wpi.first.wpilibj.AnalogTriggerOutput.AnalogTriggerType;
/**
* Class for creating and configuring Analog Triggers
@@ -217,7 +218,7 @@ public class AnalogTrigger {
* An enum of the type of output object to create.
* @return A pointer to a new AnalogTriggerOutput object.
*/
AnalogTriggerOutput createOutput(AnalogTriggerType type) {
public AnalogTriggerOutput createOutput(AnalogTriggerType type) {
return new AnalogTriggerOutput(this, type);
}
}

View File

@@ -7,13 +7,13 @@
package edu.wpi.first.wpilibj;
import java.nio.IntBuffer;
import edu.wpi.first.wpilibj.communication.FRCNetworkCommunicationsLibrary.tResourceType;
import edu.wpi.first.wpilibj.communication.UsageReporting;
import edu.wpi.first.wpilibj.hal.AnalogJNI;
import edu.wpi.first.wpilibj.hal.HALUtil;
import java.nio.IntBuffer;
/**
* Class to represent a specific output from an analog trigger. This class is
* used to get the current output value and also as a DigitalSource to provide
@@ -128,10 +128,10 @@ public class AnalogTriggerOutput extends DigitalSource {
* @author jonathanleitschuh
*/
public enum AnalogTriggerType{
IN_WINDOW(AnalogJNI.AnalogTriggerType.kInWindow),
STATE(AnalogJNI.AnalogTriggerType.kState),
RISING_PULSE(AnalogJNI.AnalogTriggerType.kRisingPulse),
FALLING_PULSE(AnalogJNI.AnalogTriggerType.kFallingPulse);
kInWindow(AnalogJNI.AnalogTriggerType.kInWindow),
kState(AnalogJNI.AnalogTriggerType.kState),
kRisingPulse(AnalogJNI.AnalogTriggerType.kRisingPulse),
kFallingPulse(AnalogJNI.AnalogTriggerType.kFallingPulse);
private final int value;

View File

@@ -196,7 +196,7 @@ public class Counter extends SensorBase implements CounterBase,
throw new NullPointerException("The Analog Trigger given was null");
}
initCounter(Mode.kTwoPulse);
setUpSource(trigger.createOutput(AnalogTriggerType.STATE));
setUpSource(trigger.createOutput(AnalogTriggerType.kState));
}
@Override