[hal] Update DS API to new format (#7977)

This commit is contained in:
Thad House
2025-05-16 22:15:14 -07:00
committed by GitHub
parent 1596e2fd7a
commit 231ec348fe
35 changed files with 878 additions and 766 deletions

View File

@@ -387,7 +387,7 @@ int DriverStation::GetStickButtonCount(int stick) {
return buttons.count;
}
bool DriverStation::GetJoystickIsXbox(int stick) {
bool DriverStation::GetJoystickIsGamepad(int stick) {
if (stick < 0 || stick >= kJoystickPorts) {
FRC_ReportError(warn::BadJoystickIndex, "stick {} out of range", stick);
return false;
@@ -396,7 +396,7 @@ bool DriverStation::GetJoystickIsXbox(int stick) {
HAL_JoystickDescriptor descriptor;
HAL_GetJoystickDescriptor(stick, &descriptor);
return static_cast<bool>(descriptor.isXbox);
return static_cast<bool>(descriptor.isGamepad);
}
int DriverStation::GetJoystickType(int stick) {

View File

@@ -225,8 +225,8 @@ void DriverStationSim::SetJoystickButtonCount(int stick, int count) {
HALSIM_SetJoystickButtonCount(stick, count);
}
void DriverStationSim::SetJoystickIsXbox(int stick, bool isXbox) {
HALSIM_SetJoystickIsXbox(stick, isXbox);
void DriverStationSim::SetJoystickIsGamepad(int stick, bool isGamepad) {
HALSIM_SetJoystickIsGamepad(stick, isGamepad);
}
void DriverStationSim::SetJoystickType(int stick, int type) {

View File

@@ -135,7 +135,7 @@ class DriverStation final {
* @param stick The joystick port number
* @return A boolean that is true if the controller is an xbox controller.
*/
static bool GetJoystickIsXbox(int stick);
static bool GetJoystickIsGamepad(int stick);
/**
* Returns the type of joystick at a given port.

View File

@@ -323,12 +323,12 @@ class DriverStationSim {
static void SetJoystickButtonCount(int stick, int count);
/**
* Sets the value of isXbox for a joystick.
* Sets the value of isGamepad for a joystick.
*
* @param stick The joystick number
* @param isXbox The value of isXbox
* @param isGamepad The value of isGamepad
*/
static void SetJoystickIsXbox(int stick, bool isXbox);
static void SetJoystickIsGamepad(int stick, bool isGamepad);
/**
* Sets the value of type for a joystick.