[hal,wpilib] Use new DS available API from mrccomm (#8302)

Instead of just having a max count for joystick values, there's an available mask of values. This is because in the future we're expecting there to be holes in the list of available buttons and axes. This updates everything to support that scenario.

Also, Joystick buttons, axes, and POVs all now start at 0 instead of 1.
This commit is contained in:
Thad House
2025-10-25 23:03:50 -07:00
committed by GitHub
parent 429698f508
commit 2e10f91e07
62 changed files with 6101 additions and 1066 deletions

View File

@@ -106,7 +106,7 @@ class GenericHID {
* since the last time this method was called. This is useful if you only
* want to call a function once when you press the button.
*
* @param button The button index, beginning at 1.
* @param button The button index, beginning at 0.
* @return Whether the button was pressed since the last check.
*/
bool GetRawButtonPressed(int button);
@@ -119,7 +119,7 @@ class GenericHID {
* since the last time this method was called. This is useful if you only
* want to call a function once when you release the button.
*
* @param button The button index, beginning at 1.
* @param button The button index, beginning at 0.
* @return Whether the button was released since the last check.
*/
bool GetRawButtonReleased(int button);
@@ -280,26 +280,32 @@ class GenericHID {
BooleanEvent AxisGreaterThan(int axis, double threshold,
EventLoop* loop) const;
int GetAxesMaximumIndex() const;
/**
* Get the number of axes for the HID.
*
* @return the number of axis for the current HID
*/
int GetAxisCount() const;
int GetAxesAvailable() const;
int GetPOVsMaximumIndex() const;
/**
* Get the number of POVs for the HID.
*
* @return the number of POVs for the current HID
*/
int GetPOVCount() const;
int GetPOVsAvailable() const;
int GetButtonsMaximumIndex() const;
/**
* Get the number of buttons for the HID.
*
* @return the number of buttons on the current HID
*/
int GetButtonCount() const;
uint64_t GetButtonsAvailable() const;
/**
* Get if the HID is connected.
@@ -322,13 +328,6 @@ class GenericHID {
*/
std::string GetName() const;
/**
* Get the axis type of a joystick axis.
*
* @return the axis type of a joystick axis.
*/
int GetAxisType(int axis) const;
/**
* Get the port number of the HID.
*