WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
DriverStation.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2013-2017. 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 <cstddef>
13 
14 #include "HAL/Types.h"
15 
16 #define HAL_IO_CONFIG_DATA_SIZE 32
17 #define HAL_SYS_STATUS_DATA_SIZE 44
18 #define HAL_USER_STATUS_DATA_SIZE \
19  (984 - HAL_IO_CONFIG_DATA_SIZE - HAL_SYS_STATUS_DATA_SIZE)
20 
21 #define HALFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Input 17
22 #define HALFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Output 18
23 #define HALFRC_NetworkCommunication_DynamicType_Kinect_Header 19
24 #define HALFRC_NetworkCommunication_DynamicType_Kinect_Extra1 20
25 #define HALFRC_NetworkCommunication_DynamicType_Kinect_Vertices1 21
26 #define HALFRC_NetworkCommunication_DynamicType_Kinect_Extra2 22
27 #define HALFRC_NetworkCommunication_DynamicType_Kinect_Vertices2 23
28 #define HALFRC_NetworkCommunication_DynamicType_Kinect_Joystick 24
29 #define HALFRC_NetworkCommunication_DynamicType_Kinect_Custom 25
30 
32  uint32_t enabled : 1;
33  uint32_t autonomous : 1;
34  uint32_t test : 1;
35  uint32_t eStop : 1;
36  uint32_t fmsAttached : 1;
37  uint32_t dsAttached : 1;
38  uint32_t control_reserved : 26;
39 };
40 
41 enum HAL_AllianceStationID : int32_t {
42  HAL_AllianceStationID_kRed1,
43  HAL_AllianceStationID_kRed2,
44  HAL_AllianceStationID_kRed3,
45  HAL_AllianceStationID_kBlue1,
46  HAL_AllianceStationID_kBlue2,
47  HAL_AllianceStationID_kBlue3,
48 };
49 
50 /* The maximum number of axes that will be stored in a single HALJoystickAxes
51  * struct. This is used for allocating buffers, not bounds checking, since
52  * there are usually less axes in practice.
53  */
54 #define HAL_kMaxJoystickAxes 12
55 #define HAL_kMaxJoystickPOVs 12
56 
58  int16_t count;
59  float axes[HAL_kMaxJoystickAxes];
60 };
61 
63  int16_t count;
64  int16_t povs[HAL_kMaxJoystickPOVs];
65 };
66 
68  uint32_t buttons;
69  uint8_t count;
70 };
71 
73  uint8_t isXbox;
74  uint8_t type;
75  char name[256];
76  uint8_t axisCount;
77  uint8_t axisTypes[HAL_kMaxJoystickAxes];
78  uint8_t buttonCount;
79  uint8_t povCount;
80 };
81 
82 #ifdef __cplusplus
83 extern "C" {
84 #endif
85 int32_t HAL_SetErrorData(const char* errors, int32_t errorsLength,
86  int32_t waitMs);
87 int32_t HAL_SendError(HAL_Bool isError, int32_t errorCode, HAL_Bool isLVCode,
88  const char* details, const char* location,
89  const char* callStack, HAL_Bool printMsg);
90 
91 int32_t HAL_GetControlWord(HAL_ControlWord* controlWord);
92 HAL_AllianceStationID HAL_GetAllianceStation(int32_t* status);
93 int32_t HAL_GetJoystickAxes(int32_t joystickNum, HAL_JoystickAxes* axes);
94 int32_t HAL_GetJoystickPOVs(int32_t joystickNum, HAL_JoystickPOVs* povs);
95 int32_t HAL_GetJoystickButtons(int32_t joystickNum,
96  HAL_JoystickButtons* buttons);
97 int32_t HAL_GetJoystickDescriptor(int32_t joystickNum,
99 HAL_Bool HAL_GetJoystickIsXbox(int32_t joystickNum);
100 int32_t HAL_GetJoystickType(int32_t joystickNum);
101 char* HAL_GetJoystickName(int32_t joystickNum);
102 int32_t HAL_GetJoystickAxisType(int32_t joystickNum, int32_t axis);
103 int32_t HAL_SetJoystickOutputs(int32_t joystickNum, int64_t outputs,
104  int32_t leftRumble, int32_t rightRumble);
105 double HAL_GetMatchTime(int32_t* status);
106 
107 #ifndef HAL_USE_LABVIEW
108 
109 void HAL_WaitForDSData(void);
110 void HAL_InitializeDriverStation(void);
111 
112 void HAL_ObserveUserProgramStarting(void);
113 void HAL_ObserveUserProgramDisabled(void);
114 void HAL_ObserveUserProgramAutonomous(void);
115 void HAL_ObserveUserProgramTeleop(void);
116 void HAL_ObserveUserProgramTest(void);
117 
118 #endif // HAL_USE_LABVIEW
119 
120 #ifdef __cplusplus
121 } // extern "C"
122 #endif
Definition: DriverStation.h:72
Definition: DriverStation.h:62
Definition: DriverStation.h:67
Definition: DriverStation.h:31
Definition: DriverStation.h:57