[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

@@ -148,6 +148,15 @@ public final class RobotController {
return PowerJNI.getUserCurrent3V3();
}
/**
* Enables or disables the 3.3V rail.
*
* @param enabled whether to enable the 3.3V rail.
*/
public static void setEnabled3V3(boolean enabled) {
PowerJNI.setUserEnabled3V3(enabled);
}
/**
* 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.
@@ -185,6 +194,15 @@ public final class RobotController {
return PowerJNI.getUserCurrent5V();
}
/**
* Enables or disables the 5V rail.
*
* @param enabled whether to enable the 5V rail.
*/
public static void setEnabled5V(boolean enabled) {
PowerJNI.setUserEnabled5V(enabled);
}
/**
* 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.
@@ -222,6 +240,15 @@ public final class RobotController {
return PowerJNI.getUserCurrent6V();
}
/**
* Enables or disables the 6V rail.
*
* @param enabled whether to enable the 6V rail.
*/
public static void setEnabled6V(boolean enabled) {
PowerJNI.setUserEnabled6V(enabled);
}
/**
* 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.
@@ -261,6 +288,15 @@ public final class RobotController {
PowerJNI.setBrownoutVoltage(brownoutVoltage);
}
/**
* Get the current CPU temperature in degrees Celsius.
*
* @return current CPU temperature in degrees Celsius
*/
public static double getCPUTemp() {
return PowerJNI.getCPUTemp();
}
/**
* Get the current status of the CAN bus.
*