[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

@@ -320,12 +320,13 @@ void DriverStationData::GetJoystickCounts(int32_t stick, int32_t* axisCount,
*povCount = m_joystickData[stick].povs.count;
}
void DriverStationData::SetJoystickIsXbox(int32_t stick, HAL_Bool isXbox) {
void DriverStationData::SetJoystickIsGamepad(int32_t stick,
HAL_Bool isGamepad) {
if (stick < 0 || stick >= kNumJoysticks) {
return;
}
std::scoped_lock lock(m_joystickDataMutex);
m_joystickData[stick].descriptor.isXbox = isXbox;
m_joystickData[stick].descriptor.isGamepad = isGamepad;
m_joystickDescriptorCallbacks(stick, &m_joystickData[stick].descriptor);
}
@@ -532,8 +533,8 @@ void HALSIM_GetJoystickCounts(int32_t stick, int32_t* axisCount,
povCount);
}
void HALSIM_SetJoystickIsXbox(int32_t stick, HAL_Bool isXbox) {
SimDriverStationData->SetJoystickIsXbox(stick, isXbox);
void HALSIM_SetJoystickIsGamepad(int32_t stick, HAL_Bool isGamepad) {
SimDriverStationData->SetJoystickIsGamepad(stick, isGamepad);
}
void HALSIM_SetJoystickType(int32_t stick, int32_t type) {

View File

@@ -105,7 +105,7 @@ class DriverStationData {
void GetJoystickCounts(int32_t stick, int32_t* axisCount,
int32_t* buttonCount, int32_t* povCount);
void SetJoystickIsXbox(int32_t stick, HAL_Bool isXbox);
void SetJoystickIsGamepad(int32_t stick, HAL_Bool isGamepad);
void SetJoystickType(int32_t stick, int32_t type);
void SetJoystickName(int32_t stick, std::string_view message);
void SetJoystickAxisType(int32_t stick, int32_t axis, int32_t type);