mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilib] Deprecate getInstance() in favor of static functions (#3440)
Co-authored-by: Noam Zaks <imnoamzaks@gmail.com>
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
|
||||
using namespace frc;
|
||||
|
||||
GenericHID::GenericHID(int port) : m_ds(&DriverStation::GetInstance()) {
|
||||
GenericHID::GenericHID(int port) {
|
||||
if (port < 0 || port >= DriverStation::kJoystickPorts) {
|
||||
throw FRC_MakeError(warn::BadJoystickIndex, "port {} out of range", port);
|
||||
}
|
||||
@@ -19,51 +19,51 @@ GenericHID::GenericHID(int port) : m_ds(&DriverStation::GetInstance()) {
|
||||
}
|
||||
|
||||
bool GenericHID::GetRawButton(int button) const {
|
||||
return m_ds->GetStickButton(m_port, button);
|
||||
return DriverStation::GetStickButton(m_port, button);
|
||||
}
|
||||
|
||||
bool GenericHID::GetRawButtonPressed(int button) {
|
||||
return m_ds->GetStickButtonPressed(m_port, button);
|
||||
return DriverStation::GetStickButtonPressed(m_port, button);
|
||||
}
|
||||
|
||||
bool GenericHID::GetRawButtonReleased(int button) {
|
||||
return m_ds->GetStickButtonReleased(m_port, button);
|
||||
return DriverStation::GetStickButtonReleased(m_port, button);
|
||||
}
|
||||
|
||||
double GenericHID::GetRawAxis(int axis) const {
|
||||
return m_ds->GetStickAxis(m_port, axis);
|
||||
return DriverStation::GetStickAxis(m_port, axis);
|
||||
}
|
||||
|
||||
int GenericHID::GetPOV(int pov) const {
|
||||
return m_ds->GetStickPOV(m_port, pov);
|
||||
return DriverStation::GetStickPOV(m_port, pov);
|
||||
}
|
||||
|
||||
int GenericHID::GetAxisCount() const {
|
||||
return m_ds->GetStickAxisCount(m_port);
|
||||
return DriverStation::GetStickAxisCount(m_port);
|
||||
}
|
||||
|
||||
int GenericHID::GetPOVCount() const {
|
||||
return m_ds->GetStickPOVCount(m_port);
|
||||
return DriverStation::GetStickPOVCount(m_port);
|
||||
}
|
||||
|
||||
int GenericHID::GetButtonCount() const {
|
||||
return m_ds->GetStickButtonCount(m_port);
|
||||
return DriverStation::GetStickButtonCount(m_port);
|
||||
}
|
||||
|
||||
bool GenericHID::IsConnected() const {
|
||||
return m_ds->IsJoystickConnected(m_port);
|
||||
return DriverStation::IsJoystickConnected(m_port);
|
||||
}
|
||||
|
||||
GenericHID::HIDType GenericHID::GetType() const {
|
||||
return static_cast<HIDType>(m_ds->GetJoystickType(m_port));
|
||||
return static_cast<HIDType>(DriverStation::GetJoystickType(m_port));
|
||||
}
|
||||
|
||||
std::string GenericHID::GetName() const {
|
||||
return m_ds->GetJoystickName(m_port);
|
||||
return DriverStation::GetJoystickName(m_port);
|
||||
}
|
||||
|
||||
int GenericHID::GetAxisType(int axis) const {
|
||||
return m_ds->GetJoystickAxisType(m_port, axis);
|
||||
return DriverStation::GetJoystickAxisType(m_port, axis);
|
||||
}
|
||||
|
||||
int GenericHID::GetPort() const {
|
||||
|
||||
Reference in New Issue
Block a user