WPILibC++ 2024.3.2
Power Distribution Functions

Functions to control Power Distribution devices. More...

Classes

struct  HAL_PowerDistributionVersion
 Power distribution version. More...
 
struct  HAL_PowerDistributionFaults
 
struct  HAL_PowerDistributionStickyFaults
 Storage for REV PDH Sticky Faults. More...
 
struct  HAL_PowerDistributionChannelData
 

Macros

#define HAL_DEFAULT_POWER_DISTRIBUTION_MODULE   -1
 

Typedefs

typedef struct HAL_PowerDistributionChannelData HAL_PowerDistributionChannelData
 

Enumerations

enum  HAL_PowerDistributionType : int32_t { HAL_PowerDistributionType_kAutomatic = 0 , HAL_PowerDistributionType_kCTRE = 1 , HAL_PowerDistributionType_kRev = 2 }
 The types of power distribution devices. More...
 

Functions

HAL_PowerDistributionHandle HAL_InitializePowerDistribution (int32_t moduleNumber, HAL_PowerDistributionType type, const char *allocationLocation, int32_t *status)
 Initializes a Power Distribution Panel. More...
 
int32_t HAL_GetPowerDistributionModuleNumber (HAL_PowerDistributionHandle handle, int32_t *status)
 Gets the module number for a specific handle. More...
 
void HAL_CleanPowerDistribution (HAL_PowerDistributionHandle handle)
 Cleans a PowerDistribution module. More...
 
HAL_Bool HAL_CheckPowerDistributionChannel (HAL_PowerDistributionHandle handle, int32_t channel)
 Checks if a PowerDistribution channel is valid. More...
 
HAL_Bool HAL_CheckPowerDistributionModule (int32_t module, HAL_PowerDistributionType type)
 Checks if a PowerDistribution module is valid. More...
 
HAL_PowerDistributionType HAL_GetPowerDistributionType (HAL_PowerDistributionHandle handle, int32_t *status)
 Gets the type of PowerDistribution module. More...
 
int32_t HAL_GetPowerDistributionNumChannels (HAL_PowerDistributionHandle handle, int32_t *status)
 Gets the number of channels for this handle. More...
 
double HAL_GetPowerDistributionTemperature (HAL_PowerDistributionHandle handle, int32_t *status)
 Gets the temperature of the Power Distribution Panel. More...
 
double HAL_GetPowerDistributionVoltage (HAL_PowerDistributionHandle handle, int32_t *status)
 Gets the PowerDistribution input voltage. More...
 
double HAL_GetPowerDistributionChannelCurrent (HAL_PowerDistributionHandle handle, int32_t channel, int32_t *status)
 Gets the current of a specific PowerDistribution channel. More...
 
void HAL_GetPowerDistributionAllChannelCurrents (HAL_PowerDistributionHandle handle, double *currents, int32_t currentsLength, int32_t *status)
 Gets the current of all channels on the PowerDistribution. More...
 
double HAL_GetPowerDistributionTotalCurrent (HAL_PowerDistributionHandle handle, int32_t *status)
 Gets the total current of the PowerDistribution. More...
 
double HAL_GetPowerDistributionTotalPower (HAL_PowerDistributionHandle handle, int32_t *status)
 Gets the total power of the Power Distribution Panel. More...
 
double HAL_GetPowerDistributionTotalEnergy (HAL_PowerDistributionHandle handle, int32_t *status)
 Gets the total energy of the Power Distribution Panel. More...
 
void HAL_ResetPowerDistributionTotalEnergy (HAL_PowerDistributionHandle handle, int32_t *status)
 Resets the PowerDistribution accumulated energy. More...
 
void HAL_ClearPowerDistributionStickyFaults (HAL_PowerDistributionHandle handle, int32_t *status)
 Clears any PowerDistribution sticky faults. More...
 
void HAL_SetPowerDistributionSwitchableChannel (HAL_PowerDistributionHandle handle, HAL_Bool enabled, int32_t *status)
 Power on/off switchable channel. More...
 
HAL_Bool HAL_GetPowerDistributionSwitchableChannel (HAL_PowerDistributionHandle handle, int32_t *status)
 Returns true if switchable channel is powered on. More...
 
void HAL_GetPowerDistributionVersion (HAL_PowerDistributionHandle handle, HAL_PowerDistributionVersion *version, int32_t *status)
 Get the version of the PowerDistribution. More...
 
void HAL_GetPowerDistributionFaults (HAL_PowerDistributionHandle handle, HAL_PowerDistributionFaults *faults, int32_t *status)
 Get the current faults of the PowerDistribution. More...
 
void HAL_GetPowerDistributionStickyFaults (HAL_PowerDistributionHandle handle, HAL_PowerDistributionStickyFaults *stickyFaults, int32_t *status)
 Gets the sticky faults of the PowerDistribution. More...
 
void HAL_StartPowerDistributionStream (HAL_PowerDistributionHandle handle, int32_t *status)
 
