WPILibC++ 2023.4.3-108-ge5452e3
REV Pneumatic Hub (PH) Functions

Classes

struct  HAL_REVPHVersion
 Storage for REV PH Version. More...
 
struct  HAL_REVPHCompressorConfig
 Storage for compressor config. More...
 
struct  HAL_REVPHFaults
 Storage for REV PH Faults. More...
 
struct  HAL_REVPHStickyFaults
 Storage for REV PH Sticky Faults. More...
 

Enumerations

enum  HAL_REVPHCompressorConfigType : int32_t { HAL_REVPHCompressorConfigType_kDisabled = 0 , HAL_REVPHCompressorConfigType_kDigital = 1 , HAL_REVPHCompressorConfigType_kAnalog = 2 , HAL_REVPHCompressorConfigType_kHybrid = 3 }
 The compressor configuration type. More...
 

Functions

HAL_REVPHHandle HAL_InitializeREVPH (int32_t module, const char *allocationLocation, int32_t *status)
 Initializes a PH. More...
 
void HAL_FreeREVPH (HAL_REVPHHandle handle)
 Frees a PH handle. More...
 
HAL_Bool HAL_CheckREVPHSolenoidChannel (int32_t channel)
 Checks if a solenoid channel number is valid. More...
 
HAL_Bool HAL_CheckREVPHModuleNumber (int32_t module)
 Checks if a PH module (CAN ID) is valid. More...
 
HAL_Bool HAL_GetREVPHCompressor (HAL_REVPHHandle handle, int32_t *status)
 Get whether compressor is turned on. More...
 
void HAL_SetREVPHCompressorConfig (HAL_REVPHHandle handle, const HAL_REVPHCompressorConfig *config, int32_t *status)
 Send compressor configuration to the PH. More...
 
void HAL_SetREVPHClosedLoopControlDisabled (HAL_REVPHHandle handle, int32_t *status)
 Disable Compressor. More...
 
void HAL_SetREVPHClosedLoopControlDigital (HAL_REVPHHandle handle, int32_t *status)
 Enables the compressor in digital mode using the digital pressure switch. More...
 
void HAL_SetREVPHClosedLoopControlAnalog (HAL_REVPHHandle handle, double minAnalogVoltage, double maxAnalogVoltage, int32_t *status)
 Enables the compressor in analog mode. More...
 
void HAL_SetREVPHClosedLoopControlHybrid (HAL_REVPHHandle handle, double minAnalogVoltage, double maxAnalogVoltage, int32_t *status)
 Enables the compressor in hybrid mode. More...
 
HAL_REVPHCompressorConfigType HAL_GetREVPHCompressorConfig (HAL_REVPHHandle handle, int32_t *status)
 Get compressor configuration from the PH. More...
 
HAL_Bool HAL_GetREVPHPressureSwitch (HAL_REVPHHandle handle, int32_t *status)
 Returns the state of the digital pressure switch. More...
 
double HAL_GetREVPHCompressorCurrent (HAL_REVPHHandle handle, int32_t *status)
 Returns the current drawn by the compressor. More...
 
double HAL_GetREVPHAnalogVoltage (HAL_REVPHHandle handle, int32_t channel, int32_t *status)
 Returns the raw voltage of the specified analog input channel. More...
 
double HAL_GetREVPHVoltage (HAL_REVPHHandle handle, int32_t *status)
 Returns the current input voltage for the PH. More...
 
double HAL_GetREVPH5VVoltage (HAL_REVPHHandle handle, int32_t *status)
 Returns the current voltage of the regulated 5v supply. More...
 
double HAL_GetREVPHSolenoidCurrent (HAL_REVPHHandle handle, int32_t *status)
 Returns the total current drawn by all solenoids. More...
 
double HAL_GetREVPHSolenoidVoltage (HAL_REVPHHandle handle, int32_t *status)
 Returns the current voltage of the solenoid power supply. More...
 
