mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[hal, wpilib] Add brownout voltage configuration (#3632)
This commit is contained in:
@@ -159,6 +159,19 @@ int RobotController::GetFaultCount6V() {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
units::volt_t RobotController::GetBrownoutVoltage() {
|
||||
int32_t status = 0;
|
||||
double retVal = HAL_GetBrownoutVoltage(&status);
|
||||
FRC_CheckErrorStatus(status, "{}", "GetBrownoutVoltage");
|
||||
return units::volt_t(retVal);
|
||||
}
|
||||
|
||||
void RobotController::SetBrownoutVoltage(units::volt_t brownoutVoltage) {
|
||||
int32_t status = 0;
|
||||
HAL_SetBrownoutVoltage(brownoutVoltage.to<double>(), &status);
|
||||
FRC_CheckErrorStatus(status, "{}", "SetBrownoutVoltage");
|
||||
}
|
||||
|
||||
CANStatus RobotController::GetCANStatus() {
|
||||
int32_t status = 0;
|
||||
float percentBusUtilization = 0;
|
||||
|
||||
@@ -267,6 +267,23 @@ void RoboRioSim::SetUserFaults3V3(int userFaults3V3) {
|
||||
HALSIM_SetRoboRioUserFaults3V3(userFaults3V3);
|
||||
}
|
||||
|
||||
std::unique_ptr<CallbackStore> RoboRioSim::RegisterBrownoutVoltageCallback(
|
||||
NotifyCallback callback, bool initialNotify) {
|
||||
auto store = std::make_unique<CallbackStore>(
|
||||
-1, callback, &HALSIM_CancelRoboRioBrownoutVoltageCallback);
|
||||
store->SetUid(HALSIM_RegisterRoboRioBrownoutVoltageCallback(
|
||||
&CallbackStoreThunk, store.get(), initialNotify));
|
||||
return store;
|
||||
}
|
||||
|
||||
units::volt_t RoboRioSim::GetBrownoutVoltage() {
|
||||
return units::volt_t(HALSIM_GetRoboRioBrownoutVoltage());
|
||||
}
|
||||
|
||||
void RoboRioSim::SetBrownoutVoltage(units::volt_t vInVoltage) {
|
||||
HALSIM_SetRoboRioBrownoutVoltage(vInVoltage.to<double>());
|
||||
}
|
||||
|
||||
void RoboRioSim::ResetData() {
|
||||
HALSIM_ResetRoboRioData();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user