HAL_PowerDistributionChannelDataHAL_GetPowerDistributionStreamData (HAL_PowerDistributionHandle handle, int32_t *count, int32_t *status)
 
void HAL_FreePowerDistributionStreamData (HAL_PowerDistributionChannelData *data, int32_t count)
 
void HAL_StopPowerDistributionStream (HAL_PowerDistributionHandle handle, int32_t *status)
 

Detailed Description

Functions to control Power Distribution devices.

Macro Definition Documentation

◆ HAL_DEFAULT_POWER_DISTRIBUTION_MODULE

#define HAL_DEFAULT_POWER_DISTRIBUTION_MODULE   -1

Typedef Documentation

◆ HAL_PowerDistributionChannelData

Enumeration Type Documentation

◆ HAL_PowerDistributionType

enum HAL_PowerDistributionType : int32_t

The types of power distribution devices.

Enumerator
HAL_PowerDistributionType_kAutomatic 
HAL_PowerDistributionType_kCTRE 
HAL_PowerDistributionType_kRev 

Function Documentation

◆ HAL_CheckPowerDistributionChannel()

HAL_Bool HAL_CheckPowerDistributionChannel ( HAL_PowerDistributionHandle  handle,
int32_t  channel 
)

Checks if a PowerDistribution channel is valid.

Parameters
handlethe module handle
channelthe channel to check
Returns
true if the channel is valid, otherwise false

◆ HAL_CheckPowerDistributionModule()

HAL_Bool HAL_CheckPowerDistributionModule ( int32_t  module,
HAL_PowerDistributionType  type 
)

Checks if a PowerDistribution module is valid.

Parameters
modulethe module to check
typethe type of module
Returns
true if the module is valid, otherwise false

◆ HAL_CleanPowerDistribution()

void HAL_CleanPowerDistribution ( HAL_PowerDistributionHandle  handle)

Cleans a PowerDistribution module.

Parameters
handlethe module handle

◆ HAL_ClearPowerDistributionStickyFaults()

void HAL_ClearPowerDistributionStickyFaults ( HAL_PowerDistributionHandle  handle,
int32_t *  status 
)

Clears any PowerDistribution sticky faults.

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

◆ HAL_FreePowerDistributionStreamData()

void HAL_FreePowerDistributionStreamData ( HAL_PowerDistributionChannelData data,
int32_t  count 
)

◆ HAL_GetPowerDistributionAllChannelCurrents()

void HAL_GetPowerDistributionAllChannelCurrents ( HAL_PowerDistributionHandle  handle,
double *  currents,
int32_t  currentsLength,
int32_t *  status 
)

Gets the current of all channels on the PowerDistribution.

The array must be large enough to hold all channels.

Parameters
[in]handlethe module handle
[out]currentsthe currents
[in]currentsLengththe length of the currents array
[out]statusError status variable. 0 on success.

◆ HAL_GetPowerDistributionChannelCurrent()

double HAL_GetPowerDistributionChannelCurrent ( HAL_PowerDistributionHandle  handle,
int32_t  channel,
int32_t *  status 
)

Gets the current of a specific PowerDistribution channel.

Parameters
[in]handlethe module handle
[in]channelthe channel
[out]statusError status variable. 0 on success.
Returns
the channel current (amps)

◆ HAL_GetPowerDistributionFaults()

void HAL_GetPowerDistributionFaults ( HAL_PowerDistributionHandle  handle,
HAL_PowerDistributionFaults faults,
int32_t *  status 
)

Get the current faults of the PowerDistribution.

Parameters
[in]handlethe module handle
[out]faultsthe HAL_PowerDistributionFaults to populate
[out]statusError status variable. 0 on success.

◆ HAL_GetPowerDistributionModuleNumber()

int32_t HAL_GetPowerDistributionModuleNumber ( HAL_PowerDistributionHandle  handle,
int32_t *  status 
)

Gets the module number for a specific handle.

Parameters
[in]handlethe module handle
[out]statusError status variable. 0 on success.
Returns
the module number

◆ HAL_GetPowerDistributionNumChannels()

int32_t HAL_GetPowerDistributionNumChannels ( HAL_PowerDistributionHandle  handle,
int32_t *  status 
)

Gets the number of channels for this handle.

Parameters
[in]handlethe handle
[out]statusError status variable. 0 on success.
Returns
number of channels

◆ HAL_GetPowerDistributionStickyFaults()

void HAL_GetPowerDistributionStickyFaults ( HAL_PowerDistributionHandle  handle,
HAL_PowerDistributionStickyFaults stickyFaults,
int32_t *  status 
)

Gets the sticky faults of the PowerDistribution.

Parameters
[in]handlethe module handle
[out]stickyFaultsthe HAL_PowerDistributionStickyFaults to populate
[out]statusError status variable. 0 on success.

◆ HAL_GetPowerDistributionStreamData()

