mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[hal] Expose power rail disable and cpu temp functionality (#5477)
This commit is contained in:
@@ -111,6 +111,12 @@ double RobotController::GetCurrent3V3() {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
void RobotController::SetEnabled3V3(bool enabled) {
|
||||
int32_t status = 0;
|
||||
HAL_SetUserRailEnabled3V3(enabled, &status);
|
||||
FRC_CheckErrorStatus(status, "SetEnabled3V3");
|
||||
}
|
||||
|
||||
bool RobotController::GetEnabled3V3() {
|
||||
int32_t status = 0;
|
||||
bool retVal = HAL_GetUserActive3V3(&status);
|
||||
@@ -139,6 +145,12 @@ double RobotController::GetCurrent5V() {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
void RobotController::SetEnabled5V(bool enabled) {
|
||||
int32_t status = 0;
|
||||
HAL_SetUserRailEnabled5V(enabled, &status);
|
||||
FRC_CheckErrorStatus(status, "SetEnabled5V");
|
||||
}
|
||||
|
||||
bool RobotController::GetEnabled5V() {
|
||||
int32_t status = 0;
|
||||
bool retVal = HAL_GetUserActive5V(&status);
|
||||
@@ -167,6 +179,12 @@ double RobotController::GetCurrent6V() {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
void RobotController::SetEnabled6V(bool enabled) {
|
||||
int32_t status = 0;
|
||||
HAL_SetUserRailEnabled6V(enabled, &status);
|
||||
FRC_CheckErrorStatus(status, "SetEnabled6V");
|
||||
}
|
||||
|
||||
bool RobotController::GetEnabled6V() {
|
||||
int32_t status = 0;
|
||||
bool retVal = HAL_GetUserActive6V(&status);
|
||||
@@ -194,6 +212,13 @@ void RobotController::SetBrownoutVoltage(units::volt_t brownoutVoltage) {
|
||||
FRC_CheckErrorStatus(status, "SetBrownoutVoltage");
|
||||
}
|
||||
|
||||
units::celsius_t RobotController::GetCPUTemp() {
|
||||
int32_t status = 0;
|
||||
double retVal = HAL_GetCPUTemp(&status);
|
||||
FRC_CheckErrorStatus(status, "GetCPUTemp");
|
||||
return units::celsius_t{retVal};
|
||||
}
|
||||
|
||||
CANStatus RobotController::GetCANStatus() {
|
||||
int32_t status = 0;
|
||||
float percentBusUtilization = 0;
|
||||
|
||||
Reference in New Issue
Block a user