void HAL_GetREVPHVersion (HAL_REVPHHandle handle, HAL_REVPHVersion *version, int32_t *status)
 Returns the hardware and firmware versions of the PH. More...
 
int32_t HAL_GetREVPHSolenoids (HAL_REVPHHandle handle, int32_t *status)
 Gets a bitmask of solenoid values. More...
 
void HAL_SetREVPHSolenoids (HAL_REVPHHandle handle, int32_t mask, int32_t values, int32_t *status)
 Sets solenoids on a PH. More...
 
void HAL_FireREVPHOneShot (HAL_REVPHHandle handle, int32_t index, int32_t durMs, int32_t *status)
 Fire a single solenoid shot for the specified duration. More...
 
void HAL_GetREVPHFaults (HAL_REVPHHandle handle, HAL_REVPHFaults *faults, int32_t *status)
 Returns the faults currently active on the PH. More...
 
void HAL_GetREVPHStickyFaults (HAL_REVPHHandle handle, HAL_REVPHStickyFaults *stickyFaults, int32_t *status)
 Returns the sticky faults currently active on this device. More...
 
void HAL_ClearREVPHStickyFaults (HAL_REVPHHandle handle, int32_t *status)
 Clears the sticky faults. More...
 

Detailed Description

Enumeration Type Documentation

◆ HAL_REVPHCompressorConfigType

The compressor configuration type.

Enumerator
HAL_REVPHCompressorConfigType_kDisabled 
HAL_REVPHCompressorConfigType_kDigital 
HAL_REVPHCompressorConfigType_kAnalog 
HAL_REVPHCompressorConfigType_kHybrid 

Function Documentation

◆ HAL_CheckREVPHModuleNumber()

HAL_Bool HAL_CheckREVPHModuleNumber ( int32_t  module)

Checks if a PH module (CAN ID) is valid.

Parameters
[in]modulethe module to check
Returns
true if the module is valid, otherwise false

◆ HAL_CheckREVPHSolenoidChannel()

HAL_Bool HAL_CheckREVPHSolenoidChannel ( int32_t  channel)

Checks if a solenoid channel number is valid.

Parameters
[in]channelthe channel to check
Returns
true if the channel is valid, otherwise false

◆ HAL_ClearREVPHStickyFaults()

void HAL_ClearREVPHStickyFaults ( HAL_REVPHHandle  handle,
int32_t *  status 
)

Clears the sticky faults.

Parameters
[in]handlethe PH handle
[out]statusError status variable. 0 on success.

◆ HAL_FireREVPHOneShot()

void HAL_FireREVPHOneShot ( HAL_REVPHHandle  handle,
int32_t  index,
int32_t  durMs,
int32_t *  status 
)

Fire a single solenoid shot for the specified duration.

Parameters
[in]handlethe PH handle
[in]indexsolenoid index
[in]durMsshot duration in ms
[out]statusError status variable. 0 on success.

◆ HAL_FreeREVPH()

void HAL_FreeREVPH ( HAL_REVPHHandle  handle)

Frees a PH handle.

Parameters
[in]handlethe PH handle

◆ HAL_GetREVPH5VVoltage()

double HAL_GetREVPH5VVoltage ( HAL_REVPHHandle  handle,
int32_t *  status 
)

Returns the current voltage of the regulated 5v supply.

Parameters
[in]handlethe PH handle
[out]statusError status variable. 0 on success.
Returns
The current voltage of the 5v supply in volts.

◆ HAL_GetREVPHAnalogVoltage()

double HAL_GetREVPHAnalogVoltage ( HAL_REVPHHandle  handle,
int32_t  channel,
int32_t *  status 
)

Returns the raw voltage of the specified analog input channel.

Parameters
[in]handlethe PH handle
[in]channelThe analog input channel to read voltage from.
[out]statusError status variable. 0 on success.
Returns
The voltage of the specified analog input channel in volts.

◆ HAL_GetREVPHCompressor()

