WPILibC++  2018.4.1-20180729181730-1145-g898076f
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
HAL.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2013-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 #ifndef HAL_USE_LABVIEW
13 
14 #include "hal/Accelerometer.h"
15 #include "hal/AnalogAccumulator.h"
16 #include "hal/AnalogGyro.h"
17 #include "hal/AnalogInput.h"
18 #include "hal/AnalogOutput.h"
19 #include "hal/AnalogTrigger.h"
20 #include "hal/CAN.h"
21 #include "hal/Compressor.h"
22 #include "hal/Constants.h"
23 #include "hal/Counter.h"
24 #include "hal/DIO.h"
25 #include "hal/DriverStation.h"
26 #include "hal/Errors.h"
27 #include "hal/I2C.h"
28 #include "hal/Interrupts.h"
29 #include "hal/Notifier.h"
30 #include "hal/PDP.h"
31 #include "hal/PWM.h"
32 #include "hal/Ports.h"
33 #include "hal/Power.h"
34 #include "hal/Relay.h"
35 #include "hal/SPI.h"
36 #include "hal/SerialPort.h"
37 #include "hal/Solenoid.h"
38 
39 #endif // HAL_USE_LABVIEW
40 
41 #include "hal/Types.h"
42 
43 #ifdef __cplusplus
44 #include "UsageReporting.h"
45 
46 namespace HALUsageReporting = nUsageReporting;
47 #endif
48 
55 // clang-format off
56 HAL_ENUM(HAL_RuntimeType) { HAL_Athena, HAL_Mock };
57 // clang-format on
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
69 const char* HAL_GetErrorMessage(int32_t code);
70 
78 int32_t HAL_GetFPGAVersion(int32_t* status);
79 
90 int64_t HAL_GetFPGARevision(int32_t* status);
91 
92 HAL_RuntimeType HAL_GetRuntimeType(void);
93 
99 HAL_Bool HAL_GetFPGAButton(int32_t* status);
100 
106 HAL_Bool HAL_GetSystemActive(int32_t* status);
107 
113 HAL_Bool HAL_GetBrownedOut(int32_t* status);
114 
123 void HAL_BaseInitialize(int32_t* status);
124 
125 #ifndef HAL_USE_LABVIEW
126 
135 HAL_PortHandle HAL_GetPort(int32_t channel);
136 
149 HAL_PortHandle HAL_GetPortWithModule(int32_t module, int32_t channel);
150 
157 uint64_t HAL_GetFPGATime(int32_t* status);
158 
183 HAL_Bool HAL_Initialize(int32_t timeout, int32_t mode);
184 
185 // ifdef's definition is to allow for default parameters in C++.
186 #ifdef __cplusplus
187 
196 int64_t HAL_Report(int32_t resource, int32_t instanceNumber,
197  int32_t context = 0, const char* feature = nullptr);
198 #else
199 
209 int64_t HAL_Report(int32_t resource, int32_t instanceNumber, int32_t context,
210  const char* feature);
211 #endif
212 
213 #endif // HAL_USE_LABVIEW
214 #ifdef __cplusplus
215 } // extern "C"
216 #endif
217 
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.
Definition: UsageReporting.h:18
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.