mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
[wpilib, hal] Add support for getting faults and versions from power distribution (#3794)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "hal/PowerDistribution.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <thread>
|
||||
|
||||
#include "CTREPDP.h"
|
||||
@@ -242,4 +243,34 @@ HAL_Bool HAL_GetPowerDistributionSwitchableChannel(
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_GetPowerDistributionVersion(HAL_PowerDistributionHandle handle,
|
||||
HAL_PowerDistributionVersion* version,
|
||||
int32_t* status) {
|
||||
if (IsCtre(handle)) {
|
||||
std::memset(version, 0, sizeof(*version));
|
||||
} else {
|
||||
HAL_GetREVPDHVersion(handle, version, status);
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_GetPowerDistributionFaults(HAL_PowerDistributionHandle handle,
|
||||
HAL_PowerDistributionFaults* faults,
|
||||
int32_t* status) {
|
||||
if (IsCtre(handle)) {
|
||||
std::memset(faults, 0, sizeof(*faults));
|
||||
} else {
|
||||
HAL_GetREVPDHFaults(handle, faults, status);
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_GetPowerDistributionStickyFaults(
|
||||
HAL_PowerDistributionHandle handle,
|
||||
HAL_PowerDistributionStickyFaults* stickyFaults, int32_t* status) {
|
||||
if (IsCtre(handle)) {
|
||||
std::memset(stickyFaults, 0, sizeof(*stickyFaults));
|
||||
} else {
|
||||
HAL_GetREVPDHStickyFaults(handle, stickyFaults, status);
|
||||
}
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
Reference in New Issue
Block a user