HAL_Bool HAL_GetREVPHCompressor ( HAL_REVPHHandle  handle,
int32_t *  status 
)

Get whether compressor is turned on.

Parameters
[in]handlethe PH handle
[out]statusError status variable. 0 on success.
Returns
true if the compressor is turned on

◆ HAL_GetREVPHCompressorConfig()

HAL_REVPHCompressorConfigType HAL_GetREVPHCompressorConfig ( HAL_REVPHHandle  handle,
int32_t *  status 
)

Get compressor configuration from the PH.

Parameters
[in]handlethe PH handle
[out]statusError status variable. 0 on success.
Returns
compressor configuration

◆ HAL_GetREVPHCompressorCurrent()

double HAL_GetREVPHCompressorCurrent ( HAL_REVPHHandle  handle,
int32_t *  status 
)

Returns the current drawn by the compressor.

Parameters
[in]handlethe PH handle
[out]statusError status variable. 0 on success.
Returns
The current drawn by the compressor in amps.

◆ HAL_GetREVPHFaults()

void HAL_GetREVPHFaults ( HAL_REVPHHandle  handle,
HAL_REVPHFaults faults,
int32_t *  status 
)

Returns the faults currently active on the PH.

Parameters
[in]handlethe PH handle
[out]faultsThe faults.
[out]statusError status variable. 0 on success.

◆ HAL_GetREVPHPressureSwitch()

HAL_Bool HAL_GetREVPHPressureSwitch ( HAL_REVPHHandle  handle,
int32_t *  status 
)

Returns the state of the digital pressure switch.

Parameters
[in]handlethe PH handle
[out]statusError status variable. 0 on success.
Returns
True if pressure switch indicates that the system is full, otherwise false.

◆ HAL_GetREVPHSolenoidCurrent()

double HAL_GetREVPHSolenoidCurrent ( HAL_REVPHHandle  handle,
int32_t *  status 
)

Returns the total current drawn by all solenoids.

Parameters
[in]handlethe PH handle
[out]statusError status variable. 0 on success.
Returns
Total current drawn by all solenoids in amps.

◆ HAL_GetREVPHSolenoids()

int32_t HAL_GetREVPHSolenoids ( HAL_REVPHHandle  handle,
int32_t *  status 
)

Gets a bitmask of solenoid values.

Parameters
[in]handlethe PH handle
[out]statusError status variable. 0 on success.
Returns
solenoid values

◆ HAL_GetREVPHSolenoidVoltage()

double HAL_GetREVPHSolenoidVoltage ( HAL_REVPHHandle  handle,
int32_t *  status 
)

Returns the current voltage of the solenoid power supply.

Parameters
[in]handlethe PH handle
[out]statusError status variable. 0 on success.
Returns
The current voltage of the solenoid power supply in volts.

◆ HAL_GetREVPHStickyFaults()

void HAL_GetREVPHStickyFaults ( HAL_REVPHHandle  handle,
HAL_REVPHStickyFaults stickyFaults,
int32_t *  status 
)

Returns the sticky faults currently active on this device.

Parameters
[in]handlethe PH handle
[out]stickyFaultsThe sticky faults.
[out]statusError status variable. 0 on success.

◆ HAL_GetREVPHVersion()

void HAL_GetREVPHVersion ( HAL_REVPHHandle  handle,
HAL_REVPHVersion version,
int32_t *  status 
)

Returns the hardware and firmware versions of the PH.

Parameters
[in]handlethe PH handle
[out]versionThe hardware and firmware versions.
[out]statusError status variable. 0 on success.

◆ HAL_GetREVPHVoltage()

double HAL_GetREVPHVoltage ( HAL_REVPHHandle  handle,
int32_t *  status 
)

Returns the current input voltage for the PH.

Parameters
[in]handlethe PH handle
[out]statusError status variable. 0 on success.
Returns
The input voltage in volts.

◆ HAL_InitializeREVPH()

