[docs] Add missing docs to enum fields (NFC) (#6150)

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
This commit is contained in:
m10653
2024-01-05 00:36:26 -05:00
committed by GitHub
parent 4210f5635d
commit 13f4460e00
49 changed files with 665 additions and 26 deletions

View File

@@ -304,7 +304,9 @@ public class CameraServerJNI {
// Telemetry Functions
//
public enum TelemetryKind {
/** kSourceBytesReceived. */
kSourceBytesReceived(1),
/** kSourceFramesReceived. */
kSourceFramesReceived(2);
private final int value;

View File

@@ -7,9 +7,13 @@ package edu.wpi.first.cscore;
/** A source that represents a MJPEG-over-HTTP (IP) camera. */
public class HttpCamera extends VideoCamera {
public enum HttpCameraKind {
/** Unknown camera kind. */
kUnknown(0),
/** MJPG Streamer camera. */
kMJPGStreamer(1),
/** CS Core camera. */
kCSCore(2),
/** Axis camera. */
kAxis(3);
private final int value;

View File

@@ -8,26 +8,47 @@ package edu.wpi.first.cscore;
@SuppressWarnings("MemberName")
public class VideoEvent {
public enum Kind {
/** Unknown video event. */
kUnknown(0x0000),
/** Source Created event. */
kSourceCreated(0x0001),
/** Source Destroyed event. */
kSourceDestroyed(0x0002),
/** Source Connected event. */
kSourceConnected(0x0004),
/** Source Disconnected event. */
kSourceDisconnected(0x0008),
/** Source Video Modes Updated event. */
kSourceVideoModesUpdated(0x0010),
/** Source VideoMode Changed event. */
kSourceVideoModeChanged(0x0020),
/** Source Property Created event. */
kSourcePropertyCreated(0x0040),
/** Source Property Value Updated event. */
kSourcePropertyValueUpdated(0x0080),
/** Source Property Choices Updated event. */
kSourcePropertyChoicesUpdated(0x0100),
/** Sink Source Changed event. */
kSinkSourceChanged(0x0200),
/** Sink Created event. */
kSinkCreated(0x0400),
/** Sink Destroyed event. */
kSinkDestroyed(0x0800),
/** Sink Enabled event. */
kSinkEnabled(0x1000),
/** Sink Disabled event. */
kSinkDisabled(0x2000),
/** Network Interfaces Changed event. */
kNetworkInterfacesChanged(0x4000),
/** Telemetry Updated event. */
kTelemetryUpdated(0x8000),
/** Sink Property Created event. */
kSinkPropertyCreated(0x10000),
/** Sink Property Value Updated event. */
kSinkPropertyValueUpdated(0x20000),
/** Sink Property Choices Updated event. */
kSinkPropertyChoicesUpdated(0x40000),
/** Usb Cameras Changed event. */
kUsbCamerasChanged(0x80000);
private final int value;

View File

@@ -6,11 +6,17 @@ package edu.wpi.first.cscore;
/** A source or sink property. */
public class VideoProperty {
/** VideoProperty property types. */
public enum Kind {
/** No specific property. */
kNone(0),
/** Boolean property. */
kBoolean(1),
/** Integer property. */
kInteger(2),
/** String property. */
kString(4),
/** Enum property. */
kEnum(8);
private final int value;

View File

@@ -9,10 +9,15 @@ package edu.wpi.first.cscore;
* (e.g. from a stereo or depth camera); these are called channels.
*/
public class VideoSink implements AutoCloseable {
/** Video sink types. */
public enum Kind {
/** Unknown video sink type. */
kUnknown(0),
/** MJPEG video sink. */
kMjpeg(2),
/** CV video sink. */
kCv(4),
/** Raw video sink. */
kRaw(8);
private final int value;

View File

@@ -12,10 +12,15 @@ import edu.wpi.first.util.PixelFormat;
*/
public class VideoSource implements AutoCloseable {
public enum Kind {
/** Unknown video source. */
kUnknown(0),
/** USB video source. */
kUsb(1),
/** HTTP video source. */
kHttp(2),
/** CV video source. */
kCv(4),
/** Raw video source. */
kRaw(8);
private final int value;

View File

@@ -44,10 +44,15 @@ class VideoProperty {
public:
enum Kind {
/// No specific property.
kNone = CS_PROP_NONE,
/// Boolean property.
kBoolean = CS_PROP_BOOLEAN,
/// Integer property.
kInteger = CS_PROP_INTEGER,
/// String property.
kString = CS_PROP_STRING,
/// Enum property.
kEnum = CS_PROP_ENUM
};
@@ -100,9 +105,13 @@ class VideoSource {
public:
enum Kind {
/// Unknown video source.
kUnknown = CS_SOURCE_UNKNOWN,
/// USB video source.
kUsb = CS_SOURCE_USB,
/// HTTP video source.
kHttp = CS_SOURCE_HTTP,
/// CV video source.
kCv = CS_SOURCE_CV
};
@@ -471,9 +480,13 @@ class UsbCamera : public VideoCamera {
class HttpCamera : public VideoCamera {
public:
enum HttpCameraKind {
/// Unknown camera kind.
kUnknown = CS_HTTP_UNKNOWN,
/// MJPG Streamer camera.
kMJPGStreamer = CS_HTTP_MJPGSTREAMER,
/// CS Core camera.
kCSCore = CS_HTTP_CSCORE,
/// Axis camera.
kAxis = CS_HTTP_AXIS
};
@@ -716,8 +729,11 @@ class VideoSink {
public:
enum Kind {
/// Unknown sink type.
kUnknown = CS_SINK_UNKNOWN,
/// MJPEG video sink.
kMjpeg = CS_SINK_MJPEG,
/// CV video sink.
kCv = CS_SINK_CV
};

View File

@@ -23,18 +23,31 @@ public final class CANAPITypes {
* Device Types</a>
*/
public enum CANDeviceType {
/** Broadcast. */
kBroadcast(0),
/** Robot controller. */
kRobotController(1),
/** Motor controller. */
kMotorController(2),
/** Relay controller. */
kRelayController(3),
/** Gyro sensor. */
kGyroSensor(4),
/** Accelerometer. */
kAccelerometer(5),
/** Ultrasonic sensor. */
kUltrasonicSensor(6),
/** Gear tooth sensor. */
kGearToothSensor(7),
/** Power distribution. */
kPowerDistribution(8),
/** Pneumatics. */
kPneumatics(9),
/** Miscellaneous. */
kMiscellaneous(10),
/** IO breakout. */
kIOBreakout(11),
/** Firmware update. */
kFirmwareUpdate(31);
@SuppressWarnings("PMD.MemberName")
@@ -56,22 +69,39 @@ public final class CANAPITypes {
* Manufacturer IDs</a>
*/
public enum CANManufacturer {
/** Broadcast. */
kBroadcast(0),
/** National Instruments. */
kNI(1),
/** Luminary Micro. */
kLM(2),
/** DEKA Research and Development Corp. */
kDEKA(3),
/** Cross the Road Electronics. */
kCTRE(4),
/** REV Robotics. */
kREV(5),
/** Grapple. */
kGrapple(6),
/** MindSensors. */
kMS(7),
/** Team use. */
kTeamUse(8),
/** Kauai Labs. */
kKauaiLabs(9),
/** Copperforge. */
kCopperforge(10),
/** Playing With Fusion. */
kPWF(11),
/** Studica. */
kStudica(12),
/** TheThriftyBot. */
kTheThriftyBot(13),
/** Redux Robotics. */
kReduxRobotics(14),
/** AndyMark. */
kAndyMark(15),
/** Vivid-Hosting. */
kVividHosting(16);
@SuppressWarnings("PMD.MemberName")

View File

@@ -16,9 +16,13 @@ package edu.wpi.first.hal;
* edu.wpi.first.wpilibj.ADXRS450_Gyro} for an example implementation.
*/
public class SimDevice implements AutoCloseable {
/** Sim device direction. */
public enum Direction {
/** Input direction for simulation devices. */
kInput(SimDeviceJNI.kInput),
/** Output direction for simulation devices. */
kOutput(SimDeviceJNI.kOutput),
/** Bidirectional direction for simulation devices. */
kBidir(SimDeviceJNI.kBidir);
public final int m_value;

View File

@@ -20,18 +20,31 @@
* Teams should use HAL_CAN_Dev_kMiscellaneous
*/
HAL_ENUM(HAL_CANDeviceType) {
/// Broadcast.
HAL_CAN_Dev_kBroadcast = 0,
/// Robot controller.
HAL_CAN_Dev_kRobotController = 1,
/// Motor controller.
HAL_CAN_Dev_kMotorController = 2,
/// Relay controller.
HAL_CAN_Dev_kRelayController = 3,
/// Gyro sensor.
HAL_CAN_Dev_kGyroSensor = 4,
/// Accelerometer.
HAL_CAN_Dev_kAccelerometer = 5,
/// Ultrasonic sensor.
HAL_CAN_Dev_kUltrasonicSensor = 6,
/// Gear tooth sensor.
HAL_CAN_Dev_kGearToothSensor = 7,
/// Power distribution.
HAL_CAN_Dev_kPowerDistribution = 8,
/// Pneumatics.
HAL_CAN_Dev_kPneumatics = 9,
/// Miscellaneous.
HAL_CAN_Dev_kMiscellaneous = 10,
/// IO breakout.
HAL_CAN_Dev_kIOBreakout = 11,
/// Firmware update.
HAL_CAN_Dev_kFirmwareUpdate = 31
};
@@ -41,22 +54,39 @@ HAL_ENUM(HAL_CANDeviceType) {
* Teams should use HAL_CAN_Man_kTeamUse.
*/
HAL_ENUM(HAL_CANManufacturer) {
/// Broadcast.
HAL_CAN_Man_kBroadcast = 0,
/// National Instruments.
HAL_CAN_Man_kNI = 1,
/// Luminary Micro.
HAL_CAN_Man_kLM = 2,
/// DEKA Research and Development Corp.
HAL_CAN_Man_kDEKA = 3,
/// Cross the Road Electronics.
HAL_CAN_Man_kCTRE = 4,
/// REV robotics.
HAL_CAN_Man_kREV = 5,
/// Grapple.
HAL_CAN_Man_kGrapple = 6,
/// MindSensors.
HAL_CAN_Man_kMS = 7,
/// Team use.
HAL_CAN_Man_kTeamUse = 8,
/// Kauai Labs.
HAL_CAN_Man_kKauaiLabs = 9,
/// Copperforge.
HAL_CAN_Man_kCopperforge = 10,
/// Playing With Fusion.
HAL_CAN_Man_kPWF = 11,
/// Studica.
HAL_CAN_Man_kStudica = 12,
/// TheThriftyBot.
HAL_CAN_Man_kTheThriftyBot = 13,
/// Redux Robotics.
HAL_CAN_Man_kReduxRobotics = 14,
/// AndyMark.
HAL_CAN_Man_kAndyMark = 15,
/// Vivid-Hosting.
HAL_CAN_Man_kVividHosting = 16
};
/** @} */

View File

@@ -6,17 +6,29 @@ package edu.wpi.first.networktables;
/** Network table data types. */
public enum NetworkTableType {
/** Unassigned data type. */
kUnassigned(0, ""),
/** Boolean data type. */
kBoolean(0x01, "boolean"),
/** Double precision floating-point data type. */
kDouble(0x02, "double"),
/** String data type. */
kString(0x04, "string"),
/** Raw data type. */
kRaw(0x08, "raw"),
/** Boolean array data type. */
kBooleanArray(0x10, "boolean[]"),
/** Double precision floating-point array data type. */
kDoubleArray(0x20, "double[]"),
/** String array data type. */
kStringArray(0x40, "string[]"),
/** Integer data type. */
kInteger(0x100, "int"),
/** Single precision floating-point data type. */
kFloat(0x200, "float"),
/** Integer array data type. */
kIntegerArray(0x400, "int[]"),
/** Single precision floating-point array data type. */
kFloatArray(0x800, "float[]");
private final int m_value;

View File

@@ -13,17 +13,29 @@ namespace nt {
* @ingroup ntcore_cpp_api
*/
enum class NetworkTableType {
/// Unassigned data type.
kUnassigned = NT_UNASSIGNED,
/// Boolean data type.
kBoolean = NT_BOOLEAN,
/// Double precision floating-point data type.
kDouble = NT_DOUBLE,
/// String data type.
kString = NT_STRING,
/// Raw data type.
kRaw = NT_RAW,
/// Boolean array data type.
kBooleanArray = NT_BOOLEAN_ARRAY,
/// Double precision floating-point array data type.
kDoubleArray = NT_DOUBLE_ARRAY,
/// String array data type.
kStringArray = NT_STRING_ARRAY,
/// Integer data type.
kInteger = NT_INTEGER,
/// Single precision floating-point data type.
kFloat = NT_FLOAT,
/// Integer array data type.
kIntegerArray = NT_INTEGER_ARRAY,
/// Single precision floating-point array data type.
kFloatArray = NT_FLOAT_ARRAY
};

View File

@@ -20,8 +20,11 @@ namespace frc {
class DMASample : public HAL_DMASample {
public:
enum class DMAReadStatus {
/// OK status.
kOk = HAL_DMA_OK,
/// Timeout status.
kTimeout = HAL_DMA_TIMEOUT,
/// Error status.
kError = HAL_DMA_ERROR
};

View File

@@ -25,7 +25,17 @@ namespace frc {
class DoubleSolenoid : public wpi::Sendable,
public wpi::SendableHelper<DoubleSolenoid> {
public:
enum Value { kOff, kForward, kReverse };
/**
* Possible values for a DoubleSolenoid.
*/
enum Value {
/// Off position.
kOff,
/// Forward position.
kForward,
/// Reverse position.
kReverse
};
/**
* Constructs a double solenoid for a specified module of a specific module

View File

@@ -22,9 +22,31 @@ namespace frc {
*/
class DriverStation final {
public:
enum Alliance { kRed, kBlue };
enum MatchType { kNone, kPractice, kQualification, kElimination };
/**
* The robot alliance that the robot is a part of.
*/
enum Alliance {
/// Red alliance.
kRed,
/// Blue alliance.
kBlue
};
/**
* The type of robot match that the robot is part of.
*/
enum MatchType {
/// None.
kNone,
/// Practice.
kPractice,
/// Qualification.
kQualification,
/// Elimination.
kElimination
};
/// Number of Joystick ports.
static constexpr int kJoystickPorts = 6;
/**

View File

@@ -42,10 +42,17 @@ class Encoder : public CounterBase,
friend class DMASample;
public:
/**
* Encoder indexing types.
*/
enum IndexingType {
/// Reset while the signal is high.
kResetWhileHigh,
/// Reset while the signal is low.
kResetWhileLow,
/// Reset on falling edge of the signal.
kResetOnFallingEdge,
/// Reset on rising edge of the signal.
kResetOnRisingEdge
};

View File

@@ -23,25 +23,55 @@ class EventLoop;
*/
class GenericHID {
public:
enum RumbleType { kLeftRumble, kRightRumble, kBothRumble };
/**
* Represents a rumble output on the Joystick.
*/
enum RumbleType {
/// Left rumble motor.
kLeftRumble,
/// Right rumble motor.
kRightRumble,
/// Both left and right rumble motors.
kBothRumble
};
/**
* USB HID interface type.
*/
enum HIDType {
/// Unknown.
kUnknown = -1,
/// XInputUnknown.
kXInputUnknown = 0,
/// XInputGamepad.
kXInputGamepad = 1,
/// XInputWheel.
kXInputWheel = 2,
/// XInputArcadeStick.
kXInputArcadeStick = 3,
/// XInputFlightStick.
kXInputFlightStick = 4,
/// XInputDancePad.
kXInputDancePad = 5,
/// XInputGuitar.
kXInputGuitar = 6,
/// XInputGuitar2.
kXInputGuitar2 = 7,
/// XInputDrumKit.
kXInputDrumKit = 8,
/// XInputGuitar3.
kXInputGuitar3 = 11,
/// XInputArcadePad.
kXInputArcadePad = 19,
/// HIDJoystick.
kHIDJoystick = 20,
/// HIDGamepad.
kHIDGamepad = 21,
/// HIDDriving.
kHIDDriving = 22,
/// HIDFlight.
kHIDFlight = 23,
/// HID1stPerson.
kHID1stPerson = 24
};

View File

@@ -22,7 +22,15 @@ namespace frc {
*/
class I2C {
public:
enum Port { kOnboard = 0, kMXP };
/**
* I2C connection ports.
*/
enum Port {
/// Onboard I2C port.
kOnboard = 0,
/// MXP (roboRIO MXP) I2C port.
kMXP
};
/**
* Constructor.

View File

@@ -28,8 +28,31 @@ class Joystick : public GenericHID {
static constexpr int kDefaultTwistChannel = 2;
static constexpr int kDefaultThrottleChannel = 3;
enum AxisType { kXAxis, kYAxis, kZAxis, kTwistAxis, kThrottleAxis };
enum ButtonType { kTriggerButton, kTopButton };
/**
* Represents an analog axis on a joystick.
*/
enum AxisType {
/// X axis.
kXAxis,
/// Y axis.
kYAxis,
/// Z axis.
kZAxis,
/// Twist axis.
kTwistAxis,
/// Throttle axis.
kThrottleAxis
};
/**
* Represents a digital button on a joystick.
*/
enum ButtonType {
/// kTrigger.
kTriggerButton,
/// kTop.
kTopButton
};
/**
* Construct an instance of a joystick.

View File

@@ -503,29 +503,55 @@ class PS4Controller : public GenericHID {
*/
BooleanEvent Touchpad(EventLoop* loop) const;
/**
* Represents a digital button on a PS4Controller.
*/
struct Button {
/// Square button.
static constexpr int kSquare = 1;
/// X button.
static constexpr int kCross = 2;
/// Circle button.
static constexpr int kCircle = 3;
/// Triangle button.
static constexpr int kTriangle = 4;
/// Left Trigger 1 button.
static constexpr int kL1 = 5;
/// Right Trigger 1 button.
static constexpr int kR1 = 6;
/// Left Trigger 2 button.
static constexpr int kL2 = 7;
/// Right Trigger 2 button.
static constexpr int kR2 = 8;
/// Share button.
static constexpr int kShare = 9;
/// Option button.
static constexpr int kOptions = 10;
/// Left stick button.
static constexpr int kL3 = 11;
/// Right stick button.
static constexpr int kR3 = 12;
/// PlayStation button.
static constexpr int kPS = 13;
/// Touchpad click button.
static constexpr int kTouchpad = 14;
};
/**
* Represents an axis on a PS4Controller.
*/
struct Axis {
/// Left X axis.
static constexpr int kLeftX = 0;
/// Left Y axis.
static constexpr int kLeftY = 1;
/// Right X axis.
static constexpr int kRightX = 2;
/// Right Y axis.
static constexpr int kRightY = 5;
/// Left Trigger 2.
static constexpr int kL2 = 3;
/// Right Trigger 2.
static constexpr int kR2 = 4;
};
};

View File

@@ -503,29 +503,55 @@ class PS5Controller : public GenericHID {
*/
BooleanEvent Touchpad(EventLoop* loop) const;
/**
* Represents a digital button on a PS5Controller.
*/
struct Button {
/// Square button.
static constexpr int kSquare = 1;
/// X button.
static constexpr int kCross = 2;
/// Circle button.
static constexpr int kCircle = 3;
/// Triangle button.
static constexpr int kTriangle = 4;
/// Left trigger 1 button.
static constexpr int kL1 = 5;
/// Right trigger 1 button.
static constexpr int kR1 = 6;
/// Left trigger 2 button.
static constexpr int kL2 = 7;
/// Right trigger 2 button.
static constexpr int kR2 = 8;
/// Create button.
static constexpr int kCreate = 9;
/// Options button.
static constexpr int kOptions = 10;
/// Left stick button.
static constexpr int kL3 = 11;
/// Right stick button.
static constexpr int kR3 = 12;
/// PlayStation button.
static constexpr int kPS = 13;
/// Touchpad click button.
static constexpr int kTouchpad = 14;
};
/**
* Represents an axis on a PS5Controller.
*/
struct Axis {
/// Left X axis.
static constexpr int kLeftX = 0;
/// Left Y axis.
static constexpr int kLeftY = 1;
/// Right X axis.
static constexpr int kRightX = 2;
/// Right Y axis.
static constexpr int kRightY = 5;
/// Left Trigger 2.
static constexpr int kL2 = 3;
/// Right Trigger 2.
static constexpr int kR2 = 4;
};
};

View File

@@ -18,7 +18,16 @@ class PowerDistribution : public wpi::Sendable,
public wpi::SendableHelper<PowerDistribution> {
public:
static constexpr int kDefaultModule = -1;
enum class ModuleType { kCTRE = 1, kRev = 2 };
/**
* Power distribution module type.
*/
enum class ModuleType {
/// CTRE (Cross The Road Electronics) CTRE Power Distribution Panel (PDP).
kCTRE = 1,
/// REV Power Distribution Hub (PDH).
kRev = 2
};
/**
* Constructs a PowerDistribution object.

View File

@@ -31,8 +31,31 @@ class Relay : public MotorSafety,
public wpi::Sendable,
public wpi::SendableHelper<Relay> {
public:
enum Value { kOff, kOn, kForward, kReverse };
enum Direction { kBothDirections, kForwardOnly, kReverseOnly };
/**
* The state to drive a Relay to.
*/
enum Value {
/// Off.
kOff,
/// On.
kOn,
/// Forward.
kForward,
/// Reverse.
kReverse
};
/**
* The Direction(s) that a relay is configured to operate in.
*/
enum Direction {
/// Both directions are valid.
kBothDirections,
/// Only forward is valid.
kForwardOnly,
/// Only reverse is valid.
kReverseOnly
};
/**
* Relay constructor given a channel.

View File

@@ -25,14 +25,34 @@ class DigitalSource;
*/
class SPI {
public:
enum Port { kOnboardCS0 = 0, kOnboardCS1, kOnboardCS2, kOnboardCS3, kMXP };
/**
* SPI port.
*/
enum Port {
/// Onboard SPI bus port CS0.
kOnboardCS0 = 0,
/// Onboard SPI bus port CS1.
kOnboardCS1,
/// Onboard SPI bus port CS2.
kOnboardCS2,
/// Onboard SPI bus port CS3.
kOnboardCS3,
/// MXP (roboRIO MXP) SPI bus port.
kMXP
};
/**
* SPI mode.
*/
enum Mode {
kMode0 = HAL_SPI_kMode0, /*!< Clock idle low, data sampled on rising edge */
kMode1 =
HAL_SPI_kMode1, /*!< Clock idle low, data sampled on falling edge */
kMode2 =
HAL_SPI_kMode2, /*!< Clock idle high, data sampled on falling edge */
kMode3 = HAL_SPI_kMode3 /*!< Clock idle high, data sampled on rising edge */
/// Clock idle low, data sampled on rising edge.
kMode0 = HAL_SPI_kMode0,
/// Clock idle low, data sampled on falling edge.
kMode1 = HAL_SPI_kMode1,
/// Clock idle high, data sampled on falling edge.
kMode2 = HAL_SPI_kMode2,
/// Clock idle high, data sampled on rising edge.
kMode3 = HAL_SPI_kMode3
};
/**

View File

@@ -26,30 +26,73 @@ namespace frc {
*/
class SerialPort {
public:
/**
* Serial port.
*/
enum Port {
/// Onboard serial port on the roboRIO.
kOnboard = 0,
/// MXP (roboRIO MXP) serial port.
kMXP = 1,
/// USB serial port (same as KUSB1).
kUSB = 2,
/// USB serial port 1.
kUSB1 = 2,
/// USB serial port 2.
kUSB2 = 3
};
/**
* Represents the parity to use for serial communications.
*/
enum Parity {
/// No parity.
kParity_None = 0,
/// Odd parity.
kParity_Odd = 1,
/// Even parity.
kParity_Even = 2,
/// Parity bit always on.
kParity_Mark = 3,
/// Parity bit always off.
kParity_Space = 4
};
/**
* Represents the number of stop bits to use for Serial Communication.
*/
enum StopBits {
/// One stop bit.
kStopBits_One = 10,
/// One and a half stop bits.
kStopBits_OnePointFive = 15,
/// Two stop bits.
kStopBits_Two = 20
};
/**
* Represents what type of flow control to use for serial communication.
*/
enum FlowControl {
/// No flow control.
kFlowControl_None = 0,
/// XON/XOFF flow control.
kFlowControl_XonXoff = 1,
/// RTS/CTS flow control.
kFlowControl_RtsCts = 2,
/// DTS/DSR flow control.
kFlowControl_DtrDsr = 4
};
enum WriteBufferMode { kFlushOnAccess = 1, kFlushWhenFull = 2 };
enum Port { kOnboard = 0, kMXP = 1, kUSB = 2, kUSB1 = 2, kUSB2 = 3 };
/**
* Represents which type of buffer mode to use when writing to a serial port.
*/
enum WriteBufferMode {
/// Flush the buffer on each access.
kFlushOnAccess = 1,
/// Flush the buffer when it is full.
kFlushWhenFull = 2
};
/**
* Create an instance of a Serial Port class.

View File

@@ -514,28 +514,53 @@ class StadiaController : public GenericHID {
*/
BooleanEvent RightTrigger(EventLoop* loop) const;
/**
* Represents a digital button on a StadiaController.
*/
struct Button {
/// A button.
static constexpr int kA = 1;
/// B button.
static constexpr int kB = 2;
/// X button.
static constexpr int kX = 3;
/// Y button.
static constexpr int kY = 4;
/// Left bumper button.
static constexpr int kLeftBumper = 5;
/// Right bumper button.
static constexpr int kRightBumper = 6;
/// Left stick button.
static constexpr int kLeftStick = 7;
/// Right stick button.
static constexpr int kRightStick = 8;
/// Ellipses button.
static constexpr int kEllipses = 9;
/// Hamburger button.
static constexpr int kHamburger = 10;
/// Stadia button.
static constexpr int kStadia = 11;
/// Right trigger button.
static constexpr int kRightTrigger = 12;
/// Left trigger button.
static constexpr int kLeftTrigger = 13;
/// Google button.
static constexpr int kGoogle = 14;
/// Frame button.
static constexpr int kFrame = 15;
};
/**
* Represents an axis on a StadiaController.
*/
struct Axis {
/// Left X axis.
static constexpr int kLeftX = 0;
/// Right X axis.
static constexpr int kRightX = 4;
/// Left Y axis.
static constexpr int kLeftY = 1;
/// Right Y axis.
static constexpr int kRightY = 5;
};
};

View File

@@ -25,9 +25,13 @@ class SynchronousInterrupt {
* Event trigger combinations for a synchronous interrupt.
*/
enum WaitResult {
/// Timeout event.
kTimeout = 0x0,
/// Rising edge event.
kRisingEdge = 0x1,
/// Falling edge event.
kFallingEdge = 0x100,
/// Both rising and falling edge events.
kBoth = 0x101,
};

View File

@@ -5,10 +5,17 @@
#pragma once
namespace frc {
/**
* Edge configuration.
*/
enum class EdgeConfiguration {
/// No edge configuration (neither rising nor falling).
kNone = 0,
/// Rising edge configuration.
kRisingEdge = 0x1,
/// Falling edge configuration.
kFallingEdge = 0x2,
/// Both rising and falling edges configuration.
kBoth = 0x3
};
} // namespace frc

View File

@@ -23,12 +23,19 @@ class RobotDriveBase : public MotorSafety {
* The location of a motor on the robot for the purpose of driving.
*/
enum MotorType {
/// Front-left motor.
kFrontLeft = 0,
/// Front-right motor.
kFrontRight = 1,
/// Rear-left motor.
kRearLeft = 2,
/// Rear-right motor.
kRearRight = 3,
/// Left motor.
kLeft = 0,
/// Right motor.
kRight = 1,
/// Back motor.
kBack = 2
};

View File

@@ -210,32 +210,54 @@ class DifferentialDrivetrainSim {
*/
class KitbotGearing {
public:
/// Gear ratio of 12.75:1.
static constexpr double k12p75 = 12.75;
/// Gear ratio of 10.71:1.
static constexpr double k10p71 = 10.71;
/// Gear ratio of 8.45:1.
static constexpr double k8p45 = 8.45;
/// Gear ratio of 7.31:1.
static constexpr double k7p31 = 7.31;
/// Gear ratio of 5.95:1.
static constexpr double k5p95 = 5.95;
};
/**
* Represents common motor layouts of the kit drivetrain.
*/
class KitbotMotor {
public:
/// One CIM motor per drive side.
static constexpr frc::DCMotor SingleCIMPerSide = frc::DCMotor::CIM(1);
/// Two CIM motors per drive side.
static constexpr frc::DCMotor DualCIMPerSide = frc::DCMotor::CIM(2);
/// One Mini CIM motor per drive side.
static constexpr frc::DCMotor SingleMiniCIMPerSide =
frc::DCMotor::MiniCIM(1);
/// Two Mini CIM motors per drive side.
static constexpr frc::DCMotor DualMiniCIMPerSide = frc::DCMotor::MiniCIM(2);
/// One Falcon 500 motor per drive side.
static constexpr frc::DCMotor SingleFalcon500PerSide =
frc::DCMotor::Falcon500(1);
/// Two Falcon 500 motors per drive side.
static constexpr frc::DCMotor DualFalcon500PerSide =
frc::DCMotor::Falcon500(2);
/// One NEO motor per drive side.
static constexpr frc::DCMotor SingleNEOPerSide = frc::DCMotor::NEO(1);
/// Two NEO motors per drive side.
static constexpr frc::DCMotor DualNEOPerSide = frc::DCMotor::NEO(2);
};
/**
* Represents common wheel sizes of the kit drivetrain.
*/
class KitbotWheelSize {
public:
/// Six inch diameter wheels.
static constexpr units::meter_t kSixInch = 6_in;
/// Eight inch diameter wheels.
static constexpr units::meter_t kEightInch = 8_in;
/// Ten inch diameter wheels.
static constexpr units::meter_t kTenInch = 10_in;
};

View File

@@ -9,8 +9,11 @@ import edu.wpi.first.hal.DMAJNISample;
public class DMASample {
public enum DMAReadStatus {
/** OK status. */
kOk(1),
/** Timeout status. */
kTimeout(2),
/** Error status. */
kError(3);
private final int value;

View File

@@ -21,8 +21,11 @@ import edu.wpi.first.util.sendable.SendableRegistry;
public class DoubleSolenoid implements Sendable, AutoCloseable {
/** Possible values for a DoubleSolenoid. */
public enum Value {
/** Off position. */
kOff,
/** Forward position. */
kForward,
/** Reverse position. */
kReverse
}

View File

@@ -29,7 +29,7 @@ import java.util.concurrent.locks.ReentrantLock;
/** Provide access to the network communication data to / from the Driver Station. */
public final class DriverStation {
/** Number of Joystick Ports. */
/** Number of Joystick ports. */
public static final int kJoystickPorts = 6;
private static class HALJoystickButtons {
@@ -69,14 +69,21 @@ public final class DriverStation {
/** The robot alliance that the robot is a part of. */
public enum Alliance {
/** Red alliance. */
Red,
/** Blue alliance. */
Blue
}
/** The type of robot match that the robot is part of. */
public enum MatchType {
/** None. */
None,
/** Practice. */
Practice,
/** Qualification. */
Qualification,
/** Elimination. */
Elimination
}

View File

@@ -29,10 +29,15 @@ import edu.wpi.first.util.sendable.SendableRegistry;
* before use.
*/
public class Encoder implements CounterBase, Sendable, AutoCloseable {
/** Encoder indexing types. */
public enum IndexingType {
/** Reset while the signal is high. */
kResetWhileHigh(0),
/** Reset while the signal is low. */
kResetWhileLow(1),
/** Reset on falling edge of the signal. */
kResetOnFallingEdge(2),
/** Reset on rising edge of the signal. */
kResetOnRisingEdge(3);
public final int value;

View File

@@ -19,30 +19,51 @@ import java.util.Map;
* the mapping of ports to hardware buttons depends on the code in the Driver Station.
*/
public class GenericHID {
/** Represents a rumble output on the JoyStick. */
/** Represents a rumble output on the Joystick. */
public enum RumbleType {
/** Left rumble motor. */
kLeftRumble,
/** Right rumble motor. */
kRightRumble,
/** Both left and right rumble motors. */
kBothRumble
}
/** USB HID interface type. */
public enum HIDType {
/** Unknown. */
kUnknown(-1),
/** XInputUnknown. */
kXInputUnknown(0),
/** XInputGamepad. */
kXInputGamepad(1),
/** XInputWheel. */
kXInputWheel(2),
/** XInputArcadeStick. */
kXInputArcadeStick(3),
/** XInputFlightStick. */
kXInputFlightStick(4),
/** XInputDancePad. */
kXInputDancePad(5),
/** XInputGuitar. */
kXInputGuitar(6),
/** XInputGuitar2. */
kXInputGuitar2(7),
/** XInputDrumKit. */
kXInputDrumKit(8),
/** XInputGuitar3. */
kXInputGuitar3(11),
/** XInputArcadePad. */
kXInputArcadePad(19),
/** HIDJoystick. */
kHIDJoystick(20),
/** HIDGamepad. */
kHIDGamepad(21),
/** HIDDriving. */
kHIDDriving(22),
/** HIDFlight. */
kHIDFlight(23),
/** HID1stPerson. */
kHID1stPerson(24);
public final int value;

View File

@@ -23,8 +23,11 @@ import java.nio.ByteBuffer;
* WPILib Known Issues</a> page for details.
*/
public class I2C implements AutoCloseable {
/** I2C connection ports. */
public enum Port {
/** Onboard I2C port. */
kOnboard(0),
/** MXP (roboRIO MXP) I2C port. */
kMXP(1);
public final int value;

View File

@@ -25,10 +25,15 @@ public class Joystick extends GenericHID {
/** Represents an analog axis on a joystick. */
public enum AxisType {
/** X axis. */
kX(0),
/** Y axis. */
kY(1),
/** Z axis. */
kZ(2),
/** Twist axis. */
kTwist(3),
/** Throttle axis. */
kThrottle(4);
public final int value;
@@ -40,7 +45,9 @@ public class Joystick extends GenericHID {
/** Represents a digital button on a joystick. */
public enum ButtonType {
/** kTrigger. */
kTrigger(1),
/** kTop. */
kTop(2);
public final int value;

View File

@@ -34,19 +34,33 @@ public class PS4Controller extends GenericHID {
/** Represents a digital button on a PS4Controller. */
public enum Button {
/** Square button. */
kSquare(1),
/** X button. */
kCross(2),
/** Circle button. */
kCircle(3),
/** Triangle button. */
kTriangle(4),
/** Left Trigger 1 button. */
kL1(5),
/** Right Trigger 1 button. */
kR1(6),
/** Left Trigger 2 button. */
kL2(7),
/** Right Trigger 2 button. */
kR2(8),
/** Share button. */
kShare(9),
/** Option button. */
kOptions(10),
/** Left stick button. */
kL3(11),
/** Right stick button. */
kR3(12),
/** PlayStation button. */
kPS(13),
/** Touchpad click button. */
kTouchpad(14);
public final int value;
@@ -75,11 +89,17 @@ public class PS4Controller extends GenericHID {
/** Represents an axis on a PS4Controller. */
public enum Axis {
/** Left X axis. */
kLeftX(0),
/** Left Y axis. */
kLeftY(1),
/** Right X axis. */
kRightX(2),
/** Right Y axis. */
kRightY(5),
/** Left Trigger 2. */
kL2(3),
/** Right Trigger 2. */
kR2(4);
public final int value;

View File

@@ -31,19 +31,33 @@ public class PS5Controller extends GenericHID {
/** Represents a digital button on a PS5Controller. */
public enum Button {
/** Square button. */
kSquare(1),
/** X button. */
kCross(2),
/** Circle button. */
kCircle(3),
/** Triangle button. */
kTriangle(4),
/** Left trigger 1 button. */
kL1(5),
/** Right trigger 1 button. */
kR1(6),
/** Left trigger 2 button. */
kL2(7),
/** Right trigger 2 button. */
kR2(8),
/** Create button. */
kCreate(9),
/** Options button. */
kOptions(10),
/** Left stick button. */
kL3(11),
/** Right stick button. */
kR3(12),
/** PlayStation button. */
kPS(13),
/** Touchpad click button. */
kTouchpad(14);
public final int value;
@@ -72,11 +86,17 @@ public class PS5Controller extends GenericHID {
/** Represents an axis on a PS5Controller. */
public enum Axis {
/** Left X axis. */
kLeftX(0),
/** Left Y axis. */
kLeftY(1),
kL2(3),
/** Right X axis. */
kRightX(2),
/** Right Y axis. */
kRightY(5),
/** Left Trigger 2. */
kL2(3),
/** Right Trigger 2. */
kR2(4);
public final int value;

View File

@@ -24,8 +24,11 @@ public class PowerDistribution implements Sendable, AutoCloseable {
public static final int kDefaultModule = PowerDistributionJNI.DEFAULT_MODULE;
/** Power distribution module type. */
public enum ModuleType {
/** CTRE (Cross The Road Electronics) CTRE Power Distribution Panel (PDP). */
kCTRE(PowerDistributionJNI.CTRE_TYPE),
/** REV Power Distribution Hub (PDH). */
kRev(PowerDistributionJNI.REV_TYPE);
public final int value;

View File

@@ -44,9 +44,13 @@ public class Relay extends MotorSafety implements Sendable, AutoCloseable {
/** The state to drive a Relay to. */
public enum Value {
/** Off. */
kOff("Off"),
/** On. */
kOn("On"),
/** Forward. */
kForward("Forward"),
/** Reverse. */
kReverse("Reverse");
private final String m_prettyValue;
@@ -66,11 +70,11 @@ public class Relay extends MotorSafety implements Sendable, AutoCloseable {
/** The Direction(s) that a relay is configured to operate in. */
public enum Direction {
/** direction: both directions are valid. */
/** Both directions are valid. */
kBoth,
/** direction: Only forward is valid. */
/** Only forward is valid. */
kForward,
/** direction: only reverse is valid. */
/** Only reverse is valid. */
kReverse
}

View File

@@ -7,8 +7,11 @@ package edu.wpi.first.wpilibj;
import edu.wpi.first.hal.HALUtil;
public enum RuntimeType {
/** RoboRio 1.0. */
kRoboRIO(HALUtil.RUNTIME_ROBORIO),
/** RoboRio 2.0. */
kRoboRIO2(HALUtil.RUNTIME_ROBORIO2),
/** Simulation runtime. */
kSimulation(HALUtil.RUNTIME_SIMULATION);
public final int value;

View File

@@ -14,11 +14,17 @@ import java.nio.IntBuffer;
/** Represents an SPI bus port. */
public class SPI implements AutoCloseable {
/** SPI port. */
public enum Port {
/** Onboard SPI bus port CS0. */
kOnboardCS0(SPIJNI.ONBOARD_CS0_PORT),
/** Onboard SPI bus port CS1. */
kOnboardCS1(SPIJNI.ONBOARD_CS1_PORT),
/** Onboard SPI bus port CS2. */
kOnboardCS2(SPIJNI.ONBOARD_CS2_PORT),
/** Onboard SPI bus port CS3. */
kOnboardCS3(SPIJNI.ONBOARD_CS3_PORT),
/** MXP (roboRIO MXP) SPI bus port. */
kMXP(SPIJNI.MXP_PORT);
public final int value;
@@ -28,6 +34,7 @@ public class SPI implements AutoCloseable {
}
}
/** SPI mode. */
public enum Mode {
/** Clock idle low, data sampled on rising edge. */
kMode0(SPIJNI.SPI_MODE0),

View File

@@ -13,11 +13,17 @@ import java.nio.charset.StandardCharsets;
public class SerialPort implements AutoCloseable {
private int m_portHandle;
/** Serial port. */
public enum Port {
/** Onboard serial port on the roboRIO. */
kOnboard(0),
/** MXP (roboRIO MXP) serial port. */
kMXP(1),
/** USB serial port (same as KUSB1). */
kUSB(2),
/** USB serial port 1. */
kUSB1(2),
/** USB serial port 2. */
kUSB2(3);
public final int value;
@@ -29,10 +35,15 @@ public class SerialPort implements AutoCloseable {
/** Represents the parity to use for serial communications. */
public enum Parity {
/** No parity. */
kNone(0),
/** Odd parity. */
kOdd(1),
/** Even parity. */
kEven(2),
/** Parity bit always on. */
kMark(3),
/** Parity bit always off. */
kSpace(4);
public final int value;
@@ -44,8 +55,11 @@ public class SerialPort implements AutoCloseable {
/** Represents the number of stop bits to use for Serial Communication. */
public enum StopBits {
/** One stop bit. */
kOne(10),
/** One and a half stop bits. */
kOnePointFive(15),
/** Two stop bits. */
kTwo(20);
public final int value;
@@ -57,9 +71,13 @@ public class SerialPort implements AutoCloseable {
/** Represents what type of flow control to use for serial communication. */
public enum FlowControl {
/** No flow control. */
kNone(0),
/** XON/XOFF flow control. */
kXonXoff(1),
/** RTS/CTS flow control. */
kRtsCts(2),
/** DTS/DSR flow control. */
kDtsDsr(4);
public final int value;
@@ -71,7 +89,9 @@ public class SerialPort implements AutoCloseable {
/** Represents which type of buffer mode to use when writing to a serial port. */
public enum WriteBufferMode {
/** Flush the buffer on each access. */
kFlushOnAccess(1),
/** Flush the buffer when it is full. */
kFlushWhenFull(2);
public final int value;

View File

@@ -19,20 +19,35 @@ import edu.wpi.first.wpilibj.event.EventLoop;
public class StadiaController extends GenericHID {
/** Represents a digital button on a StadiaController. */
public enum Button {
/** A button. */
kA(1),
/** B button. */
kB(2),
/** X Button. */
kX(3),
/** Y Button. */
kY(4),
/** Left bumper button. */
kLeftBumper(5),
/** Right bumper button. */
kRightBumper(6),
/** Left stick button. */
kLeftStick(7),
/** Right stick button. */
kRightStick(8),
/** Ellipses button. */
kEllipses(9),
/** Hamburger button. */
kHamburger(10),
/** Stadia button. */
kStadia(11),
/** Right trigger button. */
kRightTrigger(12),
/** Left trigger button. */
kLeftTrigger(13),
/** Google button. */
kGoogle(14),
/** Frame button. */
kFrame(15);
public final int value;
@@ -61,9 +76,13 @@ public class StadiaController extends GenericHID {
/** Represents an axis on a StadiaController. */
public enum Axis {
/** Left X axis. */
kLeftX(0),
/** Right X axis. */
kRightX(3),
/** Left Y axis. */
kLeftY(1),
/** Right Y axis. */
kRightY(4);
public final int value;

View File

@@ -23,9 +23,13 @@ public class SynchronousInterrupt implements AutoCloseable {
/** Event trigger combinations for a synchronous interrupt. */
public enum WaitResult {
/** Timeout event. */
kTimeout(0x0),
/** Rising edge event. */
kRisingEdge(0x1),
/** Falling edge event. */
kFallingEdge(0x100),
/** Both rising and falling edge events. */
kBoth(0x101);
public final int value;

View File

@@ -4,10 +4,15 @@
package edu.wpi.first.wpilibj.counter;
/** Edge configuration. */
public enum EdgeConfiguration {
/** No edge configuration (neither rising nor falling). */
kNone(false, false),
/** Rising edge configuration. */
kRisingEdge(true, false),
/** Falling edge configuration. */
kFallingEdge(false, true),
/** Both rising and falling edge configuration. */
kBoth(true, true);
@SuppressWarnings("MemberName")

View File

@@ -20,12 +20,19 @@ public abstract class RobotDriveBase extends MotorSafety {
/** The location of a motor on the robot for the purpose of driving. */
public enum MotorType {
/** Front left motor. */
kFrontLeft(0),
/** Front right motor. */
kFrontRight(1),
/** Rear left motor. */
kRearLeft(2),
/** Reat right motor. */
kRearRight(3),
/** Left motor. */
kLeft(0),
/** Right motor. */
kRight(1),
/** Back motor. */
kBack(2);
public final int value;

View File

@@ -369,10 +369,15 @@ public class DifferentialDrivetrainSim {
* and 16:48 8.45:1 -- 14:50 and 19:45 7.31:1 -- 14:50 and 21:43 5.95:1 -- 14:50 and 24:40
*/
public enum KitbotGearing {
/** Gear ratio of 12.75:1. */
k12p75(12.75),
/** Gear ratio of 10.71:1. */
k10p71(10.71),
/** Gear ratio of 8.45:1. */
k8p45(8.45),
/** Gear ratio of 7.31:1. */
k7p31(7.31),
/** Gear ratio of 5.95:1. */
k5p95(5.95);
public final double value;
@@ -384,13 +389,21 @@ public class DifferentialDrivetrainSim {
/** Represents common motor layouts of the kit drivetrain. */
public enum KitbotMotor {
/** One CIM motor per drive side. */
kSingleCIMPerSide(DCMotor.getCIM(1)),
/** Two CIM motors per drive side. */
kDualCIMPerSide(DCMotor.getCIM(2)),
/** One Mini CIM motor per drive side. */
kSingleMiniCIMPerSide(DCMotor.getMiniCIM(1)),
/** Two Mini CIM motors per drive side. */
kDualMiniCIMPerSide(DCMotor.getMiniCIM(2)),
/** One Falcon 500 motor per drive side. */
kSingleFalcon500PerSide(DCMotor.getFalcon500(1)),
/** Two Falcon 500 motors per drive side. */
kDoubleFalcon500PerSide(DCMotor.getFalcon500(2)),
/** One NEO motor per drive side. */
kSingleNEOPerSide(DCMotor.getNEO(1)),
/** Two NEO motors per drive side. */
kDoubleNEOPerSide(DCMotor.getNEO(2));
public final DCMotor value;
@@ -402,8 +415,11 @@ public class DifferentialDrivetrainSim {
/** Represents common wheel sizes of the kit drivetrain. */
public enum KitbotWheelSize {
/** Six inch diameter wheels. */
kSixInch(Units.inchesToMeters(6)),
/** Eight inch diameter wheels. */
kEightInch(Units.inchesToMeters(8)),
/** Ten inch diameter wheels. */
kTenInch(Units.inchesToMeters(10));
public final double value;