Merge "Miscellaneous AnalogTrigger fixes"

This commit is contained in:
Fred Silberberg (WPI)
2015-01-08 14:07:45 -08:00
committed by Gerrit Code Review
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