mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
[wpilib] Add PS4Controller, remove Hand from GenericHID/XboxController (#3345)
- GenericHID is now concrete, and has only getRawAxis/Button(int) functionality - getXxx() has been moved into Joystick as that's the only place where it makes sense - Hand (and therefore getXxx(Hand)) has been removed, replaced by specific getLeft/RightXxx() methods in XboxController and the new PS4Controller class - C++ ::Button:: and ::Axis:: enums have been converted to identically-namespaced static constexpr ints
This commit is contained in:
@@ -13,7 +13,12 @@ namespace frc {
|
||||
class DriverStation;
|
||||
|
||||
/**
|
||||
* GenericHID Interface.
|
||||
* Handle input from standard HID devices connected to the Driver Station.
|
||||
*
|
||||
* <p>This class handles standard input that comes from the Driver Station. Each
|
||||
* time a value is requested the most recent value is returned. There is a
|
||||
* single class instance for each device and the mapping of ports to hardware
|
||||
* buttons depends on the code in the Driver Station.
|
||||
*/
|
||||
class GenericHID {
|
||||
public:
|
||||
@@ -39,17 +44,12 @@ class GenericHID {
|
||||
kHID1stPerson = 24
|
||||
};
|
||||
|
||||
enum JoystickHand { kLeftHand = 0, kRightHand = 1 };
|
||||
|
||||
explicit GenericHID(int port);
|
||||
virtual ~GenericHID() = default;
|
||||
|
||||
GenericHID(GenericHID&&) = default;
|
||||
GenericHID& operator=(GenericHID&&) = default;
|
||||
|
||||
virtual double GetX(JoystickHand hand = kRightHand) const = 0;
|
||||
virtual double GetY(JoystickHand hand = kRightHand) const = 0;
|
||||
|
||||
/**
|
||||
* Get the button value (starting at button 1).
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user