mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user