Package edu.wpi.first.hal
Class HALUtil
java.lang.Object
edu.wpi.first.hal.JNIWrapper
edu.wpi.first.hal.HALUtil
Hardware Abstraction Layer (HAL) Utilities JNI Functions.
- See Also:
-
- "hal/HALBase.h"
-
Nested Class Summary
Nested classes/interfaces inherited from class edu.wpi.first.hal.JNIWrapper
JNIWrapper.Helper
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Attempted to read AnalogTrigger pulse output.static final int
The operation cannot be completed.static final int
Digital module loop timing is not the expected value.static final int
No available resources to allocate.static final int
A pointer parameter to a method is NULL.static final int
A parameter is out of range.static final int
roboRIO 1.0.static final int
roboRIO 2.0.static final int
Simulation runtime.static final int
Analog module sample rate is too high.static final int
Voltage to convert to raw value is out of range [0; 5]. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Returns the comments from the roboRIO web interface.static boolean
Gets the state of the "USER" button on the roboRIO.static int
Returns the FPGA Revision number.static long
Reads the microsecond-resolution timer on the FPGA.static short
Returns the FPGA Version number.static int
Get the last HAL error code.static String
getHALErrorMessage
(int code) Gets the error message for a specific status code.static int
Returns the runtime type of the HAL.static String
Gets the error message for the last HAL error.static String
getHALstrerror
(int errno) Returns the textual description of the system error code.static String
Returns the roboRIO serial number.static int
Returns the team number configured for the robot controller.Methods inherited from class edu.wpi.first.hal.JNIWrapper
forceLoad, suppressUnused
-
Field Details
-
NULL_PARAMETER
A pointer parameter to a method is NULL.- See Also:
-
SAMPLE_RATE_TOO_HIGH
Analog module sample rate is too high.- See Also:
-
VOLTAGE_OUT_OF_RANGE
Voltage to convert to raw value is out of range [0; 5].- See Also:
-
LOOP_TIMING_ERROR
Digital module loop timing is not the expected value.- See Also:
-
INCOMPATIBLE_STATE
The operation cannot be completed.- See Also:
-
ANALOG_TRIGGER_PULSE_OUTPUT_ERROR
Attempted to read AnalogTrigger pulse output.- See Also:
-
NO_AVAILABLE_RESOURCES
No available resources to allocate.- See Also:
-
PARAMETER_OUT_OF_RANGE
A parameter is out of range.- See Also:
-
RUNTIME_ROBORIO
roboRIO 1.0.- See Also:
-
RUNTIME_ROBORIO2
roboRIO 2.0.- See Also:
-
RUNTIME_SIMULATION
Simulation runtime.- See Also:
-
-
Method Details
-
getFPGAVersion
Returns the FPGA Version number.For now, expect this to be competition year.
- Returns:
- FPGA Version number.
- See Also:
-
- "HAL_GetFPGAVersion"
-
getFPGARevision
Returns 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.
- Returns:
- FPGA Revision number.
- See Also:
-
- "HAL_GetFPGARevision"
-
getSerialNumber
Returns the roboRIO serial number.- Returns:
- The roboRIO serial number.
- See Also:
-
- "HAL_GetSerialNumber"
-
getComments
Returns the comments from the roboRIO web interface.- Returns:
- The comments string.
- See Also:
-
- "HAL_GetComments"
-
getTeamNumber
Returns the team number configured for the robot controller.- Returns:
- team number, or 0 if not found.
- See Also:
-
- "HAL_GetTeamNumber"
-
getFPGATime
Reads the microsecond-resolution timer on the FPGA.- Returns:
- The current time in microseconds according to the FPGA (since FPGA reset).
-
getHALRuntimeType
Returns the runtime type of the HAL.- Returns:
- HAL Runtime Type
- See Also:
-
RUNTIME_ROBORIO
RUNTIME_ROBORIO2
RUNTIME_SIMULATION
- "HAL_GetRuntimeType"
-
getFPGAButton
Gets the state of the "USER" button on the roboRIO.Warning: the User Button is used to stop user programs from automatically loading if it is held for more then 5 seconds. Because of this, it's not recommended to be used by teams for any other purpose.
- Returns:
- true if the button is currently pressed down
- See Also:
-
- "HAL_GetFPGAButton"
-
getHALErrorMessage
Gets the error message for a specific status code.- Parameters:
code
- the status code- Returns:
- the error message for the code. This does not need to be freed.
- See Also:
-
- "HAL_GetErrorMessage"
-
getHALErrno
Get the last HAL error code.- Returns:
- error code
-
getHALstrerror
Returns the textual description of the system error code.- Parameters:
errno
- errno to get description of- Returns:
- description of errno
- See Also:
-
- "std:strerror"
-
getHALstrerror
Gets the error message for the last HAL error.- Returns:
- the error message for the code.
-