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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user