mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
Renamed "pin" to "channel" and variables with underscores now use mixed case (#194)
This commit is contained in:
committed by
Peter Johnson
parent
227fdc1a60
commit
45b8e9ab4f
@@ -21,12 +21,12 @@ import static java.util.Objects.requireNonNull;
|
||||
|
||||
/**
|
||||
* Class for VEX Robotics Spike style relay outputs. Relays are intended to be connected to Spikes
|
||||
* or similar relays. The relay channels controls a pair of pins that are either both off, one on,
|
||||
* the other on, or both on. This translates into two Spike outputs at 0v, one at 12v and one at 0v,
|
||||
* one at 0v and the other at 12v, or two Spike outputs at 12V. This allows off, full forward, or
|
||||
* full reverse control of motors without variable speed. It also allows the two channels (forward
|
||||
* and reverse) to be used independently for something that does not care about voltage polarity
|
||||
* (like a solenoid).
|
||||
* or similar relays. The relay channels controls a pair of channels that are either both off, one
|
||||
* on, the other on, or both on. This translates into two Spike outputs at 0v, one at 12v and one
|
||||
* at 0v, one at 0v and the other at 12v, or two Spike outputs at 12V. This allows off, full
|
||||
* forward, or full reverse control of motors without variable speed. It also allows the two
|
||||
* channels (forward and reverse) to be used independently for something that does not care about
|
||||
* voltage polarity (like a solenoid).
|
||||
*/
|
||||
public class Relay extends SensorBase implements MotorSafety, LiveWindowSendable {
|
||||
private MotorSafetyHelper m_safetyHelper;
|
||||
|
||||
@@ -29,7 +29,7 @@ public abstract class SensorBase { // TODO: Refactor
|
||||
/**
|
||||
* Number of digital channels per roboRIO.
|
||||
*/
|
||||
public static final int kDigitalChannels = PortsJNI.getNumDigitalPins();
|
||||
public static final int kDigitalChannels = PortsJNI.getNumDigitalChannels();
|
||||
/**
|
||||
* Number of analog input channels.
|
||||
*/
|
||||
@@ -41,11 +41,11 @@ public abstract class SensorBase { // TODO: Refactor
|
||||
/**
|
||||
* Number of solenoid channels per module.
|
||||
*/
|
||||
public static final int kSolenoidChannels = PortsJNI.getNumSolenoidPins();
|
||||
public static final int kSolenoidChannels = PortsJNI.getNumSolenoidChannels();
|
||||
/**
|
||||
* Number of PWM channels per roboRIO.
|
||||
*/
|
||||
public static final int kPwmChannels = PortsJNI.getNumPWMPins();
|
||||
public static final int kPwmChannels = PortsJNI.getNumPWMChannels();
|
||||
/**
|
||||
* Number of relay channels per roboRIO.
|
||||
*/
|
||||
|
||||
@@ -83,9 +83,8 @@ public class Ultrasonic extends SensorBase implements PIDSource, LiveWindowSenda
|
||||
return;
|
||||
}
|
||||
if (ultrasonic.isEnabled()) {
|
||||
ultrasonic.m_pingChannel.pulse(m_pingChannel.getChannel(), (float) kPingTime); // do
|
||||
// the
|
||||
// ping
|
||||
// Do the ping
|
||||
ultrasonic.m_pingChannel.pulse(m_pingChannel.getChannel(), (float) kPingTime);
|
||||
}
|
||||
ultrasonic = ultrasonic.m_nextSensor;
|
||||
Timer.delay(.1); // wait for ping to return
|
||||
|
||||
@@ -43,9 +43,9 @@ public class AnalogJNI extends JNIWrapper {
|
||||
|
||||
public static native boolean checkAnalogModule(byte module);
|
||||
|
||||
public static native boolean checkAnalogInputChannel(int pin);
|
||||
public static native boolean checkAnalogInputChannel(int channel);
|
||||
|
||||
public static native boolean checkAnalogOutputChannel(int pin);
|
||||
public static native boolean checkAnalogOutputChannel(int channel);
|
||||
|
||||
public static native void setAnalogOutput(int portHandle, double voltage);
|
||||
|
||||
|
||||
@@ -37,5 +37,5 @@ public class DIOJNI extends JNIWrapper {
|
||||
|
||||
public static native void setDigitalPWMDutyCycle(int pwmGenerator, double dutyCycle);
|
||||
|
||||
public static native void setDigitalPWMOutputChannel(int pwmGenerator, int pin);
|
||||
public static native void setDigitalPWMOutputChannel(int pwmGenerator, int channel);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class JNIWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
public static native int getPortWithModule(byte module, byte pin);
|
||||
public static native int getPortWithModule(byte module, byte channel);
|
||||
|
||||
public static native int getPort(byte pin);
|
||||
public static native int getPort(byte channel);
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ public class PortsJNI extends JNIWrapper {
|
||||
|
||||
public static native int getNumPWMHeaders();
|
||||
|
||||
public static native int getNumDigitalPins();
|
||||
public static native int getNumDigitalChannels();
|
||||
|
||||
public static native int getNumPWMPins();
|
||||
public static native int getNumPWMChannels();
|
||||
|
||||
public static native int getNumDigitalPWMOutputs();
|
||||
|
||||
@@ -32,13 +32,13 @@ public class PortsJNI extends JNIWrapper {
|
||||
|
||||
public static native int getNumInterrupts();
|
||||
|
||||
public static native int getNumRelayPins();
|
||||
public static native int getNumRelayChannels();
|
||||
|
||||
public static native int getNumRelayHeaders();
|
||||
|
||||
public static native int getNumPCMModules();
|
||||
|
||||
public static native int getNumSolenoidPins();
|
||||
public static native int getNumSolenoidChannels();
|
||||
|
||||
public static native int getNumPDPModules();
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public class RelayJNI extends DIOJNI {
|
||||
|
||||
public static native void freeRelayPort(int relayPortHandle);
|
||||
|
||||
public static native boolean checkRelayChannel(int pin);
|
||||
public static native boolean checkRelayChannel(int channel);
|
||||
|
||||
public static native void setRelay(int relayPortHandle, boolean on);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user