[hal, wpilib] Remove power rails that don't exist on systemcore (#7861)

This commit is contained in:
Thad House
2025-03-14 10:16:08 -07:00
committed by GitHub
parent d3cc185382
commit 52b353fe57
44 changed files with 27 additions and 3196 deletions

View File

@@ -80,7 +80,7 @@ double AnalogEncoder::Get() const {
}
double analog = m_analogInput->GetVoltage();
double pos = analog / RobotController::GetVoltage5V();
double pos = analog / RobotController::GetVoltage3V3();
// Map sensor range if range isn't full
pos = MapSensorRange(pos);

View File

@@ -39,7 +39,7 @@ AnalogPotentiometer::AnalogPotentiometer(std::shared_ptr<AnalogInput> input,
double AnalogPotentiometer::Get() const {
return (m_analog_input->GetAverageVoltage() /
RobotController::GetVoltage5V()) *
RobotController::GetVoltage3V3()) *
m_fullRange +
m_offset;
}

View File

@@ -9,7 +9,6 @@
#include <hal/CAN.h>
#include <hal/HALBase.h>
#include <hal/LEDs.h>
#include <hal/Power.h>
#include "frc/Errors.h"
@@ -69,13 +68,6 @@ uint64_t RobotController::GetFPGATime() {
return time;
}
bool RobotController::GetUserButton() {
int32_t status = 0;
bool value = HAL_GetFPGAButton(&status);
FRC_CheckErrorStatus(status, "GetUserButton");
return value;
}
units::volt_t RobotController::GetBatteryVoltage() {
int32_t status = 0;
double retVal = HAL_GetVinVoltage(&status);
@@ -125,13 +117,6 @@ double RobotController::GetInputVoltage() {
return retVal;
}
double RobotController::GetInputCurrent() {
int32_t status = 0;
double retVal = HAL_GetVinCurrent(&status);
FRC_CheckErrorStatus(status, "GetInputCurrent");
return retVal;
}
double RobotController::GetVoltage3V3() {
int32_t status = 0;
double retVal = HAL_GetUserVoltage3V3(&status);
@@ -166,74 +151,6 @@ int RobotController::GetFaultCount3V3() {
return retVal;
}
double RobotController::GetVoltage5V() {
int32_t status = 0;
double retVal = HAL_GetUserVoltage5V(&status);
FRC_CheckErrorStatus(status, "GetVoltage5V");
return retVal;
}
double RobotController::GetCurrent5V() {
int32_t status = 0;
double retVal = HAL_GetUserCurrent5V(&status);
FRC_CheckErrorStatus(status, "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);
FRC_CheckErrorStatus(status, "GetEnabled5V");
return retVal;
}
int RobotController::GetFaultCount5V() {
int32_t status = 0;
int retVal = HAL_GetUserCurrentFaults5V(&status);
FRC_CheckErrorStatus(status, "GetFaultCount5V");
return retVal;
}
double RobotController::GetVoltage6V() {
int32_t status = 0;
double retVal = HAL_GetUserVoltage6V(&status);
FRC_CheckErrorStatus(status, "GetVoltage6V");
return retVal;
}
double RobotController::GetCurrent6V() {
int32_t status = 0;
double retVal = HAL_GetUserCurrent6V(&status);
FRC_CheckErrorStatus(status, "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);
FRC_CheckErrorStatus(status, "GetEnabled6V");
return retVal;
}
int RobotController::GetFaultCount6V() {
int32_t status = 0;
int retVal = HAL_GetUserCurrentFaults6V(&status);
FRC_CheckErrorStatus(status, "GetFaultCount6V");
return retVal;
}
void RobotController::ResetRailFaultCounts() {
int32_t status = 0;
HAL_ResetUserCurrentFaults(&status);
@@ -260,30 +177,6 @@ units::celsius_t RobotController::GetCPUTemp() {
return units::celsius_t{retVal};
}
static_assert(RadioLEDState::kOff ==
static_cast<RadioLEDState>(HAL_RadioLEDState::HAL_RadioLED_kOff));
static_assert(
RadioLEDState::kGreen ==
static_cast<RadioLEDState>(HAL_RadioLEDState::HAL_RadioLED_kGreen));
static_assert(RadioLEDState::kRed ==
static_cast<RadioLEDState>(HAL_RadioLEDState::HAL_RadioLED_kRed));
static_assert(
RadioLEDState::kOrange ==
static_cast<RadioLEDState>(HAL_RadioLEDState::HAL_RadioLED_kOrange));
void RobotController::SetRadioLEDState(RadioLEDState state) {
int32_t status = 0;
HAL_SetRadioLEDState(static_cast<HAL_RadioLEDState>(state), &status);
FRC_CheckErrorStatus(status, "SetRadioLEDState");
}
RadioLEDState RobotController::GetRadioLEDState() {
int32_t status = 0;
auto retVal = static_cast<RadioLEDState>(HAL_GetRadioLEDState(&status));
FRC_CheckErrorStatus(status, "GetRadioLEDState");
return retVal;
}
CANStatus RobotController::GetCANStatus(int busId) {
int32_t status = 0;
float percentBusUtilization = 0;

View File

@@ -12,23 +12,6 @@
using namespace frc;
using namespace frc::sim;
std::unique_ptr<CallbackStore> RoboRioSim::RegisterFPGAButtonCallback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
-1, callback, &HALSIM_CancelRoboRioFPGAButtonCallback);
store->SetUid(HALSIM_RegisterRoboRioFPGAButtonCallback(
&CallbackStoreThunk, store.get(), initialNotify));
return store;
}
bool RoboRioSim::GetFPGAButton() {
return HALSIM_GetRoboRioFPGAButton();
}
void RoboRioSim::SetFPGAButton(bool fPGAButton) {
HALSIM_SetRoboRioFPGAButton(fPGAButton);
}
std::unique_ptr<CallbackStore> RoboRioSim::RegisterVInVoltageCallback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
@@ -46,125 +29,6 @@ void RoboRioSim::SetVInVoltage(units::volt_t vInVoltage) {
HALSIM_SetRoboRioVInVoltage(vInVoltage.value());
}
std::unique_ptr<CallbackStore> RoboRioSim::RegisterVInCurrentCallback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
-1, callback, &HALSIM_CancelRoboRioVInCurrentCallback);
store->SetUid(HALSIM_RegisterRoboRioVInCurrentCallback(
&CallbackStoreThunk, store.get(), initialNotify));
return store;
}
units::ampere_t RoboRioSim::GetVInCurrent() {
return units::ampere_t{HALSIM_GetRoboRioVInCurrent()};
}
void RoboRioSim::SetVInCurrent(units::ampere_t vInCurrent) {
HALSIM_SetRoboRioVInCurrent(vInCurrent.value());
}
std::unique_ptr<CallbackStore> RoboRioSim::RegisterUserVoltage6VCallback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
-1, callback, &HALSIM_CancelRoboRioUserVoltage6VCallback);
store->SetUid(HALSIM_RegisterRoboRioUserVoltage6VCallback(
&CallbackStoreThunk, store.get(), initialNotify));
return store;
}
units::volt_t RoboRioSim::GetUserVoltage6V() {
return units::volt_t{HALSIM_GetRoboRioUserVoltage6V()};
}
void RoboRioSim::SetUserVoltage6V(units::volt_t userVoltage6V) {
HALSIM_SetRoboRioUserVoltage6V(userVoltage6V.value());
}
std::unique_ptr<CallbackStore> RoboRioSim::RegisterUserCurrent6VCallback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
-1, callback, &HALSIM_CancelRoboRioUserCurrent6VCallback);
store->SetUid(HALSIM_RegisterRoboRioUserCurrent6VCallback(
&CallbackStoreThunk, store.get(), initialNotify));
return store;
}
units::ampere_t RoboRioSim::GetUserCurrent6V() {
return units::ampere_t{HALSIM_GetRoboRioUserCurrent6V()};
}
void RoboRioSim::SetUserCurrent6V(units::ampere_t userCurrent6V) {
HALSIM_SetRoboRioUserCurrent6V(userCurrent6V.value());
}
std::unique_ptr<CallbackStore> RoboRioSim::RegisterUserActive6VCallback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
-1, callback, &HALSIM_CancelRoboRioUserActive6VCallback);
store->SetUid(HALSIM_RegisterRoboRioUserActive6VCallback(
&CallbackStoreThunk, store.get(), initialNotify));
return store;
}
bool RoboRioSim::GetUserActive6V() {
return HALSIM_GetRoboRioUserActive6V();
}
void RoboRioSim::SetUserActive6V(bool userActive6V) {
HALSIM_SetRoboRioUserActive6V(userActive6V);
}
std::unique_ptr<CallbackStore> RoboRioSim::RegisterUserVoltage5VCallback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
-1, callback, &HALSIM_CancelRoboRioUserVoltage5VCallback);
store->SetUid(HALSIM_RegisterRoboRioUserVoltage5VCallback(
&CallbackStoreThunk, store.get(), initialNotify));
return store;
}
units::volt_t RoboRioSim::GetUserVoltage5V() {
return units::volt_t{HALSIM_GetRoboRioUserVoltage5V()};
}
void RoboRioSim::SetUserVoltage5V(units::volt_t userVoltage5V) {
HALSIM_SetRoboRioUserVoltage5V(userVoltage5V.value());
}
std::unique_ptr<CallbackStore> RoboRioSim::RegisterUserCurrent5VCallback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
-1, callback, &HALSIM_CancelRoboRioUserCurrent5VCallback);
store->SetUid(HALSIM_RegisterRoboRioUserCurrent5VCallback(
&CallbackStoreThunk, store.get(), initialNotify));
return store;
}
units::ampere_t RoboRioSim::GetUserCurrent5V() {
return units::ampere_t{HALSIM_GetRoboRioUserCurrent5V()};
}
void RoboRioSim::SetUserCurrent5V(units::ampere_t userCurrent5V) {
HALSIM_SetRoboRioUserCurrent5V(userCurrent5V.value());
}
std::unique_ptr<CallbackStore> RoboRioSim::RegisterUserActive5VCallback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
-1, callback, &HALSIM_CancelRoboRioUserActive5VCallback);
store->SetUid(HALSIM_RegisterRoboRioUserActive5VCallback(
&CallbackStoreThunk, store.get(), initialNotify));
return store;
}
bool RoboRioSim::GetUserActive5V() {
return HALSIM_GetRoboRioUserActive5V();
}
void RoboRioSim::SetUserActive5V(bool userActive5V) {
HALSIM_SetRoboRioUserActive5V(userActive5V);
}
std::unique_ptr<CallbackStore> RoboRioSim::RegisterUserVoltage3V3Callback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
@@ -216,40 +80,6 @@ void RoboRioSim::SetUserActive3V3(bool userActive3V3) {
HALSIM_SetRoboRioUserActive3V3(userActive3V3);
}
std::unique_ptr<CallbackStore> RoboRioSim::RegisterUserFaults6VCallback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
-1, callback, &HALSIM_CancelRoboRioUserFaults6VCallback);
store->SetUid(HALSIM_RegisterRoboRioUserFaults6VCallback(
&CallbackStoreThunk, store.get(), initialNotify));
return store;
}
int RoboRioSim::GetUserFaults6V() {
return HALSIM_GetRoboRioUserFaults6V();
}
void RoboRioSim::SetUserFaults6V(int userFaults6V) {
HALSIM_SetRoboRioUserFaults6V(userFaults6V);
}
std::unique_ptr<CallbackStore> RoboRioSim::RegisterUserFaults5VCallback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
-1, callback, &HALSIM_CancelRoboRioUserFaults5VCallback);
store->SetUid(HALSIM_RegisterRoboRioUserFaults5VCallback(
&CallbackStoreThunk, store.get(), initialNotify));
return store;
}
int RoboRioSim::GetUserFaults5V() {
return HALSIM_GetRoboRioUserFaults5V();
}
void RoboRioSim::SetUserFaults5V(int userFaults5V) {
HALSIM_SetRoboRioUserFaults5V(userFaults5V);
}
std::unique_ptr<CallbackStore> RoboRioSim::RegisterUserFaults3V3Callback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
@@ -344,23 +174,6 @@ void RoboRioSim::SetComments(std::string_view comments) {
HALSIM_SetRoboRioComments(&str);
}
std::unique_ptr<CallbackStore> RoboRioSim::RegisterRadioLEDStateCallback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
-1, callback, &HALSIM_CancelRoboRioRadioLEDStateCallback);
store->SetUid(HALSIM_RegisterRoboRioRadioLEDStateCallback(
&CallbackStoreThunk, store.get(), initialNotify));
return store;
}
RadioLEDState RoboRioSim::GetRadioLEDState() {
return static_cast<RadioLEDState>(HALSIM_GetRoboRioRadioLEDState());
}
void RoboRioSim::SetRadioLEDState(RadioLEDState state) {
HALSIM_SetRoboRioRadioLEDState(static_cast<HAL_RadioLEDState>(state));
}
void RoboRioSim::ResetData() {
HALSIM_ResetRoboRioData();
}