WPILibC++ 2024.3.2
CTRE Pneumatic Control Module (PCM) Functions

Functions

HAL_CTREPCMHandle HAL_InitializeCTREPCM (int32_t module, const char *allocationLocation, int32_t *status)
 Initializes a PCM. More...
 
void HAL_FreeCTREPCM (HAL_CTREPCMHandle handle)
 Frees a PCM handle. More...
 
HAL_Bool HAL_CheckCTREPCMSolenoidChannel (int32_t channel)
 Checks if a solenoid channel number is valid. More...
 
HAL_Bool HAL_GetCTREPCMCompressor (HAL_CTREPCMHandle handle, int32_t *status)
 Get whether compressor is turned on. More...
 
void HAL_SetCTREPCMClosedLoopControl (HAL_CTREPCMHandle handle, HAL_Bool enabled, int32_t *status)
 Enables the compressor closed loop control using the digital pressure switch. More...
 
HAL_Bool HAL_GetCTREPCMClosedLoopControl (HAL_CTREPCMHandle handle, int32_t *status)
 Get whether the PCM closed loop control is enabled. More...
 
HAL_Bool HAL_GetCTREPCMPressureSwitch (HAL_CTREPCMHandle handle, int32_t *status)
 Returns the state of the pressure switch. More...
 
double HAL_GetCTREPCMCompressorCurrent (HAL_CTREPCMHandle handle, int32_t *status)
 Returns the current drawn by the compressor. More...
 
HAL_Bool HAL_GetCTREPCMCompressorCurrentTooHighFault (HAL_CTREPCMHandle handle, int32_t *status)
 Return whether the compressor current is currently too high. More...
 
HAL_Bool HAL_GetCTREPCMCompressorCurrentTooHighStickyFault (HAL_CTREPCMHandle handle, int32_t *status)
 Returns whether the compressor current has been too high since sticky faults were last cleared. More...
 
HAL_Bool HAL_GetCTREPCMCompressorShortedStickyFault (HAL_CTREPCMHandle handle, int32_t *status)
 Returns whether the compressor has been shorted since sticky faults were last cleared. More...
 
HAL_Bool HAL_GetCTREPCMCompressorShortedFault (HAL_CTREPCMHandle handle, int32_t *status)
 Returns whether the compressor is currently shorted. More...
 
HAL_Bool HAL_GetCTREPCMCompressorNotConnectedStickyFault (HAL_CTREPCMHandle handle, int32_t *status)
 Returns whether the compressor has been disconnected since sticky faults were last cleared. More...
 
HAL_Bool HAL_GetCTREPCMCompressorNotConnectedFault (HAL_CTREPCMHandle handle, int32_t *status)
 Returns whether the compressor is currently disconnected. More...
 
int32_t HAL_GetCTREPCMSolenoids (HAL_CTREPCMHandle handle, int32_t *status)
 Gets a bitmask of solenoid values. More...
 
void HAL_SetCTREPCMSolenoids (HAL_CTREPCMHandle handle, int32_t mask, int32_t values, int32_t *status)
 Sets solenoids on a pneumatics module. More...
 
int32_t HAL_GetCTREPCMSolenoidDisabledList (HAL_CTREPCMHandle handle, int32_t *status)
 Get a bitmask of disabled solenoids. More...
 
HAL_Bool HAL_GetCTREPCMSolenoidVoltageStickyFault (HAL_CTREPCMHandle handle, int32_t *status)
 Returns whether the solenoid has reported a voltage fault since sticky faults were last cleared. More...
 
HAL_Bool HAL_GetCTREPCMSolenoidVoltageFault (HAL_CTREPCMHandle handle, int32_t *status)
 Returns whether the solenoid is currently reporting a voltage fault. More...
 
void HAL_ClearAllCTREPCMStickyFaults (HAL_CTREPCMHandle handle, int32_t *status)
 Clears all sticky faults on this device. More...
 
void HAL_FireCTREPCMOneShot (HAL_CTREPCMHandle handle, int32_t index, int32_t *status)
 Fire a single solenoid shot. More...
 
void HAL_SetCTREPCMOneShotDuration (HAL_CTREPCMHandle handle, int32_t index, int32_t durMs, int32_t *status)
 Set the duration for a single solenoid shot. More...
 

