WPILibC++  2019.1.1-beta-4-27-ga2368a6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
HALBase.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include <stdint.h>
11 
12 #include "hal/Types.h"
13 
20 // clang-format off
21 HAL_ENUM(HAL_RuntimeType) { HAL_Athena, HAL_Mock };
22 // clang-format on
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
34 const char* HAL_GetErrorMessage(int32_t code);
35 
43 int32_t HAL_GetFPGAVersion(int32_t* status);
44 
55 int64_t HAL_GetFPGARevision(int32_t* status);
56 
57 HAL_RuntimeType HAL_GetRuntimeType(void);
58 
64 HAL_Bool HAL_GetFPGAButton(int32_t* status);
65 
71 HAL_Bool HAL_GetSystemActive(int32_t* status);
72 
78 HAL_Bool HAL_GetBrownedOut(int32_t* status);
79 
88 void HAL_BaseInitialize(int32_t* status);
89 
90 #ifndef HAL_USE_LABVIEW
91 
100 HAL_PortHandle HAL_GetPort(int32_t channel);
101 
114 HAL_PortHandle HAL_GetPortWithModule(int32_t module, int32_t channel);
115 
122 uint64_t HAL_GetFPGATime(int32_t* status);
123 
148 HAL_Bool HAL_Initialize(int32_t timeout, int32_t mode);
149 
150 // ifdef's definition is to allow for default parameters in C++.
151 #ifdef __cplusplus
152 
161 int64_t HAL_Report(int32_t resource, int32_t instanceNumber,
162  int32_t context = 0, const char* feature = nullptr);
163 #else
164 
174 int64_t HAL_Report(int32_t resource, int32_t instanceNumber, int32_t context,
175  const char* feature);
176 #endif
177 
178 #endif // HAL_USE_LABVIEW
179 #ifdef __cplusplus
180 } // extern "C"
181 #endif
182 
HAL_Bool HAL_GetSystemActive(int32_t *status)
Gets if the system outputs are currently active.
int64_t HAL_Report(int32_t resource, int32_t instanceNumber, int32_t context, const char *feature)
Reports a hardware usage to the HAL.
int64_t HAL_GetFPGARevision(int32_t *status)
Returns the FPGA Revision number.
void HAL_BaseInitialize(int32_t *status)
The base HAL initialize function.
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.
uint64_t HAL_GetFPGATime(int32_t *status)
Reads the microsecond-resolution timer on the FPGA.
HAL_PortHandle HAL_GetPortWithModule(int32_t module, int32_t channel)
Gets a port handle for a specific channel and module.
HAL_Bool HAL_Initialize(int32_t timeout, int32_t mode)
Call this to start up HAL.
int32_t HAL_GetFPGAVersion(int32_t *status)
Returns the FPGA Version number.
HAL_PortHandle HAL_GetPort(int32_t channel)
Gets a port handle for a specific channel.
HAL_Bool HAL_GetFPGAButton(int32_t *status)
Gets the state of the "USER" button on the roboRIO.