[hal] Expose power rail disable and cpu temp functionality (#5477)

This commit is contained in:
Ryan Blue
2023-08-04 02:48:29 -04:00
committed by GitHub
parent 3ad5d2e42d
commit e2d17a24a6
12 changed files with 255 additions and 9 deletions

View File

@@ -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;