WPILibC++  2020.3.2
POVButton.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 #include <frc/GenericHID.h>
10 
11 #include "Button.h"
12 
13 namespace frc2 {
20 class POVButton : public Button {
21  public:
29  POVButton(frc::GenericHID* joystick, int angle, int povNumber = 0)
30  : Button([joystick, angle, povNumber] {
31  return joystick->GetPOV(povNumber) == angle;
32  }) {}
33 };
34 } // namespace frc2
frc2::Button
A class used to bind command scheduling to button presses.
Definition: Button.h:26
frc2::POVButton
A class used to bind command scheduling to joystick POV presses.
Definition: POVButton.h:20
frc::GenericHID::GetPOV
int GetPOV(int pov=0) const
Get the angle in degrees of a POV on the HID.
frc2::POVButton::POVButton
POVButton(frc::GenericHID *joystick, int angle, int povNumber=0)
Creates a POVButton that commands can be bound to.
Definition: POVButton.h:29
frc::GenericHID
GenericHID Interface.
Definition: GenericHID.h:23