WPILibC++  2020.3.2
DriverStation.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2013-2020 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/DriverStationTypes.h"
13 #include "hal/Types.h"
14 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
37 int32_t HAL_SendError(HAL_Bool isError, int32_t errorCode, HAL_Bool isLVCode,
38  const char* details, const char* location,
39  const char* callStack, HAL_Bool printMsg);
45 int32_t HAL_SendConsoleLine(const char* line);
46 
55 int32_t HAL_GetControlWord(HAL_ControlWord* controlWord);
56 
63 HAL_AllianceStationID HAL_GetAllianceStation(int32_t* status);
64 
72 int32_t HAL_GetJoystickAxes(int32_t joystickNum, HAL_JoystickAxes* axes);
73 
81 int32_t HAL_GetJoystickPOVs(int32_t joystickNum, HAL_JoystickPOVs* povs);
82 
90 int32_t HAL_GetJoystickButtons(int32_t joystickNum,
91  HAL_JoystickButtons* buttons);
92 
105 int32_t HAL_GetJoystickDescriptor(int32_t joystickNum,
106  HAL_JoystickDescriptor* desc);
107 
114 HAL_Bool HAL_GetJoystickIsXbox(int32_t joystickNum);
115 
125 int32_t HAL_GetJoystickType(int32_t joystickNum);
126 
137 char* HAL_GetJoystickName(int32_t joystickNum);
138 
144 void HAL_FreeJoystickName(char* name);
145 
156 int32_t HAL_GetJoystickAxisType(int32_t joystickNum, int32_t axis);
157 
167 int32_t HAL_SetJoystickOutputs(int32_t joystickNum, int64_t outputs,
168  int32_t leftRumble, int32_t rightRumble);
169 
186 double HAL_GetMatchTime(int32_t* status);
187 
194 int32_t HAL_GetMatchInfo(HAL_MatchInfo* info);
195 
200 void HAL_ReleaseDSMutex(void);
201 
208 
218 HAL_Bool HAL_WaitForCachedControlDataTimeout(double timeout);
219 
226 HAL_Bool HAL_IsNewControlData(void);
227 
231 void HAL_WaitForDSData(void);
232 
241 HAL_Bool HAL_WaitForDSDataTimeout(double timeout);
242 
248 void HAL_InitializeDriverStation(void);
249 
256 
265 
274 
283 
291 void HAL_ObserveUserProgramTest(void);
292 
293 #ifdef __cplusplus
294 } // extern "C"
295 #endif
296 
HAL_SendError
int32_t HAL_SendError(HAL_Bool isError, int32_t errorCode, HAL_Bool isLVCode, const char *details, const char *location, const char *callStack, HAL_Bool printMsg)
Sends an error to the driver station.
HAL_JoystickAxes
Definition: DriverStationTypes.h:72
HAL_JoystickPOVs
Definition: DriverStationTypes.h:78
HAL_GetJoystickButtons
int32_t HAL_GetJoystickButtons(int32_t joystickNum, HAL_JoystickButtons *buttons)
Gets the buttons of a specific joystick.
HAL_ControlWord
Definition: DriverStationTypes.h:35
HAL_FreeJoystickName
void HAL_FreeJoystickName(char *name)
Frees a joystick name received with HAL_GetJoystickName.
HAL_ObserveUserProgramDisabled
void HAL_ObserveUserProgramDisabled(void)
Sets the disabled flag in the DS.
HAL_MatchInfo
Definition: DriverStationTypes.h:101
HAL_JoystickButtons
Definition: DriverStationTypes.h:84
HAL_GetJoystickAxes
int32_t HAL_GetJoystickAxes(int32_t joystickNum, HAL_JoystickAxes *axes)
Gets the axes of a specific joystick.
HAL_WaitForDSData
void HAL_WaitForDSData(void)
Waits for the newest DS packet to arrive.
HAL_WaitForCachedControlDataTimeout
HAL_Bool HAL_WaitForCachedControlDataTimeout(double timeout)
Checks if new control data has arrived since the last HAL_WaitForCachedControlData or HAL_IsNewContro...
HAL_GetJoystickPOVs
int32_t HAL_GetJoystickPOVs(int32_t joystickNum, HAL_JoystickPOVs *povs)
Gets the POVs of a specific joystick.
HAL_GetControlWord
int32_t HAL_GetControlWord(HAL_ControlWord *controlWord)
Gets the current control word of the driver station.
HAL_ObserveUserProgramTest
void HAL_ObserveUserProgramTest(void)
Sets the test mode flag in the DS.
HAL_JoystickDescriptor
Definition: DriverStationTypes.h:90
HAL_WaitForCachedControlData
void HAL_WaitForCachedControlData(void)
Checks if new control data has arrived since the last HAL_WaitForCachedControlData or HAL_IsNewContro...
HAL_GetMatchTime
double HAL_GetMatchTime(int32_t *status)
Returns the approximate match time.
HAL_GetMatchInfo
int32_t HAL_GetMatchInfo(HAL_MatchInfo *info)
Gets info about a specific match.
HAL_ObserveUserProgramStarting
void HAL_ObserveUserProgramStarting(void)
Sets the program starting flag in the DS.
HAL_GetJoystickName
char * HAL_GetJoystickName(int32_t joystickNum)
Gets the name of a joystick.
HAL_GetJoystickIsXbox
HAL_Bool HAL_GetJoystickIsXbox(int32_t joystickNum)
Gets is a specific joystick is considered to be an XBox controller.
HAL_GetJoystickAxisType
int32_t HAL_GetJoystickAxisType(int32_t joystickNum, int32_t axis)
Gets the type of a specific joystick axis.
HAL_ObserveUserProgramTeleop
void HAL_ObserveUserProgramTeleop(void)
Sets the teleoperated enabled flag in the DS.
HAL_GetAllianceStation
HAL_AllianceStationID HAL_GetAllianceStation(int32_t *status)
Gets the current alliance station ID.
HAL_ReleaseDSMutex
void HAL_ReleaseDSMutex(void)
Releases the DS Mutex to allow proper shutdown of any threads that are waiting on it.
HAL_SendConsoleLine
int32_t HAL_SendConsoleLine(const char *line)
Sends a line to the driver station console.
HAL_InitializeDriverStation
void HAL_InitializeDriverStation(void)
Initializes the driver station communication.
HAL_GetJoystickDescriptor
int32_t HAL_GetJoystickDescriptor(int32_t joystickNum, HAL_JoystickDescriptor *desc)
Retrieves the Joystick Descriptor for particular slot.
HAL_ObserveUserProgramAutonomous
void HAL_ObserveUserProgramAutonomous(void)
Sets the autonomous enabled flag in the DS.
HAL_WaitForDSDataTimeout
HAL_Bool HAL_WaitForDSDataTimeout(double timeout)
Waits for the newest DS packet to arrive.
HAL_GetJoystickType
int32_t HAL_GetJoystickType(int32_t joystickNum)
Gets the type of joystick connected.
HAL_SetJoystickOutputs
int32_t HAL_SetJoystickOutputs(int32_t joystickNum, int64_t outputs, int32_t leftRumble, int32_t rightRumble)
Set joystick outputs.
HAL_IsNewControlData
HAL_Bool HAL_IsNewControlData(void)
Has a new control packet from the driver station arrived since the last time this function was called...