HAL_REVPHHandle HAL_InitializeREVPH ( int32_t  module,
const char *  allocationLocation,
int32_t *  status 
)

Initializes a PH.

Parameters
[in]modulethe CAN ID to initialize
[in]allocationLocationthe location where the allocation is occurring (can be null)
[out]statusError status variable. 0 on success.
Returns
the created PH handle

◆ HAL_SetREVPHClosedLoopControlAnalog()

void HAL_SetREVPHClosedLoopControlAnalog ( HAL_REVPHHandle  handle,
double  minAnalogVoltage,
double  maxAnalogVoltage,
int32_t *  status 
)

Enables the compressor in analog mode.

This mode uses an analog pressure sensor connected to analog channel 0 to cycle the compressor. The compressor will turn on when the pressure drops below minAnalogVoltage and will turn off when the pressure reaches maxAnalogVoltage. This mode is only supported by the REV PH with the REV Analog Pressure Sensor connected to analog channel 0.

Parameters
[in]handlethe PH handle
[in]minAnalogVoltageThe compressor will turn on when the analog pressure sensor voltage drops below this value
[in]maxAnalogVoltageThe compressor will turn off when the analog pressure sensor reaches this value.
[out]statusError status variable. 0 on success.

◆ HAL_SetREVPHClosedLoopControlDigital()

void HAL_SetREVPHClosedLoopControlDigital ( HAL_REVPHHandle  handle,
int32_t *  status 
)

Enables the compressor in digital mode using the digital pressure switch.

The compressor will turn on when the pressure switch indicates that the system is not full, and will turn off when the pressure switch indicates that the system is full.

Parameters
[in]handlethe PH handle
[out]statusError status variable. 0 on success.

◆ HAL_SetREVPHClosedLoopControlDisabled()

void HAL_SetREVPHClosedLoopControlDisabled ( HAL_REVPHHandle  handle,
int32_t *  status 
)

Disable Compressor.

Parameters
[in]handlethe PH handle
[out]statusError status variable. 0 on success.

◆ HAL_SetREVPHClosedLoopControlHybrid()

void HAL_SetREVPHClosedLoopControlHybrid ( HAL_REVPHHandle  handle,
double  minAnalogVoltage,
double  maxAnalogVoltage,
int32_t *  status 
)

Enables the compressor in hybrid mode.

This mode uses both a digital pressure switch and an analog pressure sensor connected to analog channel 0 to cycle the compressor.

The compressor will turn on when both:

  • The digital pressure switch indicates the system is not full AND
  • The analog pressure sensor indicates that the pressure in the system is below the specified minimum pressure.

The compressor will turn off when either:

  • The digital pressure switch is disconnected or indicates that the system is full OR
  • The pressure detected by the analog sensor is greater than the specified maximum pressure.
Parameters
[in]handlethe PH handle
[in]minAnalogVoltageThe compressor will turn on when the analog pressure sensor voltage drops below this value and the pressure switch indicates that the system is not full.
[in]maxAnalogVoltageThe compressor will turn off when the analog pressure sensor reaches this value or the pressure switch is disconnected or indicates that the system is full.
[out]statusError status variable. 0 on success.

◆ HAL_SetREVPHCompressorConfig()

void HAL_SetREVPHCompressorConfig ( HAL_REVPHHandle  handle,
const HAL_REVPHCompressorConfig config,
int32_t *  status 
)

Send compressor configuration to the PH.

Parameters
[in]handlethe PH handle
[in]configcompressor configuration
[out]statusError status variable. 0 on success.

◆ HAL_SetREVPHSolenoids()

void HAL_SetREVPHSolenoids ( HAL_REVPHHandle  handle,
int32_t  mask,
int32_t  values,
int32_t *  status 
)

Sets solenoids on a PH.

Parameters
[in]handlethe PH handle
[in]maskbitmask to set
[in]valuessolenoid values
[out]statusError status variable. 0 on success.