mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-02 02:51:42 +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;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <units/temperature.h>
|
||||
#include <units/voltage.h>
|
||||
|
||||
namespace frc {
|
||||
@@ -136,9 +137,16 @@ class RobotController {
|
||||
static double GetCurrent3V3();
|
||||
|
||||
/**
|
||||
* Get the enabled state of the 3.3V rail. The rail may be disabled due to a
|
||||
* controller brownout, a short circuit on the rail, or controller
|
||||
* over-voltage.
|
||||
* Enables or disables the 3.3V rail.
|
||||
*
|
||||
* @param enabled whether to enable the 3.3V rail.
|
||||
*/
|
||||
static void SetEnabled3V3(bool enabled);
|
||||
|
||||
/**
|
||||
* Get the enabled state of the 3.3V rail. The rail may be disabled due to
|
||||
* calling SetEnabled3V3(), a controller brownout, a short circuit on the
|
||||
* rail, or controller over-voltage.
|
||||
*
|
||||
* @return The controller 3.3V rail enabled value. True for enabled.
|
||||
*/
|
||||
@@ -167,9 +175,16 @@ class RobotController {
|
||||
static double GetCurrent5V();
|
||||
|
||||
/**
|
||||
* Get the enabled state of the 5V rail. The rail may be disabled due to a
|
||||
* controller brownout, a short circuit on the rail, or controller
|
||||
* over-voltage.
|
||||
* Enables or disables the 5V rail.
|
||||
*
|
||||
* @param enabled whether to enable the 5V rail.
|
||||
*/
|
||||
static void SetEnabled5V(bool enabled);
|
||||
|
||||
/**
|
||||
* Get the enabled state of the 5V rail. The rail may be disabled due to
|
||||
* calling SetEnabled5V(), a controller brownout, a short circuit on the rail,
|
||||
* or controller over-voltage.
|
||||
*
|
||||
* @return The controller 5V rail enabled value. True for enabled.
|
||||
*/
|
||||
@@ -198,9 +213,16 @@ class RobotController {
|
||||
static double GetCurrent6V();
|
||||
|
||||
/**
|
||||
* Get the enabled state of the 6V rail. The rail may be disabled due to a
|
||||
* controller brownout, a short circuit on the rail, or controller
|
||||
* over-voltage.
|
||||
* Enables or disables the 6V rail.
|
||||
*
|
||||
* @param enabled whether to enable the 6V rail.
|
||||
*/
|
||||
static void SetEnabled6V(bool enabled);
|
||||
|
||||
/**
|
||||
* Get the enabled state of the 6V rail. The rail may be disabled due to
|
||||
* calling SetEnabled6V(), a controller brownout, a short circuit on the rail,
|
||||
* or controller over-voltage.
|
||||
*
|
||||
* @return The controller 6V rail enabled value. True for enabled.
|
||||
*/
|
||||
@@ -231,6 +253,13 @@ class RobotController {
|
||||
*/
|
||||
static void SetBrownoutVoltage(units::volt_t brownoutVoltage);
|
||||
|
||||
/**
|
||||
* Get the current CPU temperature.
|
||||
*
|
||||
* @return current CPU temperature
|
||||
*/
|
||||
static units::celsius_t GetCPUTemp();
|
||||
|
||||
/**
|
||||
* Get the current status of the CAN bus.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user