2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
2017-08-18 21:35:53 -07:00
|
|
|
|
2018-07-20 00:03:45 -07:00
|
|
|
#include "hal/Power.h"
|
2017-08-18 21:35:53 -07:00
|
|
|
|
2018-07-20 00:03:45 -07:00
|
|
|
#include "mockdata/RoboRioDataInternal.h"
|
2017-08-18 21:35:53 -07:00
|
|
|
|
|
|
|
|
using namespace hal;
|
|
|
|
|
|
2020-12-28 01:19:59 -08:00
|
|
|
namespace hal::init {
|
2017-12-10 19:38:53 -08:00
|
|
|
void InitializePower() {}
|
2020-12-28 01:19:59 -08:00
|
|
|
} // namespace hal::init
|
2017-12-10 19:38:53 -08:00
|
|
|
|
2017-08-18 21:35:53 -07:00
|
|
|
// TODO: Fix the naming in here
|
|
|
|
|
extern "C" {
|
2020-12-28 12:58:06 -08:00
|
|
|
double HAL_GetVinVoltage(int32_t* status) {
|
|
|
|
|
return SimRoboRioData->vInVoltage;
|
|
|
|
|
}
|
|
|
|
|
double HAL_GetVinCurrent(int32_t* status) {
|
|
|
|
|
return SimRoboRioData->vInCurrent;
|
|
|
|
|
}
|
2017-08-18 21:35:53 -07:00
|
|
|
double HAL_GetUserVoltage6V(int32_t* status) {
|
2020-07-04 00:44:56 -07:00
|
|
|
return SimRoboRioData->userVoltage6V;
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
|
|
|
|
double HAL_GetUserCurrent6V(int32_t* status) {
|
2020-07-04 00:44:56 -07:00
|
|
|
return SimRoboRioData->userCurrent6V;
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
|
|
|
|
HAL_Bool HAL_GetUserActive6V(int32_t* status) {
|
2020-07-04 00:44:56 -07:00
|
|
|
return SimRoboRioData->userActive6V;
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
|
|
|
|
int32_t HAL_GetUserCurrentFaults6V(int32_t* status) {
|
2020-07-04 00:44:56 -07:00
|
|
|
return SimRoboRioData->userFaults6V;
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
|
|
|
|
double HAL_GetUserVoltage5V(int32_t* status) {
|
2020-07-04 00:44:56 -07:00
|
|
|
return SimRoboRioData->userVoltage5V;
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
|
|
|
|
double HAL_GetUserCurrent5V(int32_t* status) {
|
2020-07-04 00:44:56 -07:00
|
|
|
return SimRoboRioData->userCurrent5V;
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
|
|
|
|
HAL_Bool HAL_GetUserActive5V(int32_t* status) {
|
2020-07-04 00:44:56 -07:00
|
|
|
return SimRoboRioData->userActive5V;
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
|
|
|
|
int32_t HAL_GetUserCurrentFaults5V(int32_t* status) {
|
2020-07-04 00:44:56 -07:00
|
|
|
return SimRoboRioData->userFaults5V;
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
|
|
|
|
double HAL_GetUserVoltage3V3(int32_t* status) {
|
2020-07-04 00:44:56 -07:00
|
|
|
return SimRoboRioData->userVoltage3V3;
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
|
|
|
|
double HAL_GetUserCurrent3V3(int32_t* status) {
|
2020-07-04 00:44:56 -07:00
|
|
|
return SimRoboRioData->userCurrent3V3;
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
|
|
|
|
HAL_Bool HAL_GetUserActive3V3(int32_t* status) {
|
2020-07-04 00:44:56 -07:00
|
|
|
return SimRoboRioData->userActive3V3;
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
|
|
|
|
int32_t HAL_GetUserCurrentFaults3V3(int32_t* status) {
|
2020-07-04 00:44:56 -07:00
|
|
|
return SimRoboRioData->userFaults3V3;
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
2021-10-13 19:14:27 -07:00
|
|
|
void HAL_SetBrownoutVoltage(double voltage, int32_t* status) {
|
|
|
|
|
SimRoboRioData->brownoutVoltage = voltage;
|
|
|
|
|
}
|
|
|
|
|
double HAL_GetBrownoutVoltage(int32_t* status) {
|
|
|
|
|
return SimRoboRioData->brownoutVoltage;
|
|
|
|
|
}
|
2017-08-18 21:35:53 -07:00
|
|
|
} // extern "C"
|