mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Moved C++ comments from source files to headers (#1111)
Also sorted functions in C++ sources to match order in related headers.
This commit is contained in:
committed by
Peter Johnson
parent
d9971a705a
commit
8c680a26f8
@@ -11,15 +11,8 @@
|
||||
|
||||
#include "ErrorBase.h"
|
||||
|
||||
namespace frc {
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Return the FPGA Version number.
|
||||
*
|
||||
* For now, expect this to be competition year.
|
||||
*
|
||||
* @return FPGA Version number.
|
||||
*/
|
||||
int RobotController::GetFPGAVersion() {
|
||||
int32_t status = 0;
|
||||
int version = HAL_GetFPGAVersion(&status);
|
||||
@@ -27,15 +20,6 @@ int RobotController::GetFPGAVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the FPGA Revision number.
|
||||
*
|
||||
* The format of the revision is 3 numbers. The 12 most significant bits are the
|
||||
* Major Revision. The next 8 bits are the Minor Revision. The 12 least
|
||||
* significant bits are the Build Number.
|
||||
*
|
||||
* @return FPGA Revision number.
|
||||
*/
|
||||
int64_t RobotController::GetFPGARevision() {
|
||||
int32_t status = 0;
|
||||
int64_t revision = HAL_GetFPGARevision(&status);
|
||||
@@ -43,12 +27,6 @@ int64_t RobotController::GetFPGARevision() {
|
||||
return revision;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the microsecond-resolution timer on the FPGA.
|
||||
*
|
||||
* @return The current time in microseconds according to the FPGA (since FPGA
|
||||
* reset).
|
||||
*/
|
||||
uint64_t RobotController::GetFPGATime() {
|
||||
int32_t status = 0;
|
||||
uint64_t time = HAL_GetFPGATime(&status);
|
||||
@@ -56,11 +34,6 @@ uint64_t RobotController::GetFPGATime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the state of the "USER" button on the roboRIO.
|
||||
*
|
||||
* @return True if the button is currently pressed down
|
||||
*/
|
||||
bool RobotController::GetUserButton() {
|
||||
int32_t status = 0;
|
||||
|
||||
@@ -70,14 +43,6 @@ bool RobotController::GetUserButton() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the FPGA outputs are enabled.
|
||||
*
|
||||
* The outputs may be disabled if the robot is disabled or e-stopped, the
|
||||
* watchdog has expired, or if the roboRIO browns out.
|
||||
*
|
||||
* @return True if the FPGA outputs are enabled.
|
||||
*/
|
||||
bool RobotController::IsSysActive() {
|
||||
int32_t status = 0;
|
||||
bool retVal = HAL_GetSystemActive(&status);
|
||||
@@ -85,11 +50,6 @@ bool RobotController::IsSysActive() {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the system is browned out.
|
||||
*
|
||||
* @return True if the system is browned out
|
||||
*/
|
||||
bool RobotController::IsBrownedOut() {
|
||||
int32_t status = 0;
|
||||
bool retVal = HAL_GetBrownedOut(&status);
|
||||
@@ -97,11 +57,6 @@ bool RobotController::IsBrownedOut() {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the input voltage to the robot controller.
|
||||
*
|
||||
* @return The controller input voltage value in Volts
|
||||
*/
|
||||
double RobotController::GetInputVoltage() {
|
||||
int32_t status = 0;
|
||||
double retVal = HAL_GetVinVoltage(&status);
|
||||
@@ -109,11 +64,6 @@ double RobotController::GetInputVoltage() {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the input current to the robot controller.
|
||||
*
|
||||
* @return The controller input current value in Amps
|
||||
*/
|
||||
double RobotController::GetInputCurrent() {
|
||||
int32_t status = 0;
|
||||
double retVal = HAL_GetVinCurrent(&status);
|
||||
@@ -121,111 +71,6 @@ double RobotController::GetInputCurrent() {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the voltage of the 6V rail.
|
||||
*
|
||||
* @return The controller 6V rail voltage value in Volts
|
||||
*/
|
||||
double RobotController::GetVoltage6V() {
|
||||
int32_t status = 0;
|
||||
double retVal = HAL_GetUserVoltage6V(&status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current output of the 6V rail.
|
||||
*
|
||||
* @return The controller 6V rail output current value in Amps
|
||||
*/
|
||||
double RobotController::GetCurrent6V() {
|
||||
int32_t status = 0;
|
||||
double retVal = HAL_GetUserCurrent6V(&status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @return The controller 6V rail enabled value. True for enabled.
|
||||
*/
|
||||
bool RobotController::GetEnabled6V() {
|
||||
int32_t status = 0;
|
||||
bool retVal = HAL_GetUserActive6V(&status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the count of the total current faults on the 6V rail since the controller
|
||||
* has booted.
|
||||
*
|
||||
* @return The number of faults.
|
||||
*/
|
||||
int RobotController::GetFaultCount6V() {
|
||||
int32_t status = 0;
|
||||
int retVal = HAL_GetUserCurrentFaults6V(&status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the voltage of the 5V rail.
|
||||
*
|
||||
* @return The controller 5V rail voltage value in Volts
|
||||
*/
|
||||
double RobotController::GetVoltage5V() {
|
||||
int32_t status = 0;
|
||||
double retVal = HAL_GetUserVoltage5V(&status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current output of the 5V rail.
|
||||
*
|
||||
* @return The controller 5V rail output current value in Amps
|
||||
*/
|
||||
double RobotController::GetCurrent5V() {
|
||||
int32_t status = 0;
|
||||
double retVal = HAL_GetUserCurrent5V(&status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @return The controller 5V rail enabled value. True for enabled.
|
||||
*/
|
||||
bool RobotController::GetEnabled5V() {
|
||||
int32_t status = 0;
|
||||
bool retVal = HAL_GetUserActive5V(&status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the count of the total current faults on the 5V rail since the controller
|
||||
* has booted.
|
||||
*
|
||||
* @return The number of faults
|
||||
*/
|
||||
int RobotController::GetFaultCount5V() {
|
||||
int32_t status = 0;
|
||||
int retVal = HAL_GetUserCurrentFaults5V(&status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the voltage of the 3.3V rail.
|
||||
*
|
||||
* @return The controller 3.3V rail voltage value in Volts
|
||||
*/
|
||||
double RobotController::GetVoltage3V3() {
|
||||
int32_t status = 0;
|
||||
double retVal = HAL_GetUserVoltage3V3(&status);
|
||||
@@ -233,11 +78,6 @@ double RobotController::GetVoltage3V3() {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current output of the 3.3V rail.
|
||||
*
|
||||
* @return The controller 3.3V rail output current value in Amps
|
||||
*/
|
||||
double RobotController::GetCurrent3V3() {
|
||||
int32_t status = 0;
|
||||
double retVal = HAL_GetUserCurrent3V3(&status);
|
||||
@@ -245,12 +85,6 @@ double RobotController::GetCurrent3V3() {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @return The controller 3.3V rail enabled value. True for enabled.
|
||||
*/
|
||||
bool RobotController::GetEnabled3V3() {
|
||||
int32_t status = 0;
|
||||
bool retVal = HAL_GetUserActive3V3(&status);
|
||||
@@ -258,12 +92,6 @@ bool RobotController::GetEnabled3V3() {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the count of the total current faults on the 3.3V rail since the
|
||||
* controller has booted.
|
||||
*
|
||||
* @return The number of faults
|
||||
*/
|
||||
int RobotController::GetFaultCount3V3() {
|
||||
int32_t status = 0;
|
||||
int retVal = HAL_GetUserCurrentFaults3V3(&status);
|
||||
@@ -271,6 +99,62 @@ int RobotController::GetFaultCount3V3() {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
double RobotController::GetVoltage5V() {
|
||||
int32_t status = 0;
|
||||
double retVal = HAL_GetUserVoltage5V(&status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
double RobotController::GetCurrent5V() {
|
||||
int32_t status = 0;
|
||||
double retVal = HAL_GetUserCurrent5V(&status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
bool RobotController::GetEnabled5V() {
|
||||
int32_t status = 0;
|
||||
bool retVal = HAL_GetUserActive5V(&status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
int RobotController::GetFaultCount5V() {
|
||||
int32_t status = 0;
|
||||
int retVal = HAL_GetUserCurrentFaults5V(&status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
double RobotController::GetVoltage6V() {
|
||||
int32_t status = 0;
|
||||
double retVal = HAL_GetUserVoltage6V(&status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
double RobotController::GetCurrent6V() {
|
||||
int32_t status = 0;
|
||||
double retVal = HAL_GetUserCurrent6V(&status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
bool RobotController::GetEnabled6V() {
|
||||
int32_t status = 0;
|
||||
bool retVal = HAL_GetUserActive6V(&status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
int RobotController::GetFaultCount6V() {
|
||||
int32_t status = 0;
|
||||
int retVal = HAL_GetUserCurrentFaults6V(&status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
CANStatus RobotController::GetCANStatus() {
|
||||
int32_t status = 0;
|
||||
float percentBusUtilization = 0;
|
||||
@@ -288,4 +172,3 @@ CANStatus RobotController::GetCANStatus() {
|
||||
static_cast<int>(txFullCount), static_cast<int>(receiveErrorCount),
|
||||
static_cast<int>(transmitErrorCount)};
|
||||
}
|
||||
} // namespace frc
|
||||
|
||||
Reference in New Issue
Block a user