mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[docs] Add documentation for various HAL/wpilib items (NFC) (#6898)
This commit is contained in:
@@ -50,6 +50,7 @@ public final class CANAPITypes {
|
||||
/** Firmware update. */
|
||||
kFirmwareUpdate(31);
|
||||
|
||||
/** The device type ID. */
|
||||
@SuppressWarnings("PMD.MemberName")
|
||||
public final int id;
|
||||
|
||||
@@ -104,6 +105,7 @@ public final class CANAPITypes {
|
||||
/** Vivid-Hosting. */
|
||||
kVividHosting(16);
|
||||
|
||||
/** The manufacturer ID. */
|
||||
@SuppressWarnings("PMD.MemberName")
|
||||
public final int id;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
/** Represents a received CAN message. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public class CANData {
|
||||
/** Contents of the CAN frame. */
|
||||
|
||||
@@ -4,16 +4,21 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
/** Represents a CAN message read from a stream. */
|
||||
public class CANStreamMessage {
|
||||
/** The message data. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public final byte[] data = new byte[8];
|
||||
|
||||
/** The length of the data received (0-8 bytes). */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int length;
|
||||
|
||||
/** Timestamp message was received, in milliseconds (based off of CLOCK_MONOTONIC). */
|
||||
@SuppressWarnings("MemberName")
|
||||
public long timestamp;
|
||||
|
||||
/** The message ID. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int messageID;
|
||||
|
||||
|
||||
@@ -45,26 +45,56 @@ public class ControlWord {
|
||||
m_dsAttached = word.m_dsAttached;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Enabled flag.
|
||||
*
|
||||
* @return the Enabled flag
|
||||
*/
|
||||
public boolean getEnabled() {
|
||||
return m_enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Autonomous mode flag.
|
||||
*
|
||||
* @return the Autonomous mode flag
|
||||
*/
|
||||
public boolean getAutonomous() {
|
||||
return m_autonomous;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Test mode flag.
|
||||
*
|
||||
* @return the Test mode flag
|
||||
*/
|
||||
public boolean getTest() {
|
||||
return m_test;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the E-Stop flag.
|
||||
*
|
||||
* @return the E-Stop flag
|
||||
*/
|
||||
public boolean getEStop() {
|
||||
return m_emergencyStop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the FMS attached flag.
|
||||
*
|
||||
* @return the FMS attached flag
|
||||
*/
|
||||
public boolean getFMSAttached() {
|
||||
return m_fmsAttached;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the DS attached flag.
|
||||
*
|
||||
* @return the DS attached flag
|
||||
*/
|
||||
public boolean getDSAttached() {
|
||||
return m_dsAttached;
|
||||
}
|
||||
|
||||
@@ -12,9 +12,16 @@ import java.nio.IntBuffer;
|
||||
* @see "hal/Counter.h"
|
||||
*/
|
||||
public class CounterJNI extends JNIWrapper {
|
||||
/** Two pulse mode. */
|
||||
public static final int TWO_PULSE = 0;
|
||||
|
||||
/** Semi-period mode. */
|
||||
public static final int SEMI_PERIOD = 1;
|
||||
|
||||
/** Pulse length mode. */
|
||||
public static final int PULSE_LENGTH = 2;
|
||||
|
||||
/** External direction mode. */
|
||||
public static final int EXTERNAL_DIRECTION = 3;
|
||||
|
||||
/**
|
||||
|
||||
@@ -123,6 +123,11 @@ public class DIOJNI extends JNIWrapper {
|
||||
*/
|
||||
public static native boolean isAnyPulsing();
|
||||
|
||||
/**
|
||||
* Gets the loop timing of the PWM system.
|
||||
*
|
||||
* @return the loop time in clock ticks
|
||||
*/
|
||||
public static native short getLoopTiming();
|
||||
|
||||
/**
|
||||
|
||||
@@ -147,12 +147,25 @@ public class DriverStationJNI extends JNIWrapper {
|
||||
*/
|
||||
private static native int nativeGetAllianceStation();
|
||||
|
||||
/** Unknown Alliance Station ID. */
|
||||
public static final int kUnknownAllianceStation = 0;
|
||||
|
||||
/** Red Alliance Station 1 ID. */
|
||||
public static final int kRed1AllianceStation = 1;
|
||||
|
||||
/** Red Alliance Station 2 ID. */
|
||||
public static final int kRed2AllianceStation = 2;
|
||||
|
||||
/** Red Alliance Station 3 ID. */
|
||||
public static final int kRed3AllianceStation = 3;
|
||||
|
||||
/** Blue Alliance Station 1 ID. */
|
||||
public static final int kBlue1AllianceStation = 4;
|
||||
|
||||
/** Blue Alliance Station 2 ID. */
|
||||
public static final int kBlue2AllianceStation = 5;
|
||||
|
||||
/** Blue Alliance Station 3 ID. */
|
||||
public static final int kBlue3AllianceStation = 6;
|
||||
|
||||
/**
|
||||
@@ -174,8 +187,13 @@ public class DriverStationJNI extends JNIWrapper {
|
||||
};
|
||||
}
|
||||
|
||||
/** The maximum number of axes. */
|
||||
public static final int kMaxJoystickAxes = 12;
|
||||
|
||||
/** The maximum number of POVs. */
|
||||
public static final int kMaxJoystickPOVs = 12;
|
||||
|
||||
/** The maximum number of joysticks. */
|
||||
public static final int kMaxJoysticks = 6;
|
||||
|
||||
/**
|
||||
@@ -353,8 +371,18 @@ public class DriverStationJNI extends JNIWrapper {
|
||||
*/
|
||||
public static native boolean refreshDSData();
|
||||
|
||||
/**
|
||||
* Adds an event handle to be signalled when new data arrives.
|
||||
*
|
||||
* @param handle the event handle to be signalled
|
||||
*/
|
||||
public static native void provideNewDataEventHandle(int handle);
|
||||
|
||||
/**
|
||||
* Removes the event handle from being signalled when new data arrives.
|
||||
*
|
||||
* @param handle the event handle to remove
|
||||
*/
|
||||
public static native void removeNewDataEventHandle(int handle);
|
||||
|
||||
/**
|
||||
|
||||
@@ -82,6 +82,7 @@ public final class HAL extends JNIWrapper {
|
||||
|
||||
private static final List<Runnable> s_simPeriodicBefore = new ArrayList<>();
|
||||
|
||||
/** A callback to be run by IterativeRobotBase prior to the user's simulationPeriodic code. */
|
||||
public static final class SimPeriodicBeforeCallback implements AutoCloseable {
|
||||
private SimPeriodicBeforeCallback(Runnable r) {
|
||||
m_run = r;
|
||||
@@ -128,6 +129,7 @@ public final class HAL extends JNIWrapper {
|
||||
|
||||
private static final List<Runnable> s_simPeriodicAfter = new ArrayList<>();
|
||||
|
||||
/** A callback to be run by IterativeRobotBase after the user's simulationPeriodic code. */
|
||||
public static final class SimPeriodicAfterCallback implements AutoCloseable {
|
||||
private SimPeriodicAfterCallback(Runnable r) {
|
||||
m_run = r;
|
||||
|
||||
@@ -10,17 +10,37 @@ package edu.wpi.first.hal;
|
||||
* @see "hal/HALBase.h"
|
||||
*/
|
||||
public final class HALUtil extends JNIWrapper {
|
||||
/** A pointer parameter to a method is NULL. */
|
||||
public static final int NULL_PARAMETER = -1005;
|
||||
|
||||
/** Analog module sample rate is too high. */
|
||||
public static final int SAMPLE_RATE_TOO_HIGH = 1001;
|
||||
|
||||
/** Voltage to convert to raw value is out of range [0; 5]. */
|
||||
public static final int VOLTAGE_OUT_OF_RANGE = 1002;
|
||||
|
||||
/** Digital module loop timing is not the expected value. */
|
||||
public static final int LOOP_TIMING_ERROR = 1004;
|
||||
|
||||
/** The operation cannot be completed. */
|
||||
public static final int INCOMPATIBLE_STATE = 1015;
|
||||
|
||||
/** Attempted to read AnalogTrigger pulse output. */
|
||||
public static final int ANALOG_TRIGGER_PULSE_OUTPUT_ERROR = -1011;
|
||||
|
||||
/** No available resources to allocate. */
|
||||
public static final int NO_AVAILABLE_RESOURCES = -104;
|
||||
|
||||
/** A parameter is out of range. */
|
||||
public static final int PARAMETER_OUT_OF_RANGE = -1028;
|
||||
|
||||
/** roboRIO 1.0. */
|
||||
public static final int RUNTIME_ROBORIO = 0;
|
||||
|
||||
/** roboRIO 2.0. */
|
||||
public static final int RUNTIME_ROBORIO2 = 1;
|
||||
|
||||
/** Simulation runtime. */
|
||||
public static final int RUNTIME_SIMULATION = 2;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,12 +4,24 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
/** Represents a HAL entry value. */
|
||||
public final class HALValue {
|
||||
/** Unassigned type. */
|
||||
public static final int kUnassigned = 0;
|
||||
|
||||
/** Boolean. */
|
||||
public static final int kBoolean = 0x01;
|
||||
|
||||
/** Double. */
|
||||
public static final int kDouble = 0x02;
|
||||
|
||||
/** Enum. */
|
||||
public static final int kEnum = 0x04;
|
||||
|
||||
/** Int. */
|
||||
public static final int kInt = 0x08;
|
||||
|
||||
/** Long. */
|
||||
public static final int kLong = 0x10;
|
||||
|
||||
private int m_type;
|
||||
@@ -132,6 +144,11 @@ public final class HALValue {
|
||||
return new HALValue(value, kDouble);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a HAL unassigned value.
|
||||
*
|
||||
* @return HAL value
|
||||
*/
|
||||
public static HALValue makeUnassigned() {
|
||||
return new HALValue();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ package edu.wpi.first.hal;
|
||||
* @see "hal/Interrupts.h"
|
||||
*/
|
||||
public class InterruptJNI extends JNIWrapper {
|
||||
/** Invalid handle value. */
|
||||
public static final int HalInvalidHandle = 0;
|
||||
|
||||
/**
|
||||
|
||||
@@ -63,6 +63,11 @@ public class JNIWrapper {
|
||||
libraryLoaded = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dummy function to suppress unused variable warnings.
|
||||
*
|
||||
* @param object variable to suppress
|
||||
*/
|
||||
public static void suppressUnused(Object object) {}
|
||||
|
||||
/** Utility class. */
|
||||
|
||||
@@ -4,10 +4,22 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
/**
|
||||
* LED JNI Functions.
|
||||
*
|
||||
* @see "hal/LEDs.h"
|
||||
*/
|
||||
public class LEDJNI extends JNIWrapper {
|
||||
/** LED Off state. */
|
||||
public static final int RADIO_LED_STATE_OFF = 0;
|
||||
|
||||
/** LED Green state. */
|
||||
public static final int RADIO_LED_STATE_GREEN = 1;
|
||||
|
||||
/** LED Red state. */
|
||||
public static final int RADIO_LED_STATE_RED = 2;
|
||||
|
||||
/** LED Orange state. */
|
||||
public static final int RADIO_LED_STATE_ORANGE = 3;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
/**
|
||||
* PWM JNI Functions.
|
||||
*
|
||||
* @see "hal/PWM.h"
|
||||
*/
|
||||
public class PWMJNI extends DIOJNI {
|
||||
/**
|
||||
* Initializes a PWM port.
|
||||
|
||||
@@ -4,60 +4,91 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
/**
|
||||
* Faults for a PowerDistribution device. These faults are only active while the condition is
|
||||
* active.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public class PowerDistributionFaults {
|
||||
/** Breaker fault on channel 0. */
|
||||
public final boolean Channel0BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 1. */
|
||||
public final boolean Channel1BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 2. */
|
||||
public final boolean Channel2BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 3. */
|
||||
public final boolean Channel3BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 4. */
|
||||
public final boolean Channel4BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 5. */
|
||||
public final boolean Channel5BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 6. */
|
||||
public final boolean Channel6BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 7. */
|
||||
public final boolean Channel7BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 8. */
|
||||
public final boolean Channel8BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 9. */
|
||||
public final boolean Channel9BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 10. */
|
||||
public final boolean Channel10BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 11. */
|
||||
public final boolean Channel11BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 12. */
|
||||
public final boolean Channel12BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 13. */
|
||||
public final boolean Channel13BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 14. */
|
||||
public final boolean Channel14BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 15. */
|
||||
public final boolean Channel15BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 16. */
|
||||
public final boolean Channel16BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 17. */
|
||||
public final boolean Channel17BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 18. */
|
||||
public final boolean Channel18BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 19. */
|
||||
public final boolean Channel19BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 20. */
|
||||
public final boolean Channel20BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 21. */
|
||||
public final boolean Channel21BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 22. */
|
||||
public final boolean Channel22BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 23. */
|
||||
public final boolean Channel23BreakerFault;
|
||||
|
||||
/** The input voltage is below the minimum voltage. */
|
||||
public final boolean Brownout;
|
||||
|
||||
/** A warning was raised by the device's CAN controller. */
|
||||
public final boolean CanWarning;
|
||||
|
||||
/** The hardware on the device has malfunctioned. */
|
||||
public final boolean HardwareFault;
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,9 +10,16 @@ package edu.wpi.first.hal;
|
||||
* @see "hal/PowerDistribution.h"
|
||||
*/
|
||||
public class PowerDistributionJNI extends JNIWrapper {
|
||||
/** Automatically determines the module type. */
|
||||
public static final int AUTOMATIC_TYPE = 0;
|
||||
|
||||
/** CTRE (Cross The Road Electronics) Power Distribution Panel (PDP). */
|
||||
public static final int CTRE_TYPE = 1;
|
||||
|
||||
/** REV Power Distribution Hub (PDH). */
|
||||
public static final int REV_TYPE = 2;
|
||||
|
||||
/** Use the default module number for the selected module type. */
|
||||
public static final int DEFAULT_MODULE = -1;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,62 +4,94 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
/**
|
||||
* Sticky faults for a PowerDistribution device. These faults will remain active until they are
|
||||
* reset by the user.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public class PowerDistributionStickyFaults {
|
||||
/** Breaker fault on channel 0. */
|
||||
public final boolean Channel0BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 1. */
|
||||
public final boolean Channel1BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 2. */
|
||||
public final boolean Channel2BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 3. */
|
||||
public final boolean Channel3BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 4. */
|
||||
public final boolean Channel4BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 5. */
|
||||
public final boolean Channel5BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 6. */
|
||||
public final boolean Channel6BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 7. */
|
||||
public final boolean Channel7BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 8. */
|
||||
public final boolean Channel8BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 9. */
|
||||
public final boolean Channel9BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 10. */
|
||||
public final boolean Channel10BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 11. */
|
||||
public final boolean Channel11BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 12. */
|
||||
public final boolean Channel12BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 13. */
|
||||
public final boolean Channel13BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 14. */
|
||||
public final boolean Channel14BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 15. */
|
||||
public final boolean Channel15BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 16. */
|
||||
public final boolean Channel16BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 17. */
|
||||
public final boolean Channel17BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 18. */
|
||||
public final boolean Channel18BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 19. */
|
||||
public final boolean Channel19BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 20. */
|
||||
public final boolean Channel20BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 21. */
|
||||
public final boolean Channel21BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 22. */
|
||||
public final boolean Channel22BreakerFault;
|
||||
|
||||
/** Breaker fault on channel 23. */
|
||||
public final boolean Channel23BreakerFault;
|
||||
|
||||
/** The input voltage was below the minimum voltage. */
|
||||
public final boolean Brownout;
|
||||
|
||||
/** A warning was raised by the device's CAN controller. */
|
||||
public final boolean CanWarning;
|
||||
|
||||
/** The device's CAN controller experienced a "Bus Off" event. */
|
||||
public final boolean CanBusOff;
|
||||
|
||||
/** The device has rebooted. */
|
||||
public final boolean HasReset;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,50 +4,73 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
/** Faults for a REV PH. These faults are only active while the condition is active. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public class REVPHFaults {
|
||||
/** Fault on channel 0. */
|
||||
public final boolean Channel0Fault;
|
||||
|
||||
/** Fault on channel 1. */
|
||||
public final boolean Channel1Fault;
|
||||
|
||||
/** Fault on channel 2. */
|
||||
public final boolean Channel2Fault;
|
||||
|
||||
/** Fault on channel 3. */
|
||||
public final boolean Channel3Fault;
|
||||
|
||||
/** Fault on channel 4. */
|
||||
public final boolean Channel4Fault;
|
||||
|
||||
/** Fault on channel 5. */
|
||||
public final boolean Channel5Fault;
|
||||
|
||||
/** Fault on channel 6. */
|
||||
public final boolean Channel6Fault;
|
||||
|
||||
/** Fault on channel 7. */
|
||||
public final boolean Channel7Fault;
|
||||
|
||||
/** Fault on channel 8. */
|
||||
public final boolean Channel8Fault;
|
||||
|
||||
/** Fault on channel 9. */
|
||||
public final boolean Channel9Fault;
|
||||
|
||||
/** Fault on channel 10. */
|
||||
public final boolean Channel10Fault;
|
||||
|
||||
/** Fault on channel 11. */
|
||||
public final boolean Channel11Fault;
|
||||
|
||||
/** Fault on channel 12. */
|
||||
public final boolean Channel12Fault;
|
||||
|
||||
/** Fault on channel 13. */
|
||||
public final boolean Channel13Fault;
|
||||
|
||||
/** Fault on channel 14. */
|
||||
public final boolean Channel14Fault;
|
||||
|
||||
/** Fault on channel 15. */
|
||||
public final boolean Channel15Fault;
|
||||
|
||||
/** An overcurrent event occurred on the compressor output. */
|
||||
public final boolean CompressorOverCurrent;
|
||||
|
||||
/** The compressor output has an open circuit. */
|
||||
public final boolean CompressorOpen;
|
||||
|
||||
/** An overcurrent event occurred on a solenoid ouput. */
|
||||
public final boolean SolenoidOverCurrent;
|
||||
|
||||
/** The input voltage is below the minimum voltage. */
|
||||
public final boolean Brownout;
|
||||
|
||||
/** A warning was raised by the device's CAN controller. */
|
||||
public final boolean CanWarning;
|
||||
|
||||
/** The hardware on the device has malfunctioned. */
|
||||
public final boolean HardwareFault;
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,9 +10,16 @@ package edu.wpi.first.hal;
|
||||
* @see "REVPH.h"
|
||||
*/
|
||||
public class REVPHJNI extends JNIWrapper {
|
||||
/** Disabled. */
|
||||
public static final int COMPRESSOR_CONFIG_TYPE_DISABLED = 0;
|
||||
|
||||
/** Digital. */
|
||||
public static final int COMPRESSOR_CONFIG_TYPE_DIGITAL = 1;
|
||||
|
||||
/** Analog. */
|
||||
public static final int COMPRESSOR_CONFIG_TYPE_ANALOG = 2;
|
||||
|
||||
/** Hybrid. */
|
||||
public static final int COMPRESSOR_CONFIG_TYPE_HYBRID = 3;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,20 +4,28 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
/** Sticky faults for a REV PH. These faults will remain active until they are reset by the user. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public class REVPHStickyFaults {
|
||||
/** An overcurrent event occurred on the compressor output. */
|
||||
public final boolean CompressorOverCurrent;
|
||||
|
||||
/** The compressor output has an open circuit. */
|
||||
public final boolean CompressorOpen;
|
||||
|
||||
/** An overcurrent event occurred on a solenoid ouput. */
|
||||
public final boolean SolenoidOverCurrent;
|
||||
|
||||
/** The input voltage is below the minimum voltage. */
|
||||
public final boolean Brownout;
|
||||
|
||||
/** A warning was raised by the device's CAN controller. */
|
||||
public final boolean CanWarning;
|
||||
|
||||
/** The device's CAN controller experienced a "Bus Off" event. */
|
||||
public final boolean CanBusOff;
|
||||
|
||||
/** The device has rebooted. */
|
||||
public final boolean HasReset;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,18 +4,25 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
/** Version and device data received from a REV PH. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public class REVPHVersion {
|
||||
/** The firmware major version. */
|
||||
public final int firmwareMajor;
|
||||
|
||||
/** The firmware minor version. */
|
||||
public final int firmwareMinor;
|
||||
|
||||
/** The firmware fix version. */
|
||||
public final int firmwareFix;
|
||||
|
||||
/** The hardware minor version. */
|
||||
public final int hardwareMinor;
|
||||
|
||||
/** The hardware major version. */
|
||||
public final int hardwareMajor;
|
||||
|
||||
/** The device's unique ID. */
|
||||
public final int uniqueId;
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,16 +12,34 @@ import java.nio.ByteBuffer;
|
||||
* @see "SPI.h"
|
||||
*/
|
||||
public class SPIJNI extends JNIWrapper {
|
||||
/** Invalid port number. */
|
||||
public static final int INVALID_PORT = -1;
|
||||
|
||||
/** Onboard SPI bus port CS0. */
|
||||
public static final int ONBOARD_CS0_PORT = 0;
|
||||
|
||||
/** Onboard SPI bus port CS1. */
|
||||
public static final int ONBOARD_CS1_PORT = 1;
|
||||
|
||||
/** Onboard SPI bus port CS2. */
|
||||
public static final int ONBOARD_CS2_PORT = 2;
|
||||
|
||||
/** Onboard SPI bus port CS3. */
|
||||
public static final int ONBOARD_CS3_PORT = 3;
|
||||
|
||||
/** MXP (roboRIO MXP) SPI bus port. */
|
||||
public static final int MXP_PORT = 4;
|
||||
|
||||
/** Clock idle low, data sampled on rising edge. */
|
||||
public static final int SPI_MODE0 = 0;
|
||||
|
||||
/** Clock idle low, data sampled on falling edge. */
|
||||
public static final int SPI_MODE1 = 1;
|
||||
|
||||
/** Clock idle high, data sampled on falling edge. */
|
||||
public static final int SPI_MODE2 = 2;
|
||||
|
||||
/** Clock idle high, data sampled on rising edge. */
|
||||
public static final int SPI_MODE3 = 3;
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,7 @@ public class SimDevice implements AutoCloseable {
|
||||
/** Bidirectional direction for simulation devices. */
|
||||
kBidir(SimDeviceJNI.kBidir);
|
||||
|
||||
/** The native value of this Direction. */
|
||||
public final int m_value;
|
||||
|
||||
Direction(int value) {
|
||||
|
||||
@@ -4,9 +4,19 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
/**
|
||||
* SimDevice JNI Functions.
|
||||
*
|
||||
* @see "hal/SimDevice.h"
|
||||
*/
|
||||
public class SimDeviceJNI extends JNIWrapper {
|
||||
/** Input to user code from the simulator. */
|
||||
public static final int kInput = 0;
|
||||
|
||||
/** Output from user code to the simulator. */
|
||||
public static final int kOutput = 1;
|
||||
|
||||
/** Bidirectional between user code and simulator. */
|
||||
public static final int kBidir = 2;
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,5 +42,6 @@ public class SimValue {
|
||||
SimDeviceJNI.setSimValue(m_handle, value);
|
||||
}
|
||||
|
||||
/** The native handle for this SimValue. */
|
||||
protected final int m_handle;
|
||||
}
|
||||
|
||||
@@ -19,9 +19,13 @@
|
||||
* The counter mode.
|
||||
*/
|
||||
HAL_ENUM(HAL_Counter_Mode) {
|
||||
/** Two pulse mode. */
|
||||
HAL_Counter_kTwoPulse = 0,
|
||||
/** Semi-period mode. */
|
||||
HAL_Counter_kSemiperiod = 1,
|
||||
/** Pulse length mode. */
|
||||
HAL_Counter_kPulseLength = 2,
|
||||
/** External direction mode. */
|
||||
HAL_Counter_kExternalDirection = 3
|
||||
};
|
||||
|
||||
|
||||
@@ -219,7 +219,18 @@ int32_t HAL_GetMatchInfo(HAL_MatchInfo* info);
|
||||
*/
|
||||
HAL_Bool HAL_RefreshDSData(void);
|
||||
|
||||
/**
|
||||
* Adds an event handle to be signalled when new data arrives.
|
||||
*
|
||||
* @param handle the event handle to be signalled
|
||||
*/
|
||||
void HAL_ProvideNewDataEventHandle(WPI_EventHandle handle);
|
||||
|
||||
/**
|
||||
* Removes the event handle from being signalled when new data arrives.
|
||||
*
|
||||
* @param handle the event handle to remove
|
||||
*/
|
||||
void HAL_RemoveNewDataEventHandle(WPI_EventHandle handle);
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,12 +41,19 @@ struct HAL_ControlWord {
|
||||
typedef struct HAL_ControlWord HAL_ControlWord;
|
||||
|
||||
HAL_ENUM(HAL_AllianceStationID) {
|
||||
/** Unknown Alliance Station */
|
||||
HAL_AllianceStationID_kUnknown = 0,
|
||||
/** Red Alliance Station 1 */
|
||||
HAL_AllianceStationID_kRed1,
|
||||
/** Red Alliance Station 2 */
|
||||
HAL_AllianceStationID_kRed2,
|
||||
/** Red Alliance Station 3 */
|
||||
HAL_AllianceStationID_kRed3,
|
||||
/** Blue Alliance Station 1 */
|
||||
HAL_AllianceStationID_kBlue1,
|
||||
/** Blue Alliance Station 2 */
|
||||
HAL_AllianceStationID_kBlue2,
|
||||
/** Blue Alliance Station 3 */
|
||||
HAL_AllianceStationID_kBlue3,
|
||||
};
|
||||
|
||||
@@ -57,12 +64,21 @@ HAL_ENUM(HAL_MatchType) {
|
||||
HAL_kMatchType_elimination,
|
||||
};
|
||||
|
||||
/* The maximum number of axes that will be stored in a single HALJoystickAxes
|
||||
* struct. This is used for allocating buffers, not bounds checking, since
|
||||
* there are usually less axes in practice.
|
||||
/**
|
||||
* The maximum number of axes that will be stored in a single HAL_JoystickAxes
|
||||
* struct. This is used for allocating buffers, not bounds checking, since there
|
||||
* are usually less axes in practice.
|
||||
*/
|
||||
#define HAL_kMaxJoystickAxes 12
|
||||
/**
|
||||
* The maximum number of POVs that will be stored in a single HAL_JoystickPOVs
|
||||
* struct. This is used for allocating buffers, not bounds checking, since there
|
||||
* are usually less POVs in practice.
|
||||
*/
|
||||
#define HAL_kMaxJoystickPOVs 12
|
||||
/**
|
||||
* The maximum number of joysticks.
|
||||
*/
|
||||
#define HAL_kMaxJoysticks 6
|
||||
|
||||
struct HAL_JoystickAxes {
|
||||
|
||||
@@ -24,9 +24,15 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Runtime type.
|
||||
*/
|
||||
HAL_ENUM(HAL_RuntimeType) {
|
||||
/** roboRIO 1.0 */
|
||||
HAL_Runtime_RoboRIO,
|
||||
/** roboRIO 2.0 */
|
||||
HAL_Runtime_RoboRIO2,
|
||||
/** Simulation runtime */
|
||||
HAL_Runtime_Simulation
|
||||
};
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ void HAL_SetPWMAlwaysHighMode(HAL_DigitalHandle pwmPortHandle, int32_t* status);
|
||||
* Gets the loop timing of the PWM system.
|
||||
*
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return the loop time
|
||||
* @return the loop time in clock ticks
|
||||
*/
|
||||
int32_t HAL_GetPWMLoopTiming(int32_t* status);
|
||||
|
||||
|
||||
@@ -19,11 +19,15 @@
|
||||
* The types of power distribution devices.
|
||||
*/
|
||||
HAL_ENUM(HAL_PowerDistributionType) {
|
||||
/** Automatically determines the module type */
|
||||
HAL_PowerDistributionType_kAutomatic = 0,
|
||||
/** CTRE (Cross The Road Electronics) Power Distribution Panel (PDP). */
|
||||
HAL_PowerDistributionType_kCTRE = 1,
|
||||
/** REV Power Distribution Hub (PDH). */
|
||||
HAL_PowerDistributionType_kRev = 2,
|
||||
};
|
||||
|
||||
/** Use the default module number for the selected module type */
|
||||
#define HAL_DEFAULT_POWER_DISTRIBUTION_MODULE -1
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -244,32 +248,59 @@ struct HAL_PowerDistributionVersion {
|
||||
};
|
||||
|
||||
struct HAL_PowerDistributionFaults {
|
||||
/** Breaker fault on channel 0. */
|
||||
uint32_t channel0BreakerFault : 1;
|
||||
/** Breaker fault on channel 1. */
|
||||
uint32_t channel1BreakerFault : 1;
|
||||
/** Breaker fault on channel 2. */
|
||||
uint32_t channel2BreakerFault : 1;
|
||||
/** Breaker fault on channel 3. */
|
||||
uint32_t channel3BreakerFault : 1;
|
||||
/** Breaker fault on channel 4. */
|
||||
uint32_t channel4BreakerFault : 1;
|
||||
/** Breaker fault on channel 5. */
|
||||
uint32_t channel5BreakerFault : 1;
|
||||
/** Breaker fault on channel 6. */
|
||||
uint32_t channel6BreakerFault : 1;
|
||||
/** Breaker fault on channel 7. */
|
||||
uint32_t channel7BreakerFault : 1;
|
||||
/** Breaker fault on channel 8. */
|
||||
uint32_t channel8BreakerFault : 1;
|
||||
/** Breaker fault on channel 9. */
|
||||
uint32_t channel9BreakerFault : 1;
|
||||
/** Breaker fault on channel 10. */
|
||||
uint32_t channel10BreakerFault : 1;
|
||||
/** Breaker fault on channel 12. */
|
||||
uint32_t channel11BreakerFault : 1;
|
||||
/** Breaker fault on channel 13. */
|
||||
uint32_t channel12BreakerFault : 1;
|
||||
/** Breaker fault on channel 14. */
|
||||
uint32_t channel13BreakerFault : 1;
|
||||
/** Breaker fault on channel 15. */
|
||||
uint32_t channel14BreakerFault : 1;
|
||||
/** Breaker fault on channel 16. */
|
||||
uint32_t channel15BreakerFault : 1;
|
||||
/** Breaker fault on channel 17. */
|
||||
uint32_t channel16BreakerFault : 1;
|
||||
/** Breaker fault on channel 18. */
|
||||
uint32_t channel17BreakerFault : 1;
|
||||
/** Breaker fault on channel 19. */
|
||||
uint32_t channel18BreakerFault : 1;
|
||||
/** Breaker fault on channel 20. */
|
||||
uint32_t channel19BreakerFault : 1;
|
||||
/** Breaker fault on channel 21. */
|
||||
uint32_t channel20BreakerFault : 1;
|
||||
/** Breaker fault on channel 22. */
|
||||
uint32_t channel21BreakerFault : 1;
|
||||
/** Breaker fault on channel 23. */
|
||||
uint32_t channel22BreakerFault : 1;
|
||||
/** Breaker fault on channel 24. */
|
||||
uint32_t channel23BreakerFault : 1;
|
||||
/** The input voltage is below the minimum voltage. */
|
||||
uint32_t brownout : 1;
|
||||
/** A warning was raised by the device's CAN controller. */
|
||||
uint32_t canWarning : 1;
|
||||
/** The hardware on the device has malfunctioned. */
|
||||
uint32_t hardwareFault : 1;
|
||||
};
|
||||
|
||||
@@ -277,33 +308,61 @@ struct HAL_PowerDistributionFaults {
|
||||
* Storage for REV PDH Sticky Faults
|
||||
*/
|
||||
struct HAL_PowerDistributionStickyFaults {
|
||||
/** Breaker fault on channel 0. */
|
||||
uint32_t channel0BreakerFault : 1;
|
||||
/** Breaker fault on channel 1. */
|
||||
uint32_t channel1BreakerFault : 1;
|
||||
/** Breaker fault on channel 2. */
|
||||
uint32_t channel2BreakerFault : 1;
|
||||
/** Breaker fault on channel 3. */
|
||||
uint32_t channel3BreakerFault : 1;
|
||||
/** Breaker fault on channel 4. */
|
||||
uint32_t channel4BreakerFault : 1;
|
||||
/** Breaker fault on channel 5. */
|
||||
uint32_t channel5BreakerFault : 1;
|
||||
/** Breaker fault on channel 6. */
|
||||
uint32_t channel6BreakerFault : 1;
|
||||
/** Breaker fault on channel 7. */
|
||||
uint32_t channel7BreakerFault : 1;
|
||||
/** Breaker fault on channel 8. */
|
||||
uint32_t channel8BreakerFault : 1;
|
||||
/** Breaker fault on channel 9. */
|
||||
uint32_t channel9BreakerFault : 1;
|
||||
/** Breaker fault on channel 10. */
|
||||
uint32_t channel10BreakerFault : 1;
|
||||
/** Breaker fault on channel 12. */
|
||||
uint32_t channel11BreakerFault : 1;
|
||||
/** Breaker fault on channel 13. */
|
||||
uint32_t channel12BreakerFault : 1;
|
||||
/** Breaker fault on channel 14. */
|
||||
uint32_t channel13BreakerFault : 1;
|
||||
/** Breaker fault on channel 15. */
|
||||
uint32_t channel14BreakerFault : 1;
|
||||
/** Breaker fault on channel 16. */
|
||||
uint32_t channel15BreakerFault : 1;
|
||||
/** Breaker fault on channel 17. */
|
||||
uint32_t channel16BreakerFault : 1;
|
||||
/** Breaker fault on channel 18. */
|
||||
uint32_t channel17BreakerFault : 1;
|
||||
/** Breaker fault on channel 19. */
|
||||
uint32_t channel18BreakerFault : 1;
|
||||
/** Breaker fault on channel 20. */
|
||||
uint32_t channel19BreakerFault : 1;
|
||||
/** Breaker fault on channel 21. */
|
||||
uint32_t channel20BreakerFault : 1;
|
||||
/** Breaker fault on channel 22. */
|
||||
uint32_t channel21BreakerFault : 1;
|
||||
/** Breaker fault on channel 23. */
|
||||
uint32_t channel22BreakerFault : 1;
|
||||
/** Breaker fault on channel 24. */
|
||||
uint32_t channel23BreakerFault : 1;
|
||||
/** The input voltage is below the minimum voltage. */
|
||||
uint32_t brownout : 1;
|
||||
/** A warning was raised by the device's CAN controller. */
|
||||
uint32_t canWarning : 1;
|
||||
/** The device's CAN controller experienced a "Bus Off" event. */
|
||||
uint32_t canBusOff : 1;
|
||||
/** The device has rebooted. */
|
||||
uint32_t hasReset : 1;
|
||||
};
|
||||
|
||||
@@ -320,6 +379,8 @@ void HAL_GetPowerDistributionVersion(HAL_PowerDistributionHandle handle,
|
||||
/**
|
||||
* Get the current faults of the PowerDistribution.
|
||||
*
|
||||
* On a CTRE PDP, this will return an object with no faults active.
|
||||
*
|
||||
* @param[in] handle the module handle
|
||||
* @param[out] faults the HAL_PowerDistributionFaults to populate
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
@@ -331,6 +392,8 @@ void HAL_GetPowerDistributionFaults(HAL_PowerDistributionHandle handle,
|
||||
/**
|
||||
* Gets the sticky faults of the PowerDistribution.
|
||||
*
|
||||
* On a CTRE PDP, this will return an object with no faults active.
|
||||
*
|
||||
* @param[in] handle the module handle
|
||||
* @param[out] stickyFaults the HAL_PowerDistributionStickyFaults to populate
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
|
||||
@@ -18,9 +18,13 @@
|
||||
* The compressor configuration type
|
||||
*/
|
||||
HAL_ENUM(HAL_REVPHCompressorConfigType) {
|
||||
/** Disabled. */
|
||||
HAL_REVPHCompressorConfigType_kDisabled = 0,
|
||||
/** Digital. */
|
||||
HAL_REVPHCompressorConfigType_kDigital = 1,
|
||||
/** Analog. */
|
||||
HAL_REVPHCompressorConfigType_kAnalog = 2,
|
||||
/** Hybrid. */
|
||||
HAL_REVPHCompressorConfigType_kHybrid = 3,
|
||||
};
|
||||
|
||||
@@ -28,11 +32,17 @@ HAL_ENUM(HAL_REVPHCompressorConfigType) {
|
||||
* Storage for REV PH Version
|
||||
*/
|
||||
struct HAL_REVPHVersion {
|
||||
/** The firmware major version. */
|
||||
uint32_t firmwareMajor;
|
||||
/** The firmware minor version. */
|
||||
uint32_t firmwareMinor;
|
||||
/** The firmware fix version. */
|
||||
uint32_t firmwareFix;
|
||||
/** The hardware minor version. */
|
||||
uint32_t hardwareMinor;
|
||||
/** The hardware major version. */
|
||||
uint32_t hardwareMajor;
|
||||
/** The device's unique ID. */
|
||||
uint32_t uniqueId;
|
||||
};
|
||||
|
||||
@@ -50,27 +60,49 @@ struct HAL_REVPHCompressorConfig {
|
||||
* Storage for REV PH Faults
|
||||
*/
|
||||
struct HAL_REVPHFaults {
|
||||
/** Fault on channel 0. */
|
||||
uint32_t channel0Fault : 1;
|
||||
/** Fault on channel 1. */
|
||||
uint32_t channel1Fault : 1;
|
||||
/** Fault on channel 2. */
|
||||
uint32_t channel2Fault : 1;
|
||||
/** Fault on channel 3. */
|
||||
uint32_t channel3Fault : 1;
|
||||
/** Fault on channel 4. */
|
||||
uint32_t channel4Fault : 1;
|
||||
/** Fault on channel 5. */
|
||||
uint32_t channel5Fault : 1;
|
||||
/** Fault on channel 6. */
|
||||
uint32_t channel6Fault : 1;
|
||||
/** Fault on channel 7. */
|
||||
uint32_t channel7Fault : 1;
|
||||
/** Fault on channel 8. */
|
||||
uint32_t channel8Fault : 1;
|
||||
/** Fault on channel 9. */
|
||||
uint32_t channel9Fault : 1;
|
||||
/** Fault on channel 10. */
|
||||
uint32_t channel10Fault : 1;
|
||||
/** Fault on channel 11. */
|
||||
uint32_t channel11Fault : 1;
|
||||
/** Fault on channel 12. */
|
||||
uint32_t channel12Fault : 1;
|
||||
/** Fault on channel 13. */
|
||||
uint32_t channel13Fault : 1;
|
||||
/** Fault on channel 14. */
|
||||
uint32_t channel14Fault : 1;
|
||||
/** Fault on channel 15. */
|
||||
uint32_t channel15Fault : 1;
|
||||
/** An overcurrent event occurred on the compressor output. */
|
||||
uint32_t compressorOverCurrent : 1;
|
||||
/** The compressor output has an open circuit. */
|
||||
uint32_t compressorOpen : 1;
|
||||
/** An overcurrent event occurred on a solenoid ouput. */
|
||||
uint32_t solenoidOverCurrent : 1;
|
||||
/** The input voltage is below the minimum voltage. */
|
||||
uint32_t brownout : 1;
|
||||
/** A warning was raised by the device's CAN controller. */
|
||||
uint32_t canWarning : 1;
|
||||
/** The hardware on the device has malfunctioned. */
|
||||
uint32_t hardwareFault : 1;
|
||||
};
|
||||
|
||||
@@ -78,12 +110,19 @@ struct HAL_REVPHFaults {
|
||||
* Storage for REV PH Sticky Faults
|
||||
*/
|
||||
struct HAL_REVPHStickyFaults {
|
||||
/** An overcurrent event occurred on the compressor output. */
|
||||
uint32_t compressorOverCurrent : 1;
|
||||
/** The compressor output has an open circuit. */
|
||||
uint32_t compressorOpen : 1;
|
||||
/** An overcurrent event occurred on a solenoid ouput. */
|
||||
uint32_t solenoidOverCurrent : 1;
|
||||
/** The input voltage is below the minimum voltage. */
|
||||
uint32_t brownout : 1;
|
||||
/** A warning was raised by the device's CAN controller. */
|
||||
uint32_t canWarning : 1;
|
||||
/** The device's CAN controller experienced a "Bus Off" event. */
|
||||
uint32_t canBusOff : 1;
|
||||
/** The device has rebooted. */
|
||||
uint32_t hasReset : 1;
|
||||
};
|
||||
|
||||
|
||||
@@ -14,19 +14,31 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** SPI port. */
|
||||
HAL_ENUM(HAL_SPIPort) {
|
||||
/** Invalid port number. */
|
||||
HAL_SPI_kInvalid = -1,
|
||||
/** Onboard SPI bus port CS0. */
|
||||
HAL_SPI_kOnboardCS0,
|
||||
/** Onboard SPI bus port CS1. */
|
||||
HAL_SPI_kOnboardCS1,
|
||||
/** Onboard SPI bus port CS2. */
|
||||
HAL_SPI_kOnboardCS2,
|
||||
/** Onboard SPI bus port CS3. */
|
||||
HAL_SPI_kOnboardCS3,
|
||||
/** MXP (roboRIO MXP) SPI bus port. */
|
||||
HAL_SPI_kMXP
|
||||
};
|
||||
|
||||
/** SPI mode. */
|
||||
HAL_ENUM(HAL_SPIMode) {
|
||||
/** Clock idle low, data sampled on rising edge. */
|
||||
HAL_SPI_kMode0 = 0,
|
||||
/** Clock idle low, data sampled on falling edge. */
|
||||
HAL_SPI_kMode1 = 1,
|
||||
/** Clock idle high, data sampled on falling edge. */
|
||||
HAL_SPI_kMode2 = 2,
|
||||
/** Clock idle high, data sampled on rising edge. */
|
||||
HAL_SPI_kMode3 = 3,
|
||||
};
|
||||
|
||||
|
||||
@@ -8,11 +8,17 @@
|
||||
|
||||
/** HAL data types. */
|
||||
enum HAL_Type {
|
||||
/** Unassigned type. */
|
||||
HAL_UNASSIGNED = 0,
|
||||
/** Boolean. */
|
||||
HAL_BOOLEAN = 0x01,
|
||||
/** Double. */
|
||||
HAL_DOUBLE = 0x02,
|
||||
/** Enum. */
|
||||
HAL_ENUM = 0x04,
|
||||
/** Int. */
|
||||
HAL_INT = 0x08,
|
||||
/** Long. */
|
||||
HAL_LONG = 0x10,
|
||||
};
|
||||
|
||||
@@ -31,7 +37,12 @@ struct HAL_Value {
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Build a HAL boolean value.
|
||||
*
|
||||
* @param v value
|
||||
* @return HAL value
|
||||
*/
|
||||
inline struct HAL_Value HAL_MakeBoolean(HAL_Bool v) {
|
||||
struct HAL_Value value;
|
||||
value.type = HAL_BOOLEAN;
|
||||
@@ -39,6 +50,12 @@ inline struct HAL_Value HAL_MakeBoolean(HAL_Bool v) {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a HAL enum value.
|
||||
*
|
||||
* @param v value
|
||||
* @return HAL value
|
||||
*/
|
||||
inline struct HAL_Value HAL_MakeEnum(int v) {
|
||||
struct HAL_Value value;
|
||||
value.type = HAL_ENUM;
|
||||
@@ -46,6 +63,12 @@ inline struct HAL_Value HAL_MakeEnum(int v) {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a HAL int value.
|
||||
*
|
||||
* @param v value
|
||||
* @return HAL value
|
||||
*/
|
||||
inline struct HAL_Value HAL_MakeInt(int v) {
|
||||
struct HAL_Value value;
|
||||
value.type = HAL_INT;
|
||||
@@ -53,6 +76,12 @@ inline struct HAL_Value HAL_MakeInt(int v) {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a HAL long value.
|
||||
*
|
||||
* @param v value
|
||||
* @return HAL value
|
||||
*/
|
||||
inline struct HAL_Value HAL_MakeLong(int64_t v) {
|
||||
struct HAL_Value value;
|
||||
value.type = HAL_LONG;
|
||||
@@ -60,6 +89,12 @@ inline struct HAL_Value HAL_MakeLong(int64_t v) {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a HAL double value.
|
||||
*
|
||||
* @param v value
|
||||
* @return HAL value
|
||||
*/
|
||||
inline struct HAL_Value HAL_MakeDouble(double v) {
|
||||
struct HAL_Value value;
|
||||
value.type = HAL_DOUBLE;
|
||||
|
||||
@@ -119,12 +119,19 @@ class PneumaticHub : public PneumaticsBase {
|
||||
int reverseChannel) override;
|
||||
Compressor MakeCompressor() override;
|
||||
|
||||
/** Version and device data received from a REV PH. */
|
||||
struct Version {
|
||||
/** The firmware major version. */
|
||||
uint32_t FirmwareMajor;
|
||||
/** The firmware minor version. */
|
||||
uint32_t FirmwareMinor;
|
||||
/** The firmware fix version. */
|
||||
uint32_t FirmwareFix;
|
||||
/** The hardware minor version. */
|
||||
uint32_t HardwareMinor;
|
||||
/** The hardware major version. */
|
||||
uint32_t HardwareMajor;
|
||||
/** The device's unique ID. */
|
||||
uint32_t UniqueId;
|
||||
};
|
||||
|
||||
@@ -135,28 +142,54 @@ class PneumaticHub : public PneumaticsBase {
|
||||
*/
|
||||
Version GetVersion() const;
|
||||
|
||||
/**
|
||||
* Faults for a REV PH. These faults are only active while the condition is
|
||||
* active.
|
||||
*/
|
||||
struct Faults {
|
||||
/** Fault on channel 0. */
|
||||
uint32_t Channel0Fault : 1;
|
||||
/** Fault on channel 1. */
|
||||
uint32_t Channel1Fault : 1;
|
||||
/** Fault on channel 2. */
|
||||
uint32_t Channel2Fault : 1;
|
||||
/** Fault on channel 3. */
|
||||
uint32_t Channel3Fault : 1;
|
||||
/** Fault on channel 4. */
|
||||
uint32_t Channel4Fault : 1;
|
||||
/** Fault on channel 5. */
|
||||
uint32_t Channel5Fault : 1;
|
||||
/** Fault on channel 6. */
|
||||
uint32_t Channel6Fault : 1;
|
||||
/** Fault on channel 7. */
|
||||
uint32_t Channel7Fault : 1;
|
||||
/** Fault on channel 8. */
|
||||
uint32_t Channel8Fault : 1;
|
||||
/** Fault on channel 9. */
|
||||
uint32_t Channel9Fault : 1;
|
||||
/** Fault on channel 10. */
|
||||
uint32_t Channel10Fault : 1;
|
||||
/** Fault on channel 11. */
|
||||
uint32_t Channel11Fault : 1;
|
||||
/** Fault on channel 12. */
|
||||
uint32_t Channel12Fault : 1;
|
||||
/** Fault on channel 13. */
|
||||
uint32_t Channel13Fault : 1;
|
||||
/** Fault on channel 14. */
|
||||
uint32_t Channel14Fault : 1;
|
||||
/** Fault on channel 15. */
|
||||
uint32_t Channel15Fault : 1;
|
||||
/** An overcurrent event occurred on the compressor output. */
|
||||
uint32_t CompressorOverCurrent : 1;
|
||||
/** The compressor output has an open circuit. */
|
||||
uint32_t CompressorOpen : 1;
|
||||
/** An overcurrent event occurred on a solenoid ouput. */
|
||||
uint32_t SolenoidOverCurrent : 1;
|
||||
/** The input voltage is below the minimum voltage. */
|
||||
uint32_t Brownout : 1;
|
||||
/** A warning was raised by the device's CAN controller. */
|
||||
uint32_t CanWarning : 1;
|
||||
/** The hardware on the device has malfunctioned. */
|
||||
uint32_t HardwareFault : 1;
|
||||
|
||||
/**
|
||||
@@ -176,13 +209,24 @@ class PneumaticHub : public PneumaticsBase {
|
||||
*/
|
||||
Faults GetFaults() const;
|
||||
|
||||
/**
|
||||
* Sticky faults for a REV PH. These faults will remain active until they
|
||||
* are reset by the user.
|
||||
*/
|
||||
struct StickyFaults {
|
||||
/** An overcurrent event occurred on the compressor output. */
|
||||
uint32_t CompressorOverCurrent : 1;
|
||||
/** The compressor output has an open circuit. */
|
||||
uint32_t CompressorOpen : 1;
|
||||
/** An overcurrent event occurred on a solenoid ouput. */
|
||||
uint32_t SolenoidOverCurrent : 1;
|
||||
/** The input voltage is below the minimum voltage. */
|
||||
uint32_t Brownout : 1;
|
||||
/** A warning was raised by the device's CAN controller. */
|
||||
uint32_t CanWarning : 1;
|
||||
/** The device's CAN controller experienced a "Bus Off" event. */
|
||||
uint32_t CanBusOff : 1;
|
||||
/** The device has rebooted. */
|
||||
uint32_t HasReset : 1;
|
||||
};
|
||||
|
||||
|
||||
@@ -155,44 +155,82 @@ class PowerDistribution : public wpi::Sendable,
|
||||
*/
|
||||
void SetSwitchableChannel(bool enabled);
|
||||
|
||||
/** Version and device data received from a PowerDistribution device */
|
||||
struct Version {
|
||||
/** Firmware major version number. */
|
||||
uint32_t FirmwareMajor;
|
||||
/** Firmware minor version number. */
|
||||
uint32_t FirmwareMinor;
|
||||
/** Firmware fix version number. */
|
||||
uint32_t FirmwareFix;
|
||||
/** Hardware minor version number. */
|
||||
uint32_t HardwareMinor;
|
||||
/** Hardware major version number. */
|
||||
uint32_t HardwareMajor;
|
||||
/** Unique ID. */
|
||||
uint32_t UniqueId;
|
||||
};
|
||||
|
||||
Version GetVersion() const;
|
||||
|
||||
/**
|
||||
* Faults for a PowerDistribution device. These faults are only active while
|
||||
* the condition is active.
|
||||
*/
|
||||
struct Faults {
|
||||
/** Breaker fault on channel 0. */
|
||||
uint32_t Channel0BreakerFault : 1;
|
||||
/** Breaker fault on channel 1. */
|
||||
uint32_t Channel1BreakerFault : 1;
|
||||
/** Breaker fault on channel 2. */
|
||||
uint32_t Channel2BreakerFault : 1;
|
||||
/** Breaker fault on channel 3. */
|
||||
uint32_t Channel3BreakerFault : 1;
|
||||
/** Breaker fault on channel 4. */
|
||||
uint32_t Channel4BreakerFault : 1;
|
||||
/** Breaker fault on channel 5. */
|
||||
uint32_t Channel5BreakerFault : 1;
|
||||
/** Breaker fault on channel 6. */
|
||||
uint32_t Channel6BreakerFault : 1;
|
||||
/** Breaker fault on channel 7. */
|
||||
uint32_t Channel7BreakerFault : 1;
|
||||
/** Breaker fault on channel 8. */
|
||||
uint32_t Channel8BreakerFault : 1;
|
||||
/** Breaker fault on channel 9. */
|
||||
uint32_t Channel9BreakerFault : 1;
|
||||
/** Breaker fault on channel 10. */
|
||||
uint32_t Channel10BreakerFault : 1;
|
||||
/** Breaker fault on channel 12. */
|
||||
uint32_t Channel11BreakerFault : 1;
|
||||
/** Breaker fault on channel 13. */
|
||||
uint32_t Channel12BreakerFault : 1;
|
||||
/** Breaker fault on channel 14. */
|
||||
uint32_t Channel13BreakerFault : 1;
|
||||
/** Breaker fault on channel 15. */
|
||||
uint32_t Channel14BreakerFault : 1;
|
||||
/** Breaker fault on channel 16. */
|
||||
uint32_t Channel15BreakerFault : 1;
|
||||
/** Breaker fault on channel 17. */
|
||||
uint32_t Channel16BreakerFault : 1;
|
||||
/** Breaker fault on channel 18. */
|
||||
uint32_t Channel17BreakerFault : 1;
|
||||
/** Breaker fault on channel 19. */
|
||||
uint32_t Channel18BreakerFault : 1;
|
||||
/** Breaker fault on channel 20. */
|
||||
uint32_t Channel19BreakerFault : 1;
|
||||
/** Breaker fault on channel 21. */
|
||||
uint32_t Channel20BreakerFault : 1;
|
||||
/** Breaker fault on channel 22. */
|
||||
uint32_t Channel21BreakerFault : 1;
|
||||
/** Breaker fault on channel 23. */
|
||||
uint32_t Channel22BreakerFault : 1;
|
||||
/** Breaker fault on channel 24. */
|
||||
uint32_t Channel23BreakerFault : 1;
|
||||
/** The input voltage is below the minimum voltage. */
|
||||
uint32_t Brownout : 1;
|
||||
/** A warning was raised by the device's CAN controller. */
|
||||
uint32_t CanWarning : 1;
|
||||
/** The hardware on the device has malfunctioned. */
|
||||
uint32_t HardwareFault : 1;
|
||||
|
||||
/**
|
||||
@@ -208,38 +246,72 @@ class PowerDistribution : public wpi::Sendable,
|
||||
/**
|
||||
* Returns the power distribution faults.
|
||||
*
|
||||
* On a CTRE PDP, this will return an object with no faults active.
|
||||
*
|
||||
* @return The power distribution faults.
|
||||
*/
|
||||
Faults GetFaults() const;
|
||||
|
||||
/**
|
||||
* Sticky faults for a PowerDistribution device. These faults will remain
|
||||
* active until they are reset by the user.
|
||||
*/
|
||||
struct StickyFaults {
|
||||
/** Breaker fault on channel 0. */
|
||||
uint32_t Channel0BreakerFault : 1;
|
||||
/** Breaker fault on channel 1. */
|
||||
uint32_t Channel1BreakerFault : 1;
|
||||
/** Breaker fault on channel 2. */
|
||||
uint32_t Channel2BreakerFault : 1;
|
||||
/** Breaker fault on channel 3. */
|
||||
uint32_t Channel3BreakerFault : 1;
|
||||
/** Breaker fault on channel 4. */
|
||||
uint32_t Channel4BreakerFault : 1;
|
||||
/** Breaker fault on channel 5. */
|
||||
uint32_t Channel5BreakerFault : 1;
|
||||
/** Breaker fault on channel 6. */
|
||||
uint32_t Channel6BreakerFault : 1;
|
||||
/** Breaker fault on channel 7. */
|
||||
uint32_t Channel7BreakerFault : 1;
|
||||
/** Breaker fault on channel 8. */
|
||||
uint32_t Channel8BreakerFault : 1;
|
||||
/** Breaker fault on channel 9. */
|
||||
uint32_t Channel9BreakerFault : 1;
|
||||
/** Breaker fault on channel 10. */
|
||||
uint32_t Channel10BreakerFault : 1;
|
||||
/** Breaker fault on channel 12. */
|
||||
uint32_t Channel11BreakerFault : 1;
|
||||
/** Breaker fault on channel 13. */
|
||||
uint32_t Channel12BreakerFault : 1;
|
||||
/** Breaker fault on channel 14. */
|
||||
uint32_t Channel13BreakerFault : 1;
|
||||
/** Breaker fault on channel 15. */
|
||||
uint32_t Channel14BreakerFault : 1;
|
||||
/** Breaker fault on channel 16. */
|
||||
uint32_t Channel15BreakerFault : 1;
|
||||
/** Breaker fault on channel 17. */
|
||||
uint32_t Channel16BreakerFault : 1;
|
||||
/** Breaker fault on channel 18. */
|
||||
uint32_t Channel17BreakerFault : 1;
|
||||
/** Breaker fault on channel 19. */
|
||||
uint32_t Channel18BreakerFault : 1;
|
||||
/** Breaker fault on channel 20. */
|
||||
uint32_t Channel19BreakerFault : 1;
|
||||
/** Breaker fault on channel 21. */
|
||||
uint32_t Channel20BreakerFault : 1;
|
||||
/** Breaker fault on channel 22. */
|
||||
uint32_t Channel21BreakerFault : 1;
|
||||
/** Breaker fault on channel 23. */
|
||||
uint32_t Channel22BreakerFault : 1;
|
||||
/** Breaker fault on channel 24. */
|
||||
uint32_t Channel23BreakerFault : 1;
|
||||
/** The input voltage is below the minimum voltage. */
|
||||
uint32_t Brownout : 1;
|
||||
/** A warning was raised by the device's CAN controller. */
|
||||
uint32_t CanWarning : 1;
|
||||
/** The device's CAN controller experienced a "Bus Off" event. */
|
||||
uint32_t CanBusOff : 1;
|
||||
/** The device has rebooted. */
|
||||
uint32_t HasReset : 1;
|
||||
|
||||
/**
|
||||
@@ -256,6 +328,8 @@ class PowerDistribution : public wpi::Sendable,
|
||||
/**
|
||||
* Returns the power distribution sticky faults.
|
||||
*
|
||||
* On a CTRE PDP, this will return an object with no faults active.
|
||||
*
|
||||
* @return The power distribution sticky faults.
|
||||
*/
|
||||
StickyFaults GetStickyFaults() const;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class PowerDistribution implements Sendable, AutoCloseable {
|
||||
|
||||
/** Power distribution module type. */
|
||||
public enum ModuleType {
|
||||
/** CTRE (Cross The Road Electronics) CTRE Power Distribution Panel (PDP). */
|
||||
/** CTRE (Cross The Road Electronics) Power Distribution Panel (PDP). */
|
||||
kCTRE(PowerDistributionJNI.CTRE_TYPE),
|
||||
/** REV Power Distribution Hub (PDH). */
|
||||
kRev(PowerDistributionJNI.REV_TYPE);
|
||||
@@ -222,6 +222,8 @@ public class PowerDistribution implements Sendable, AutoCloseable {
|
||||
/**
|
||||
* Returns the power distribution faults.
|
||||
*
|
||||
* <p>On a CTRE PDP, this will return an object with no faults active.
|
||||
*
|
||||
* @return The power distribution faults.
|
||||
*/
|
||||
public PowerDistributionFaults getFaults() {
|
||||
@@ -231,6 +233,8 @@ public class PowerDistribution implements Sendable, AutoCloseable {
|
||||
/**
|
||||
* Returns the power distribution sticky faults.
|
||||
*
|
||||
* <p>On a CTRE PDP, this will return an object with no faults active.
|
||||
*
|
||||
* @return The power distribution sticky faults.
|
||||
*/
|
||||
public PowerDistributionStickyFaults getStickyFaults() {
|
||||
|
||||
Reference in New Issue
Block a user