HAL_PowerDistributionChannelData * HAL_GetPowerDistributionStreamData ( HAL_PowerDistributionHandle  handle,
int32_t *  count,
int32_t *  status 
)

◆ HAL_GetPowerDistributionSwitchableChannel()

HAL_Bool HAL_GetPowerDistributionSwitchableChannel ( HAL_PowerDistributionHandle  handle,
int32_t *  status 
)

Returns true if switchable channel is powered on.

This is a REV PDH-specific function. This function will no-op on CTRE PDP.

Parameters
[in]handlethe module handle
[out]statusError status variable. 0 on success.
Returns
the state of the switchable channel

◆ HAL_GetPowerDistributionTemperature()

double HAL_GetPowerDistributionTemperature ( HAL_PowerDistributionHandle  handle,
int32_t *  status 
)

Gets the temperature of the Power Distribution Panel.

Not supported on the Rev PDH and returns 0.

Parameters
[in]handlethe module handle
[out]statusError status variable. 0 on success.
Returns
the module temperature (celsius)

◆ HAL_GetPowerDistributionTotalCurrent()

double HAL_GetPowerDistributionTotalCurrent ( HAL_PowerDistributionHandle  handle,
int32_t *  status 
)

Gets the total current of the PowerDistribution.

Parameters
[in]handlethe module handle
[out]statusError status variable. 0 on success.
Returns
the total current (amps)

◆ HAL_GetPowerDistributionTotalEnergy()

double HAL_GetPowerDistributionTotalEnergy ( HAL_PowerDistributionHandle  handle,
int32_t *  status 
)

Gets the total energy of the Power Distribution Panel.

Not supported on the Rev PDH and returns 0.

Parameters
[in]handlethe module handle
[out]statusError status variable. 0 on success.
Returns
the total energy (joules)

◆ HAL_GetPowerDistributionTotalPower()

double HAL_GetPowerDistributionTotalPower ( HAL_PowerDistributionHandle  handle,
int32_t *  status 
)

Gets the total power of the Power Distribution Panel.

Not supported on the Rev PDH and returns 0.

Parameters
[in]handlethe module handle
[out]statusError status variable. 0 on success.
Returns
the total power (watts)

◆ HAL_GetPowerDistributionType()

HAL_PowerDistributionType HAL_GetPowerDistributionType ( HAL_PowerDistributionHandle  handle,
int32_t *  status 
)

Gets the type of PowerDistribution module.

Parameters
[in]handlethe module handle
[out]statusError status variable. 0 on success.
Returns
the type of module

◆ HAL_GetPowerDistributionVersion()

void HAL_GetPowerDistributionVersion ( HAL_PowerDistributionHandle  handle,
HAL_PowerDistributionVersion version,
int32_t *  status 
)

Get the version of the PowerDistribution.

Parameters
[in]handlethe module handle
[out]versionthe HAL_PowerDistributionVersion to populate
[out]statusError status variable. 0 on success.

◆ HAL_GetPowerDistributionVoltage()

double HAL_GetPowerDistributionVoltage ( HAL_PowerDistributionHandle  handle,
int32_t *  status 
)

Gets the PowerDistribution input voltage.

Parameters
[in]handlethe module handle
[out]statusError status variable. 0 on success.
Returns
the input voltage (volts)

◆ HAL_InitializePowerDistribution()

HAL_PowerDistributionHandle HAL_InitializePowerDistribution ( int32_t  moduleNumber,
HAL_PowerDistributionType  type,
const char *  allocationLocation,
int32_t *  status 
)

Initializes a Power Distribution Panel.

Parameters
[in]moduleNumberthe module number to initialize
[in]typethe type of module to initialize
[in]allocationLocationthe location where the allocation is occurring
[out]statusError status variable. 0 on success.
Returns
the created PowerDistribution handle

◆ HAL_ResetPowerDistributionTotalEnergy()

void HAL_ResetPowerDistributionTotalEnergy ( HAL_PowerDistributionHandle  handle,
int32_t *  status 
)

Resets the PowerDistribution accumulated energy.

Not supported on the Rev PDH and does nothing.

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

◆ HAL_SetPowerDistributionSwitchableChannel()

void HAL_SetPowerDistributionSwitchableChannel ( HAL_PowerDistributionHandle  handle,
HAL_Bool  enabled,
int32_t *  status 
)

Power on/off switchable channel.

This is a REV PDH-specific function. This function will no-op on CTRE PDP.

Parameters
[in]handlethe module handle
[in]enabledtrue to turn on switchable channel
[out]statusError status variable. 0 on success.

◆ HAL_StartPowerDistributionStream()

void HAL_StartPowerDistributionStream ( HAL_PowerDistributionHandle  handle,
int32_t *  status 
)

◆ HAL_StopPowerDistributionStream()

void HAL_StopPowerDistributionStream ( HAL_PowerDistributionHandle  handle,
int32_t *  status 
)