WPILibC++
2019.1.1-beta-2-9-g70a66fc
|
Hardware Abstraction Layer to hardware or simulator. More...
Functions | |
HAL_ENUM (HAL_RuntimeType) | |
const char * | HAL_GetErrorMessage (int32_t code) |
Gets the error message for a specific status code. More... | |
int32_t | HAL_GetFPGAVersion (int32_t *status) |
Returns the FPGA Version number. More... | |
int64_t | HAL_GetFPGARevision (int32_t *status) |
Returns the FPGA Revision number. More... | |
HAL_RuntimeType | HAL_GetRuntimeType (void) |
HAL_Bool | HAL_GetFPGAButton (int32_t *status) |
Gets the state of the "USER" button on the roboRIO. More... | |
HAL_Bool | HAL_GetSystemActive (int32_t *status) |
Gets if the system outputs are currently active. More... | |
HAL_Bool | HAL_GetBrownedOut (int32_t *status) |
Gets if the system is in a browned out state. More... | |
void | HAL_BaseInitialize (int32_t *status) |
The base HAL initialize function. More... | |
HAL_PortHandle | HAL_GetPort (int32_t channel) |
Gets a port handle for a specific channel. More... | |
HAL_PortHandle | HAL_GetPortWithModule (int32_t module, int32_t channel) |
Gets a port handle for a specific channel and module. More... | |
uint64_t | HAL_GetFPGATime (int32_t *status) |
Reads the microsecond-resolution timer on the FPGA. More... | |
HAL_Bool | HAL_Initialize (int32_t timeout, int32_t mode) |
Call this to start up HAL. More... | |
int64_t | HAL_Report (int32_t resource, int32_t instanceNumber, int32_t context, const char *feature) |
Reports a hardware usage to the HAL. More... | |
Hardware Abstraction Layer to hardware or simulator.
void HAL_BaseInitialize | ( | int32_t * | status | ) |
The base HAL initialize function.
Useful if you need to ensure the DS and base HAL functions (the ones above this declaration in HAL.h) are properly initialized. For normal programs and executables, please use HAL_Initialize.
This is mainly expected to be use from libraries that are expected to be used from LabVIEW, as it handles its own initialization for objects.
HAL_Bool HAL_GetBrownedOut | ( | int32_t * | status | ) |
Gets if the system is in a browned out state.
const char* HAL_GetErrorMessage | ( | int32_t | code | ) |
Gets the error message for a specific status code.
code | the status code |
HAL_Bool HAL_GetFPGAButton | ( | int32_t * | status | ) |
Gets the state of the "USER" button on the roboRIO.
int64_t HAL_GetFPGARevision | ( | int32_t * | status | ) |
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.
uint64_t HAL_GetFPGATime | ( | int32_t * | status | ) |
Reads the microsecond-resolution timer on the FPGA.
int32_t HAL_GetFPGAVersion | ( | int32_t * | status | ) |
Returns the FPGA Version number.
For now, expect this to be competition year.
HAL_PortHandle HAL_GetPort | ( | int32_t | channel | ) |
Gets a port handle for a specific channel.
The created handle does not need to be freed.
channel | the channel number |
HAL_PortHandle HAL_GetPortWithModule | ( | int32_t | module, |
int32_t | channel | ||
) |
Gets a port handle for a specific channel and module.
This is expected to be used for PCMs, as the roboRIO does not work with modules anymore.
The created handle does not need to be freed.
module | the module number |
channel | the channel number |
HAL_Bool HAL_GetSystemActive | ( | int32_t * | status | ) |
Gets if the system outputs are currently active.
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.
timeout | the initialization timeout (ms) |
mode | the initialization mode (see remarks) |
int64_t HAL_Report | ( | int32_t | resource, |
int32_t | instanceNumber, | ||
int32_t | context, | ||
const char * | feature | ||
) |
Reports a hardware usage to the HAL.
resource | the used resource |
instanceNumber | the instance of the resource |
context | a user specified context index |
feature | a user specified feature string |