mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
Added functions for detecting button press and release events (#626)
I also shuffled around the HID interfaces to be more intuitive, deprecated some Joystick and XboxController member functions, and deprecated the JoystickBase and GamepadBase classes. Supersedes #89.
This commit is contained in:
committed by
Peter Johnson
parent
c33fca34e9
commit
21585f70a8
@@ -11,6 +11,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ErrorBase.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class DriverStation;
|
||||
@@ -18,11 +20,11 @@ class DriverStation;
|
||||
/**
|
||||
* GenericHID Interface.
|
||||
*/
|
||||
class GenericHID {
|
||||
class GenericHID : public ErrorBase {
|
||||
public:
|
||||
typedef enum { kLeftRumble, kRightRumble } RumbleType;
|
||||
enum RumbleType { kLeftRumble, kRightRumble };
|
||||
|
||||
typedef enum {
|
||||
enum HIDType {
|
||||
kUnknown = -1,
|
||||
kXInputUnknown = 0,
|
||||
kXInputGamepad = 1,
|
||||
@@ -40,7 +42,7 @@ class GenericHID {
|
||||
kHIDDriving = 22,
|
||||
kHIDFlight = 23,
|
||||
kHID1stPerson = 24
|
||||
} HIDType;
|
||||
};
|
||||
|
||||
enum JoystickHand { kLeftHand = 0, kRightHand = 1 };
|
||||
|
||||
@@ -49,16 +51,23 @@ class GenericHID {
|
||||
|
||||
virtual double GetX(JoystickHand hand = kRightHand) const = 0;
|
||||
virtual double GetY(JoystickHand hand = kRightHand) const = 0;
|
||||
virtual double GetRawAxis(int axis) const;
|
||||
|
||||
bool GetRawButton(int button) const;
|
||||
bool GetRawButtonPressed(int button);
|
||||
bool GetRawButtonReleased(int button);
|
||||
|
||||
double GetRawAxis(int axis) const;
|
||||
int GetPOV(int pov = 0) const;
|
||||
int GetPOVCount() const;
|
||||
|
||||
int GetPort() const;
|
||||
int GetAxisCount() const;
|
||||
int GetPOVCount() const;
|
||||
int GetButtonCount() const;
|
||||
|
||||
GenericHID::HIDType GetType() const;
|
||||
std::string GetName() const;
|
||||
int GetAxisType(int axis) const;
|
||||
|
||||
int GetPort() const;
|
||||
|
||||
void SetOutput(int outputNumber, bool value);
|
||||
void SetOutputs(int value);
|
||||
|
||||
Reference in New Issue
Block a user