[hal,wpilib] Add support for joystick outputs (#8385)

Support joystick outputs, including Rumble and LEDs.

Also requires an update to Joystick descriptors, as that has also
changed in mrccomm to support showing what outputs are supported.
This commit is contained in:
Thad House
2025-11-17 14:36:14 -08:00
committed by GitHub
parent 5db6d2f500
commit ce6fd225a6
54 changed files with 1607 additions and 854 deletions

View File

@@ -251,13 +251,14 @@ class DriverStationSim {
* @param stick The joystick number
* @return The joystick outputs
*/
static int64_t GetJoystickOutputs(int stick);
static int32_t GetJoystickLeds(int stick);
/**
* Gets the joystick rumble.
*
* @param stick The joystick number
* @param rumbleNum Rumble to get (0=left, 1=right)
* @param rumbleNum Rumble to get (0=left, 1=right, 2=left trigger, 3=right
* trigger)
* @return The joystick rumble value
*/
static int GetJoystickRumble(int stick, int rumbleNum);
@@ -346,7 +347,7 @@ class DriverStationSim {
* @param stick The joystick number
* @param type The value of type
*/
static void SetJoystickType(int stick, int type);
static void SetJoystickGamepadType(int stick, int type);
/**
* Sets the name of a joystick.
@@ -356,6 +357,14 @@ class DriverStationSim {
*/
static void SetJoystickName(int stick, std::string_view name);
/**
* Sets the supported outputs for a joystick.
*
* @param stick The joystick number
* @param supportedOutputs The supported outputs for the joystick
*/
static void SetJoystickSupportedOutputs(int stick, int supportedOutputs);
/**
* Sets the game specific message.
*

View File

@@ -102,7 +102,9 @@ class GenericHIDSim {
*
* @param type the new device type
*/
void SetType(GenericHID::HIDType type);
void SetGamepadType(GenericHID::HIDType type);
void SetSupportedOutputs(GenericHID::SupportedOutputs supportedOutputs);
/**
* Set the name of this device.
@@ -112,19 +114,11 @@ class GenericHIDSim {
void SetName(const char* name);
/**
* Read the output of a button.
* Get the value of set LEDs.
*
* @param outputNumber the button number
* @return the value of the button (true = pressed)
* @return the led color
*/
bool GetOutput(int outputNumber);
/**
* Get the encoded 16-bit integer that passes button values.
*
* @return the button values
*/
int64_t GetOutputs();
int32_t GetLeds();
/**
* Get the joystick rumble.