mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
Added functions to get names, HID types and isXbox descriptors from joysticks.
Change-Id: I3cd6ebc04d64398f05001cd008696e13ee1ab6ea
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
//#include "NetworkCommunication/UsageReporting.h"
|
||||
#include "WPIErrors.h"
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
const uint32_t Joystick::kDefaultXAxis;
|
||||
const uint32_t Joystick::kDefaultYAxis;
|
||||
@@ -275,6 +276,42 @@ int Joystick::GetAxisCount()
|
||||
return m_ds->GetStickAxisCount(m_port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of isXbox for the joystick.
|
||||
*
|
||||
* @return A boolean that is true if the joystick is an xbox controller.
|
||||
*/
|
||||
bool Joystick::GetIsXbox()
|
||||
{
|
||||
return m_ds->GetJoystickIsXbox(m_port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HID type of the controller.
|
||||
*
|
||||
* @return the HID type of the controller.
|
||||
*/
|
||||
Joystick::HIDType Joystick::GetType()
|
||||
{
|
||||
return static_cast<HIDType>(m_ds->GetJoystickType(m_port));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the joystick.
|
||||
*
|
||||
* @return the name of the controller.
|
||||
*/
|
||||
std::string Joystick::GetName()
|
||||
{
|
||||
return m_ds->GetJoystickName(m_port);
|
||||
}
|
||||
|
||||
//int Joystick::GetAxisType(uint8_t axis)
|
||||
//{
|
||||
// return m_ds->GetJoystickAxisType(m_port, axis);
|
||||
//}
|
||||
|
||||
|
||||
/**
|
||||
* Get the number of axis for a joystick
|
||||
*
|
||||
@@ -389,3 +426,5 @@ void Joystick::SetOutputs(uint32_t value) {
|
||||
m_outputs = value;
|
||||
HALSetJoystickOutputs(m_port, m_outputs, m_leftRumble, m_rightRumble);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user