mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Add new joystick features
Axis counts other than six and POVs are both present in C++ and Java now Add dynamic joystick axis counts, up to 12 Change-Id: Ieade5e61a89df822df8702cb32326e4635558778 Add support for POVs in C++ Change-Id: I12dc0fcaca605a256ddcf990eebde45767229171 Make POVs work in Java Change-Id: Ie2d98adb416c1930f058bdd21c3e7d26289df503
This commit is contained in:
@@ -161,9 +161,20 @@ enum HALAllianceStationID {
|
||||
kHALAllianceStationID_blue3,
|
||||
};
|
||||
|
||||
/* The maximum number of axes that will be stored in a single HALJoystickAxes
|
||||
struct. This is used for allocating buffers, not bounds checking, since
|
||||
there are usually less axes in practice. */
|
||||
static constexpr size_t kMaxJoystickAxes = 12;
|
||||
static constexpr size_t kMaxJoystickPOVs = 12;
|
||||
|
||||
struct HALJoystickAxes {
|
||||
uint16_t count;
|
||||
int16_t axes[6];
|
||||
int16_t axes[kMaxJoystickAxes];
|
||||
};
|
||||
|
||||
struct HALJoystickPOVs {
|
||||
uint16_t count;
|
||||
int16_t povs[kMaxJoystickPOVs];
|
||||
};
|
||||
|
||||
typedef uint32_t HALJoystickButtons;
|
||||
@@ -199,7 +210,8 @@ extern "C"
|
||||
|
||||
int HALGetControlWord(HALControlWord *data);
|
||||
int HALGetAllianceStation(enum HALAllianceStationID *allianceStation);
|
||||
int HALGetJoystickAxes(uint8_t joystickNum, HALJoystickAxes *axes, uint8_t maxAxes);
|
||||
int HALGetJoystickAxes(uint8_t joystickNum, HALJoystickAxes *axes);
|
||||
int HALGetJoystickPOVs(uint8_t joystickNum, HALJoystickPOVs *povs);
|
||||
int HALGetJoystickButtons(uint8_t joystickNum, HALJoystickButtons *buttons, uint8_t *count);
|
||||
|
||||
void HALSetNewDataSem(pthread_mutex_t *);
|
||||
|
||||
Reference in New Issue
Block a user