[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

@@ -471,7 +471,7 @@ bool DriverStation::GetJoystickIsGamepad(int stick) {
return static_cast<bool>(descriptor.isGamepad);
}
int DriverStation::GetJoystickType(int stick) {
int DriverStation::GetJoystickGamepadType(int stick) {
if (stick < 0 || stick >= kJoystickPorts) {
WPILIB_ReportError(warn::BadJoystickIndex, "stick {} out of range", stick);
return -1;
@@ -480,7 +480,19 @@ int DriverStation::GetJoystickType(int stick) {
HAL_JoystickDescriptor descriptor;
HAL_GetJoystickDescriptor(stick, &descriptor);
return static_cast<int>(descriptor.type);
return static_cast<int>(descriptor.gamepadType);
}
int DriverStation::GetJoystickSupportedOutputs(int stick) {
if (stick < 0 || stick >= kJoystickPorts) {
WPILIB_ReportError(warn::BadJoystickIndex, "stick {} out of range", stick);
return 0;
}
HAL_JoystickDescriptor descriptor;
HAL_GetJoystickDescriptor(stick, &descriptor);
return static_cast<int>(descriptor.supportedOutputs);
}
std::string DriverStation::GetJoystickName(int stick) {