mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-03 03:01:44 +00:00
[hal,wpilib] Add Touchpad support (#8401)
This commit is contained in:
@@ -72,6 +72,12 @@ class DriverStation final {
|
||||
kUpLeft = HAL_JoystickPOV_kLeftUp,
|
||||
};
|
||||
|
||||
struct TouchpadFinger final {
|
||||
bool down = false;
|
||||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the angle of a POVDirection.
|
||||
*
|
||||
@@ -159,6 +165,28 @@ class DriverStation final {
|
||||
*/
|
||||
static double GetStickAxis(int stick, int axis);
|
||||
|
||||
/**
|
||||
* Get the finger data of a touchpad on a joystick, if available.
|
||||
*
|
||||
* @param stick The joystick to read.
|
||||
* @param touchpad The touchpad index to read from the joystick.
|
||||
* @param finger The finger index to read from the touchpad.
|
||||
* @return The finger data of the touchpad on the joystick.
|
||||
*/
|
||||
static TouchpadFinger GetStickTouchpadFinger(int stick, int touchpad,
|
||||
int finger);
|
||||
|
||||
/**
|
||||
* Whether a finger on a touchpad is available.
|
||||
*
|
||||
* @param stick The joystick to read.
|
||||
* @param touchpad The touchpad index to read from the joystick.
|
||||
* @param finger The finger index to read from the touchpad.
|
||||
* @return True if the finger data is available.
|
||||
*/
|
||||
static bool GetStickTouchpadFingerAvailable(int stick, int touchpad,
|
||||
int finger);
|
||||
|
||||
/**
|
||||
* Get the value of the axis on a joystick, if available.
|
||||
*
|
||||
|
||||
@@ -370,6 +370,23 @@ class GenericHID {
|
||||
*/
|
||||
void SetRumble(RumbleType type, double value);
|
||||
|
||||
/**
|
||||
* Check if a touchpad finger is available.
|
||||
* @param touchpad The touchpad to check.
|
||||
* @param finger The finger to check.
|
||||
* @return true if the touchpad finger is available.
|
||||
*/
|
||||
bool GetTouchpadFingerAvailable(int touchpad, int finger) const;
|
||||
|
||||
/**
|
||||
* Get the touchpad finger data.
|
||||
* @param touchpad The touchpad to read.
|
||||
* @param finger The finger to read.
|
||||
* @return The touchpad finger data.
|
||||
*/
|
||||
DriverStation::TouchpadFinger GetTouchpadFinger(int touchpad,
|
||||
int finger) const;
|
||||
|
||||
private:
|
||||
int m_port;
|
||||
uint16_t m_leftRumble = 0;
|
||||
|
||||
Reference in New Issue
Block a user