mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[wpilib] Add BooleanEvent/Trigger factories on HID classes (#4247)
This commit is contained in:
@@ -98,6 +98,15 @@ class PS4Controller : public GenericHID {
|
||||
*/
|
||||
bool GetSquareButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the square button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the square button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
BooleanEvent Square(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the Cross button on the controller.
|
||||
*
|
||||
@@ -119,6 +128,15 @@ class PS4Controller : public GenericHID {
|
||||
*/
|
||||
bool GetCrossButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the cross button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the cross button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
BooleanEvent Cross(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the Circle button on the controller.
|
||||
*
|
||||
@@ -140,6 +158,15 @@ class PS4Controller : public GenericHID {
|
||||
*/
|
||||
bool GetCircleButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the circle button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the circle button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
BooleanEvent Circle(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the Triangle button on the controller.
|
||||
*
|
||||
@@ -161,6 +188,15 @@ class PS4Controller : public GenericHID {
|
||||
*/
|
||||
bool GetTriangleButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the triangle button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the triangle button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
BooleanEvent Triangle(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the L1 button on the controller.
|
||||
*
|
||||
@@ -182,6 +218,15 @@ class PS4Controller : public GenericHID {
|
||||
*/
|
||||
bool GetL1ButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the L1 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the L1 button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
BooleanEvent L1(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the R1 button on the controller.
|
||||
*
|
||||
@@ -203,6 +248,15 @@ class PS4Controller : public GenericHID {
|
||||
*/
|
||||
bool GetR1ButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the R1 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the R1 button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
BooleanEvent R1(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the L2 button on the controller.
|
||||
*
|
||||
@@ -224,6 +278,15 @@ class PS4Controller : public GenericHID {
|
||||
*/
|
||||
bool GetL2ButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the L2 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the L2 button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
BooleanEvent L2(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the R2 button on the controller.
|
||||
*
|
||||
@@ -245,6 +308,15 @@ class PS4Controller : public GenericHID {
|
||||
*/
|
||||
bool GetR2ButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the R2 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the R2 button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
BooleanEvent R2(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the Share button on the controller.
|
||||
*
|
||||
@@ -266,6 +338,15 @@ class PS4Controller : public GenericHID {
|
||||
*/
|
||||
bool GetShareButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the share button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the share button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
BooleanEvent Share(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the Options button on the controller.
|
||||
*
|
||||
@@ -287,6 +368,15 @@ class PS4Controller : public GenericHID {
|
||||
*/
|
||||
bool GetOptionsButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the options button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the options button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
BooleanEvent Options(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the L3 button (pressing the left analog stick) on the
|
||||
* controller.
|
||||
@@ -309,6 +399,15 @@ class PS4Controller : public GenericHID {
|
||||
*/
|
||||
bool GetL3ButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the L3 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the L3 button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
BooleanEvent L3(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the R3 button (pressing the right analog stick) on the
|
||||
* controller.
|
||||
@@ -331,6 +430,15 @@ class PS4Controller : public GenericHID {
|
||||
*/
|
||||
bool GetR3ButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the R3 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the R3 button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
BooleanEvent R3(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the PS button on the controller.
|
||||
*
|
||||
@@ -352,6 +460,15 @@ class PS4Controller : public GenericHID {
|
||||
*/
|
||||
bool GetPSButtonReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the PS button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the PS button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
BooleanEvent PS(EventLoop* loop) const;
|
||||
|
||||
/**
|
||||
* Read the value of the touchpad button on the controller.
|
||||
*
|
||||
@@ -373,6 +490,15 @@ class PS4Controller : public GenericHID {
|
||||
*/
|
||||
bool GetTouchpadReleased();
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the touchpad's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the touchpad's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
BooleanEvent Touchpad(EventLoop* loop) const;
|
||||
|
||||
struct Button {
|
||||
static constexpr int kSquare = 1;
|
||||
static constexpr int kCross = 2;
|
||||
|
||||
Reference in New Issue
Block a user