Hardware Abstraction Layer (HAL) to hardware or simulator.
More...
Hardware Abstraction Layer (HAL) to hardware or simulator.
◆ HAL_RuntimeType
Runtime type.
| Enumerator |
|---|
| HAL_RUNTIME_SYSTEMCORE | Systemcore runtime.
|
| HAL_RUNTIME_SIMULATION | Simulation runtime.
|
◆ HAL_GetBrownedOut()
| HAL_Bool HAL_GetBrownedOut |
( |
int32_t * | status | ) |
|
Gets if the system is in a browned out state.
- Parameters
-
| [out] | status | the error code, or 0 for success |
- Returns
- true if the system is in a low voltage brown out, false otherwise
◆ HAL_GetComments()
| void HAL_GetComments |
( |
struct WPI_String * | comments | ) |
|
Returns the comments from the roboRIO web interface.
- Parameters
-
| [out] | comments | The comments string. Free with WPI_FreeString |
◆ HAL_GetCommsDisableCount()
| int32_t HAL_GetCommsDisableCount |
( |
int32_t * | status | ) |
|
Gets the number of times the system has been disabled due to communication errors with the Driver Station.
- Returns
- number of disables due to communication errors.
◆ HAL_GetErrorMessage()
| const char * HAL_GetErrorMessage |
( |
int32_t | code | ) |
|
Gets the error message for a specific status code.
- Parameters
-
- Returns
- the error message for the code. This does not need to be freed.
◆ HAL_GetLastError()
| const char * HAL_GetLastError |
( |
HAL_Status * | status | ) |
|
Gets the last error set on this thread, or the message for the status code.
If passed HAL_USE_LAST_ERROR, the last error set on the thread will be returned.
- Parameters
-
| [out] | status | the status code, set to the error status code if input is HAL_USE_LAST_ERROR |
- Returns
- the error message for the code. This does not need to be freed, but can be overwritten by another hal call on the same thread.
◆ HAL_GetMonotonicTime()
| uint64_t HAL_GetMonotonicTime |
( |
void | | ) |
|
Reads the microsecond-resolution monotonic timer.
- Returns
- The current monotonic time in microseconds.
◆ HAL_GetRSLState()
| HAL_Bool HAL_GetRSLState |
( |
int32_t * | status | ) |
|
Gets the current state of the Robot Signal Light (RSL).
- Parameters
-
| [out] | status | the error code, or 0 for success |
- Returns
- The current state of the RSL- true if on, false if off
◆ HAL_GetRuntimeType()
Returns the runtime type of the HAL.
- Returns
- HAL Runtime Type
◆ HAL_GetSerialNumber()
| void HAL_GetSerialNumber |
( |
struct WPI_String * | serialNumber | ) |
|
Returns the roboRIO serial number.
- Parameters
-
| [out] | serialNumber | The roboRIO serial number. Free with WPI_FreeString |
◆ HAL_GetSystemActive()
| HAL_Bool HAL_GetSystemActive |
( |
int32_t * | status | ) |
|
Gets if the system outputs are currently active.
- Parameters
-
| [out] | status | the error code, or 0 for success |
- Returns
- true if the system outputs are active, false if disabled
◆ HAL_GetSystemTimeValid()
| HAL_Bool HAL_GetSystemTimeValid |
( |
int32_t * | status | ) |
|
Gets if the system time is valid.
- Parameters
-
| [out] | status | the error code, or 0 for success |
- Returns
- True if the system time is valid, false otherwise
◆ HAL_GetTeamNumber()
| int32_t HAL_GetTeamNumber |
( |
void | | ) |
|
Returns the team number configured for the robot controller.
- Returns
- team number, or 0 if not found.
◆ HAL_Initialize()
| HAL_Bool HAL_Initialize |
( |
int32_t | timeout, |
|
|
int32_t | mode ) |
Call this to start up HAL.
This is required for robot programs.
This must be called before any other HAL functions. Failure to do so will result in undefined behavior, and likely segmentation faults. This means that any statically initialized variables in a program MUST call this function in their constructors if they want to use other HAL calls.
The common parameters are 500 for timeout and 0 for mode.
This function is safe to call from any thread, and as many times as you wish. It internally guards from any reentrancy.
The applicable modes are: 0: Try to kill an existing HAL from another program, if not successful, error. 1: Force kill a HAL from another program. 2: Just warn if another hal exists and cannot be killed. Will likely result in undefined behavior.
- Parameters
-
| timeout | the initialization timeout (ms) |
| mode | the initialization mode (see remarks) |
- Returns
- true if initialization was successful, otherwise false.
◆ HAL_Shutdown()
| void HAL_Shutdown |
( |
void | | ) |
|
Call this to shut down HAL.
This must be called at termination of the robot program to avoid potential segmentation faults with simulation extensions at exit.
◆ HAL_SimPeriodicAfter()
| void HAL_SimPeriodicAfter |
( |
void | | ) |
|
Calls registered SimPeriodic "after" callbacks (only in simulation mode).
This should be called after user code periodic simulation functions.
◆ HAL_SimPeriodicBefore()
| void HAL_SimPeriodicBefore |
( |
void | | ) |
|
Calls registered SimPeriodic "before" callbacks (only in simulation mode).
This should be called prior to user code periodic simulation functions.