ctre_sys/
enums.rs

1//! Enums common to all CTRE Phoenix devices.
2#![allow(non_camel_case_types)]
3
4#[repr(i32)]
5#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
6pub enum ErrorCode {
7    /// No Error - Function executed as expected
8    OK = 0,
9
10    // CAN-Related
11    CAN_MSG_STALE = 1,
12    /// Could not transmit the CAN frame.
13    TxFailed = -1,
14    /// Caller passed an invalid param
15    InvalidParamValue = -2,
16    /// CAN frame has not been received within specified period of time.
17    RxTimeout = -3,
18    /// Not used.
19    TxTimeout = -4,
20    /// Specified CAN Id is invalid.
21    UnexpectedArbId = -5,
22    /// Caller attempted to insert data into a buffer that is full.
23    BufferFull = 6,
24    CAN_OVERFLOW = -6,
25    /// Sensor is not present
26    SensorNotPresent = -7,
27    FirmwareTooOld = -8,
28    CouldNotChangePeriod = -9,
29
30    // General
31    /// User Specified General Error
32    GeneralError = -100,
33
34    // Signal
35    /// Have not received an value response for signal.
36    SigNotUpdated = -200,
37    NotAllPIDValuesUpdated = -201,
38
39    // Gadgeteer Port Error Codes
40    // These include errors between ports and modules
41    GEN_PORT_ERROR = -300,
42    PORT_MODULE_TYPE_MISMATCH = -301,
43
44    // Gadgeteer Module Error Codes
45    // These apply only to the module units themselves
46    GEN_MODULE_ERROR = -400,
47    MODULE_NOT_INIT_SET_ERROR = -401,
48    MODULE_NOT_INIT_GET_ERROR = -402,
49
50    // API
51    WheelRadiusTooSmall = -500,
52    TicksPerRevZero = -501,
53    DistanceBetweenWheelsTooSmall = -502,
54    GainsAreNotSet = -503,
55
56    // Higher Level
57    IncompatibleMode = -600,
58    /// Handle does not match stored map of handles
59    InvalidHandle = -601,
60
61    // Firmware Versions
62    FeatureRequiresHigherFirm = -700,
63    TalonFeatureRequiresHigherFirm = -701,
64
65    // CAN Related
66    /// Special Code for "isSensorPresent"
67    PulseWidthSensorNotPresent = 10,
68
69    // General
70    GeneralWarning = 100,
71    /// feature not implement in the API or firmware
72    FeatureNotSupported = 101,
73    /// feature not implement in the API
74    NotImplemented = 102,
75    FirmVersionCouldNotBeRetrieved = 103,
76    /// feature will be release in an upcoming release
77    FeaturesNotAvailableYet = 104,
78    /// Current control mode of motor controller not valid for this call
79    ControlModeNotValid = 105,
80    ControlModeNotSupportedYet = 106,
81    AuxiliaryPIDNotSupportedYet = 107,
82    RemoteSensorsNotSupportedYet = 108,
83    MotProfFirmThreshold = 109,
84    MotProfFirmThreshold2 = 110,
85}
86
87#[repr(u32)]
88/// Signal enumeration for generic signal access.
89#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
90pub enum ParamEnum {
91    OnBoot_BrakeMode = 31,
92    QuadFilterEn = 91,
93    QuadIdxPolarity = 108,
94    ClearPositionOnIdx = 100,
95    MotionProfileHasUnderrunErr = 119,
96    MotionProfileTrajectoryPointDurationMs = 120,
97    ClearPosOnLimitF = 144,
98    ClearPosOnLimitR = 145,
99
100    StatusFramePeriod = 300,
101    OpenloopRamp = 301,
102    ClosedloopRamp = 302,
103    NeutralDeadband = 303,
104
105    PeakPosOutput = 305,
106    NominalPosOutput = 306,
107    PeakNegOutput = 307,
108    NominalNegOutput = 308,
109
110    ProfileParamSlot_P = 310,
111    ProfileParamSlot_I = 311,
112    ProfileParamSlot_D = 312,
113    ProfileParamSlot_F = 313,
114    ProfileParamSlot_IZone = 314,
115    ProfileParamSlot_AllowableErr = 315,
116    ProfileParamSlot_MaxIAccum = 316,
117    ProfileParamSlot_PeakOutput = 317,
118
119    ClearPositionOnLimitF = 320,
120    ClearPositionOnLimitR = 321,
121    ClearPositionOnQuadIdx = 322,
122
123    SampleVelocityPeriod = 325,
124    SampleVelocityWindow = 326,
125
126    FeedbackSensorType = 330,
127    SelectedSensorPosition = 331,
128    FeedbackNotContinuous = 332,
129    RemoteSensorSource = 333, // RemoteSensorSource_t
130    /// [0,62] DeviceID
131    RemoteSensorDeviceID = 334,
132    SensorTerm = 335, // feedbackDevice_t (ordinal is the register)
133    RemoteSensorClosedLoopDisableNeutralOnLOS = 336,
134    PIDLoopPolarity = 337,
135    PIDLoopPeriod = 338,
136    SelectedSensorCoefficient = 339,
137
138    ForwardSoftLimitThreshold = 340,
139    ReverseSoftLimitThreshold = 341,
140    ForwardSoftLimitEnable = 342,
141    ReverseSoftLimitEnable = 343,
142
143    NominalBatteryVoltage = 350,
144    BatteryVoltageFilterSize = 351,
145
146    ContinuousCurrentLimitAmps = 360,
147    PeakCurrentLimitMs = 361,
148    PeakCurrentLimitAmps = 362,
149
150    ClosedLoopIAccum = 370,
151
152    CustomParam = 380,
153
154    StickyFaults = 390,
155
156    AnalogPosition = 400,
157    QuadraturePosition = 401,
158    PulseWidthPosition = 402,
159
160    MotMag_Accel = 410,
161    MotMag_VelCruise = 411,
162
163    /// ordinal (fwd=0,reverse=1), @see LimitSwitchSource_t
164    LimitSwitchSource = 421,
165    /// ordinal (fwd=0,reverse=1). @see LimitSwitchNormClosedAndDis_t
166    LimitSwitchNormClosedAndDis = 422,
167    LimitSwitchDisableNeutralOnLOS = 423,
168    LimitSwitchRemoteDevID = 424,
169    SoftLimitDisableNeutralOnLOS = 425,
170
171    PulseWidthPeriod_EdgesPerRot = 430,
172    PulseWidthPeriod_FilterWindowSz = 431,
173
174    YawOffset = 160,
175    CompassOffset = 161,
176    BetaGain = 162,
177    EnableCompassFusion = 163,
178    GyroNoMotionCal = 164,
179    EnterCalibration = 165,
180    FusedHeadingOffset = 166,
181    StatusFrameRate = 169,
182    AccumZ = 170,
183    TempCompDisable = 171,
184    MotionMeas_tap_threshX = 172,
185    MotionMeas_tap_threshY = 173,
186    MotionMeas_tap_threshZ = 174,
187    MotionMeas_tap_count = 175,
188    MotionMeas_tap_time = 176,
189    MotionMeas_tap_time_multi = 177,
190    MotionMeas_shake_reject_thresh = 178,
191    MotionMeas_shake_reject_time = 179,
192    MotionMeas_shake_reject_timeout = 180,
193}