mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-30 02:31:44 +00:00
[hal,wpilib] Rename PowerDistribution constants to all caps
This commit is contained in:
@@ -13,11 +13,11 @@
|
||||
using namespace wpi::hal;
|
||||
|
||||
static_assert(org_wpilib_hardware_hal_PowerDistributionJNI_AUTOMATIC_TYPE ==
|
||||
HAL_PowerDistributionType::HAL_PowerDistributionType_kAutomatic);
|
||||
HAL_PowerDistributionType::HAL_POWER_DISTRIBUTION_AUTOMATIC);
|
||||
static_assert(org_wpilib_hardware_hal_PowerDistributionJNI_CTRE_TYPE ==
|
||||
HAL_PowerDistributionType::HAL_PowerDistributionType_kCTRE);
|
||||
HAL_PowerDistributionType::HAL_POWER_DISTRIBUTION_CTRE);
|
||||
static_assert(org_wpilib_hardware_hal_PowerDistributionJNI_REV_TYPE ==
|
||||
HAL_PowerDistributionType::HAL_PowerDistributionType_kRev);
|
||||
HAL_PowerDistributionType::HAL_POWER_DISTRIBUTION_REV);
|
||||
static_assert(org_wpilib_hardware_hal_PowerDistributionJNI_DEFAULT_MODULE ==
|
||||
HAL_DEFAULT_POWER_DISTRIBUTION_MODULE);
|
||||
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
*/
|
||||
HAL_ENUM(HAL_PowerDistributionType) {
|
||||
/** Automatically determines the module type */
|
||||
HAL_PowerDistributionType_kAutomatic = 0,
|
||||
HAL_POWER_DISTRIBUTION_AUTOMATIC = 0,
|
||||
/** CTRE (Cross The Road Electronics) Power Distribution Panel (PDP). */
|
||||
HAL_PowerDistributionType_kCTRE = 1,
|
||||
HAL_POWER_DISTRIBUTION_CTRE = 1,
|
||||
/** REV Power Distribution Hub (PDH). */
|
||||
HAL_PowerDistributionType_kRev = 2,
|
||||
HAL_POWER_DISTRIBUTION_REV = 2,
|
||||
};
|
||||
|
||||
/** Use the default module number for the selected module type */
|
||||
|
||||
@@ -30,7 +30,7 @@ extern "C" {
|
||||
HAL_PowerDistributionHandle HAL_InitializePowerDistribution(
|
||||
int32_t busId, int32_t module, HAL_PowerDistributionType type,
|
||||
const char* allocationLocation, int32_t* status) {
|
||||
if (type == HAL_PowerDistributionType_kAutomatic) {
|
||||
if (type == HAL_POWER_DISTRIBUTION_AUTOMATIC) {
|
||||
if (module != HAL_DEFAULT_POWER_DISTRIBUTION_MODULE) {
|
||||
*status = PARAMETER_OUT_OF_RANGE;
|
||||
wpi::hal::SetLastError(
|
||||
@@ -39,13 +39,13 @@ HAL_PowerDistributionHandle HAL_InitializePowerDistribution(
|
||||
}
|
||||
|
||||
// TODO Make this not matter
|
||||
type = HAL_PowerDistributionType_kCTRE;
|
||||
type = HAL_POWER_DISTRIBUTION_CTRE;
|
||||
module = 0;
|
||||
}
|
||||
|
||||
if (!HAL_CheckPowerDistributionModule(module, type)) {
|
||||
*status = RESOURCE_OUT_OF_RANGE;
|
||||
if (type == HAL_PowerDistributionType::HAL_PowerDistributionType_kCTRE) {
|
||||
if (type == HAL_PowerDistributionType::HAL_POWER_DISTRIBUTION_CTRE) {
|
||||
wpi::hal::SetLastErrorIndexOutOfRange(status,
|
||||
"Invalid Index for CTRE PDP", 0,
|
||||
kNumCTREPDPModules - 1, module);
|
||||
@@ -79,7 +79,7 @@ int32_t HAL_GetPowerDistributionModuleNumber(HAL_PowerDistributionHandle handle,
|
||||
|
||||
HAL_Bool HAL_CheckPowerDistributionModule(int32_t module,
|
||||
HAL_PowerDistributionType type) {
|
||||
if (type == HAL_PowerDistributionType::HAL_PowerDistributionType_kCTRE) {
|
||||
if (type == HAL_PowerDistributionType::HAL_POWER_DISTRIBUTION_CTRE) {
|
||||
return module < kNumCTREPDPModules && module >= 0;
|
||||
} else {
|
||||
return module <= kNumREVPDHModules && module >= 1;
|
||||
@@ -98,7 +98,7 @@ HAL_Bool HAL_CheckPowerDistributionChannel(HAL_PowerDistributionHandle handle,
|
||||
|
||||
HAL_PowerDistributionType HAL_GetPowerDistributionType(
|
||||
HAL_PowerDistributionHandle handle, int32_t* status) {
|
||||
return HAL_PowerDistributionType::HAL_PowerDistributionType_kCTRE;
|
||||
return HAL_PowerDistributionType::HAL_POWER_DISTRIBUTION_CTRE;
|
||||
}
|
||||
|
||||
int32_t HAL_GetPowerDistributionNumChannels(HAL_PowerDistributionHandle handle,
|
||||
|
||||
@@ -22,7 +22,7 @@ extern "C" {
|
||||
HAL_PowerDistributionHandle HAL_InitializePowerDistribution(
|
||||
int32_t busId, int32_t moduleNumber, HAL_PowerDistributionType type,
|
||||
const char* allocationLocation, int32_t* status) {
|
||||
if (type == HAL_PowerDistributionType::HAL_PowerDistributionType_kAutomatic) {
|
||||
if (type == HAL_PowerDistributionType::HAL_POWER_DISTRIBUTION_AUTOMATIC) {
|
||||
if (moduleNumber != HAL_DEFAULT_POWER_DISTRIBUTION_MODULE) {
|
||||
*status = PARAMETER_OUT_OF_RANGE;
|
||||
wpi::hal::SetLastError(
|
||||
@@ -57,7 +57,7 @@ HAL_PowerDistributionHandle HAL_InitializePowerDistribution(
|
||||
return static_cast<HAL_PowerDistributionHandle>(pdhHandle);
|
||||
}
|
||||
|
||||
if (type == HAL_PowerDistributionType::HAL_PowerDistributionType_kCTRE) {
|
||||
if (type == HAL_PowerDistributionType::HAL_POWER_DISTRIBUTION_CTRE) {
|
||||
if (moduleNumber == HAL_DEFAULT_POWER_DISTRIBUTION_MODULE) {
|
||||
moduleNumber = 0;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ HAL_Bool HAL_CheckPowerDistributionChannel(HAL_PowerDistributionHandle handle,
|
||||
|
||||
HAL_Bool HAL_CheckPowerDistributionModule(int32_t module,
|
||||
HAL_PowerDistributionType type) {
|
||||
if (type == HAL_PowerDistributionType::HAL_PowerDistributionType_kCTRE) {
|
||||
if (type == HAL_PowerDistributionType::HAL_POWER_DISTRIBUTION_CTRE) {
|
||||
return HAL_CheckPDPModule(module);
|
||||
} else {
|
||||
return HAL_CheckREVPDHModuleNumber(module);
|
||||
@@ -111,9 +111,8 @@ HAL_Bool HAL_CheckPowerDistributionModule(int32_t module,
|
||||
|
||||
HAL_PowerDistributionType HAL_GetPowerDistributionType(
|
||||
HAL_PowerDistributionHandle handle, int32_t* status) {
|
||||
return IsCtre(handle)
|
||||
? HAL_PowerDistributionType::HAL_PowerDistributionType_kCTRE
|
||||
: HAL_PowerDistributionType::HAL_PowerDistributionType_kRev;
|
||||
return IsCtre(handle) ? HAL_PowerDistributionType::HAL_POWER_DISTRIBUTION_CTRE
|
||||
: HAL_PowerDistributionType::HAL_POWER_DISTRIBUTION_REV;
|
||||
}
|
||||
|
||||
int32_t HAL_GetPowerDistributionNumChannels(HAL_PowerDistributionHandle handle,
|
||||
|
||||
Reference in New Issue
Block a user