Detailed Description

Function Documentation

◆ HAL_CheckCTREPCMSolenoidChannel()

HAL_Bool HAL_CheckCTREPCMSolenoidChannel ( 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_ClearAllCTREPCMStickyFaults()

void HAL_ClearAllCTREPCMStickyFaults ( HAL_CTREPCMHandle  handle,
int32_t *  status 
)

Clears all sticky faults on this device.

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

◆ HAL_FireCTREPCMOneShot()

void HAL_FireCTREPCMOneShot ( HAL_CTREPCMHandle  handle,
int32_t  index,
int32_t *  status 
)

Fire a single solenoid shot.

Parameters
[in]handlethe PCM handle
[in]indexsolenoid index
[out]statusError status variable. 0 on success.

◆ HAL_FreeCTREPCM()

void HAL_FreeCTREPCM ( HAL_CTREPCMHandle  handle)

Frees a PCM handle.

Parameters
[in]handlethe PCMhandle

◆ HAL_GetCTREPCMClosedLoopControl()

HAL_Bool HAL_GetCTREPCMClosedLoopControl ( HAL_CTREPCMHandle  handle,
int32_t *  status 
)

Get whether the PCM closed loop control is enabled.

Parameters
[in]handlethe PCM handle
[out]statusError status variable. 0 on success.
Returns
True if closed loop control is enabled, otherwise false.

◆ HAL_GetCTREPCMCompressor()

HAL_Bool HAL_GetCTREPCMCompressor ( HAL_CTREPCMHandle  handle,
int32_t *  status 
)

Get whether compressor is turned on.

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

◆ HAL_GetCTREPCMCompressorCurrent()

double HAL_GetCTREPCMCompressorCurrent ( HAL_CTREPCMHandle  handle,
int32_t *  status 
)

Returns the current drawn by the compressor.

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

◆ HAL_GetCTREPCMCompressorCurrentTooHighFault()

HAL_Bool HAL_GetCTREPCMCompressorCurrentTooHighFault ( HAL_CTREPCMHandle  handle,
int32_t *  status 
)

Return whether the compressor current is currently too high.

Parameters
[in]handlethe PCM handle
[out]statusError status variable. 0 on success.
Returns
True if the compressor current is too high, otherwise false.
See also
HAL_GetCTREPCMCompressorShortedStickyFault

◆ HAL_GetCTREPCMCompressorCurrentTooHighStickyFault()

HAL_Bool HAL_GetCTREPCMCompressorCurrentTooHighStickyFault ( HAL_CTREPCMHandle  handle,
int32_t *  status 
)

Returns whether the compressor current has been too high since sticky faults were last cleared.

This fault is persistent and can be cleared by HAL_ClearAllCTREPCMStickyFaults()

Parameters
[in]handlethe PCM handle
[out]statusError status variable. 0 on success.
Returns
True if the compressor current has been too high since sticky faults were last cleared.
See also
HAL_GetCTREPCMCompressorCurrentTooHighFault()

◆ HAL_GetCTREPCMCompressorNotConnectedFault()

HAL_Bool HAL_GetCTREPCMCompressorNotConnectedFault ( HAL_CTREPCMHandle  handle,
int32_t *  status 
)

Returns whether the compressor is currently disconnected.

Parameters
[in]handlethe PCM handle
[out]statusError status variable. 0 on success.
Returns
True if compressor is currently disconnected, otherwise false.
See also
HAL_GetCTREPCMCompressorNotConnectedStickyFault()

◆ HAL_GetCTREPCMCompressorNotConnectedStickyFault()

HAL_Bool HAL_GetCTREPCMCompressorNotConnectedStickyFault ( HAL_CTREPCMHandle  handle,
int32_t *  status 
)

Returns whether the compressor has been disconnected since sticky faults were last cleared.

This fault is persistent and can be cleared by HAL_ClearAllCTREPCMStickyFaults()

Parameters
[in]handlethe PCM handle
[out]statusError status variable. 0 on success.
Returns
True if the compressor has been disconnected since sticky faults were last cleared, otherwise false.
See also
HAL_GetCTREPCMCompressorShortedFault()

◆ HAL_GetCTREPCMCompressorShortedFault()

HAL_Bool HAL_GetCTREPCMCompressorShortedFault ( HAL_CTREPCMHandle  handle,
int32_t *  status 
)

Returns whether the compressor is currently shorted.

Parameters
[in]handlethe PCM handle
[out]statusError status variable. 0 on success.
Returns
True if the compressor is currently shorted, otherwise false.
See also
HAL_GetCTREPCMCompressorShortedStickyFault

◆ HAL_GetCTREPCMCompressorShortedStickyFault()

HAL_Bool HAL_GetCTREPCMCompressorShortedStickyFault ( HAL_CTREPCMHandle  handle,
int32_t *  status 
)

Returns whether the compressor has been shorted since sticky faults were last cleared.

This fault is persistent and can be cleared by HAL_ClearAllCTREPCMStickyFaults()

Parameters
[in]handlethe PCM handle
[out]statusError status variable. 0 on success.
Returns
True if the compressor has been shorted since sticky faults were last cleared, otherwise false.
See also
HAL_GetCTREPCMCompressorShortedFault()

◆ HAL_GetCTREPCMPressureSwitch()

HAL_Bool HAL_GetCTREPCMPressureSwitch ( HAL_CTREPCMHandle  handle,
int32_t *  status 
)

Returns the state of the pressure switch.

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

◆ HAL_GetCTREPCMSolenoidDisabledList()

int32_t HAL_GetCTREPCMSolenoidDisabledList ( HAL_CTREPCMHandle  handle,
int32_t *  status 
)

Get a bitmask of disabled solenoids.

Parameters
[in]handlethe PCM handle
[out]statusError status variable. 0 on success.
Returns
bitmask of disabled solenoids

◆ HAL_GetCTREPCMSolenoids()

int32_t HAL_GetCTREPCMSolenoids ( HAL_CTREPCMHandle  handle,
int32_t *  status 
)

Gets a bitmask of solenoid values.

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

◆ HAL_GetCTREPCMSolenoidVoltageFault()

HAL_Bool HAL_GetCTREPCMSolenoidVoltageFault ( HAL_CTREPCMHandle  handle,
int32_t *  status 
)

Returns whether the solenoid is currently reporting a voltage fault.

Parameters
[in]handlethe PCM handle
[out]statusError status variable. 0 on success.
Returns
True if solenoid is reporting a fault, otherwise false.
See also
HAL_GetCTREPCMSolenoidVoltageStickyFault()

◆ HAL_GetCTREPCMSolenoidVoltageStickyFault()

HAL_Bool HAL_GetCTREPCMSolenoidVoltageStickyFault ( HAL_CTREPCMHandle  handle,
int32_t *  status 
)

Returns whether the solenoid has reported a voltage fault since sticky faults were last cleared.

This fault is persistent and can be cleared by HAL_ClearAllCTREPCMStickyFaults()

Parameters
[in]handlethe PCM handle
[out]statusError status variable. 0 on success.
Returns
True if solenoid is reporting a fault, otherwise false.
See also
HAL_GetCTREPCMSolenoidVoltageFault()

◆ HAL_InitializeCTREPCM()

HAL_CTREPCMHandle HAL_InitializeCTREPCM ( int32_t  module,
const char *  allocationLocation,
int32_t *  status 
)

Initializes a PCM.

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_SetCTREPCMClosedLoopControl()

void HAL_SetCTREPCMClosedLoopControl ( HAL_CTREPCMHandle  handle,
HAL_Bool  enabled,
int32_t *  status 
)

Enables the compressor closed loop control 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 PCM handle
[in]enabledtrue to enable closed loop control
[out]statusError status variable. 0 on success.

◆ HAL_SetCTREPCMOneShotDuration()

void HAL_SetCTREPCMOneShotDuration ( HAL_CTREPCMHandle  handle,
int32_t  index,
int32_t  durMs,
int32_t *  status 
)

Set the duration for a single solenoid shot.

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

◆ HAL_SetCTREPCMSolenoids()

void HAL_SetCTREPCMSolenoids ( HAL_CTREPCMHandle  handle,
int32_t  mask,
int32_t  values,
int32_t *  status 
)

Sets solenoids on a pneumatics module.

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