mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[hal] Clean up references to removed HAL features (#8695)
#7695, #7696, #7697, #7701, #7724, #7753, #7861 removed various features from the HAL, but forgot to clean up the handles, the WS API, or both. Additionally, since AnalogInput is the only remaining analog I/O, AnalogJNI was renamed to the more specific AnalogInputJNI.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.wpilib.hardware.discrete;
|
||||
|
||||
import org.wpilib.hardware.hal.AnalogJNI;
|
||||
import org.wpilib.hardware.hal.AnalogInputJNI;
|
||||
import org.wpilib.hardware.hal.HAL;
|
||||
import org.wpilib.hardware.hal.SimDevice;
|
||||
import org.wpilib.util.sendable.Sendable;
|
||||
@@ -27,10 +27,10 @@ public class AnalogInput implements Sendable, AutoCloseable {
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public AnalogInput(final int channel) {
|
||||
AnalogJNI.checkAnalogInputChannel(channel);
|
||||
AnalogInputJNI.checkAnalogInputChannel(channel);
|
||||
m_channel = channel;
|
||||
|
||||
m_port = AnalogJNI.initializeAnalogInputPort(channel);
|
||||
m_port = AnalogInputJNI.initializeAnalogInputPort(channel);
|
||||
|
||||
HAL.reportUsage("IO", channel, "AnalogInput");
|
||||
SendableRegistry.add(this, "AnalogInput", channel);
|
||||
@@ -39,7 +39,7 @@ public class AnalogInput implements Sendable, AutoCloseable {
|
||||
@Override
|
||||
public void close() {
|
||||
SendableRegistry.remove(this);
|
||||
AnalogJNI.freeAnalogInputPort(m_port);
|
||||
AnalogInputJNI.freeAnalogInputPort(m_port);
|
||||
m_port = 0;
|
||||
m_channel = 0;
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public class AnalogInput implements Sendable, AutoCloseable {
|
||||
* @return A sample straight from this channel.
|
||||
*/
|
||||
public int getValue() {
|
||||
return AnalogJNI.getAnalogValue(m_port);
|
||||
return AnalogInputJNI.getAnalogValue(m_port);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,7 +66,7 @@ public class AnalogInput implements Sendable, AutoCloseable {
|
||||
* @return A sample from the oversample and average engine for this channel.
|
||||
*/
|
||||
public int getAverageValue() {
|
||||
return AnalogJNI.getAnalogAverageValue(m_port);
|
||||
return AnalogInputJNI.getAnalogAverageValue(m_port);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,7 +76,7 @@ public class AnalogInput implements Sendable, AutoCloseable {
|
||||
* @return A scaled sample straight from this channel.
|
||||
*/
|
||||
public double getVoltage() {
|
||||
return AnalogJNI.getAnalogVoltage(m_port);
|
||||
return AnalogInputJNI.getAnalogVoltage(m_port);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +89,7 @@ public class AnalogInput implements Sendable, AutoCloseable {
|
||||
* @return A scaled sample from the output of the oversample and average engine for this channel.
|
||||
*/
|
||||
public double getAverageVoltage() {
|
||||
return AnalogJNI.getAnalogAverageVoltage(m_port);
|
||||
return AnalogInputJNI.getAnalogAverageVoltage(m_port);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,7 +101,7 @@ public class AnalogInput implements Sendable, AutoCloseable {
|
||||
* @return Least significant bit weight.
|
||||
*/
|
||||
public long getLSBWeight() {
|
||||
return AnalogJNI.getAnalogLSBWeight(m_port);
|
||||
return AnalogInputJNI.getAnalogLSBWeight(m_port);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,7 +113,7 @@ public class AnalogInput implements Sendable, AutoCloseable {
|
||||
* @return Offset constant.
|
||||
*/
|
||||
public int getOffset() {
|
||||
return AnalogJNI.getAnalogOffset(m_port);
|
||||
return AnalogInputJNI.getAnalogOffset(m_port);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,7 +132,7 @@ public class AnalogInput implements Sendable, AutoCloseable {
|
||||
* @param bits The number of averaging bits.
|
||||
*/
|
||||
public void setAverageBits(final int bits) {
|
||||
AnalogJNI.setAnalogAverageBits(m_port, bits);
|
||||
AnalogInputJNI.setAnalogAverageBits(m_port, bits);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,7 +142,7 @@ public class AnalogInput implements Sendable, AutoCloseable {
|
||||
* @return The number of averaging bits.
|
||||
*/
|
||||
public int getAverageBits() {
|
||||
return AnalogJNI.getAnalogAverageBits(m_port);
|
||||
return AnalogInputJNI.getAnalogAverageBits(m_port);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,7 +152,7 @@ public class AnalogInput implements Sendable, AutoCloseable {
|
||||
* @param bits The number of oversample bits.
|
||||
*/
|
||||
public void setOversampleBits(final int bits) {
|
||||
AnalogJNI.setAnalogOversampleBits(m_port, bits);
|
||||
AnalogInputJNI.setAnalogOversampleBits(m_port, bits);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,7 +163,7 @@ public class AnalogInput implements Sendable, AutoCloseable {
|
||||
* @return The number of oversample bits.
|
||||
*/
|
||||
public int getOversampleBits() {
|
||||
return AnalogJNI.getAnalogOversampleBits(m_port);
|
||||
return AnalogInputJNI.getAnalogOversampleBits(m_port);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,7 +175,7 @@ public class AnalogInput implements Sendable, AutoCloseable {
|
||||
* @param samplesPerSecond The number of samples per second.
|
||||
*/
|
||||
public static void setGlobalSampleRate(final double samplesPerSecond) {
|
||||
AnalogJNI.setAnalogSampleRate(samplesPerSecond);
|
||||
AnalogInputJNI.setAnalogSampleRate(samplesPerSecond);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,7 +186,7 @@ public class AnalogInput implements Sendable, AutoCloseable {
|
||||
* @return Sample rate.
|
||||
*/
|
||||
public static double getGlobalSampleRate() {
|
||||
return AnalogJNI.getAnalogSampleRate();
|
||||
return AnalogInputJNI.getAnalogSampleRate();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,7 +195,7 @@ public class AnalogInput implements Sendable, AutoCloseable {
|
||||
* @param device simulated device handle
|
||||
*/
|
||||
public void setSimDevice(SimDevice device) {
|
||||
AnalogJNI.setAnalogInputSimDevice(m_port, device.getNativeHandle());
|
||||
AnalogInputJNI.setAnalogInputSimDevice(m_port, device.getNativeHandle());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,10 +14,7 @@ import org.wpilib.util.sendable.SendableRegistry;
|
||||
* Class to read a duty cycle PWM input.
|
||||
*
|
||||
* <p>PWM input signals are specified with a frequency and a ratio of high to low in that frequency.
|
||||
* There are 8 of these in the roboRIO, and they can be attached to any SmartIO Channel.
|
||||
*
|
||||
* <p>These can be combined as the input of an AnalogTrigger to a Counter in order to implement
|
||||
* rollover checking.
|
||||
* These can be attached to any SmartIO.
|
||||
*/
|
||||
public class DutyCycle implements Sendable, AutoCloseable {
|
||||
// Explicitly package private
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package org.wpilib.system;
|
||||
|
||||
import org.wpilib.hardware.hal.AnalogJNI;
|
||||
import org.wpilib.hardware.hal.AnalogInputJNI;
|
||||
import org.wpilib.hardware.hal.ConstantsJNI;
|
||||
import org.wpilib.hardware.hal.DIOJNI;
|
||||
import org.wpilib.hardware.hal.PWMJNI;
|
||||
@@ -87,7 +87,7 @@ public final class SensorUtil {
|
||||
* @param channel The channel number to check.
|
||||
*/
|
||||
public static void checkAnalogInputChannel(final int channel) {
|
||||
if (!AnalogJNI.checkAnalogInputChannel(channel)) {
|
||||
if (!AnalogInputJNI.checkAnalogInputChannel(channel)) {
|
||||
String buf =
|
||||
"Requested analog input channel is out of range. Minimum: 0, Maximum: "
|
||||
+ kAnalogInputChannels
|
||||
|
||||
Reference in New Issue
Block a user