WPILibC++ 2023.4.3
POVButton.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6#include <frc/GenericHID.h>
7#include <wpi/deprecated.h>
8
9#include "Button.h"
10
11namespace frc2 {
12/**
13 * A class used to bind command scheduling to joystick POV presses. Can be
14 * composed with other buttons with the operators in Trigger.
15 *
16 * This class is provided by the NewCommands VendorDep
17 *
18 * @see Trigger
19 */
20class POVButton : public Button {
21 public:
22 /**
23 * Creates a POVButton that commands can be bound to.
24 *
25 * @param joystick The joystick on which the button is located.
26 * @param angle The angle of the POV corresponding to a button press.
27 * @param povNumber The number of the POV on the joystick.
28 */
29 WPI_IGNORE_DEPRECATED
30 POVButton(frc::GenericHID* joystick, int angle, int povNumber = 0)
31 : Button([joystick, angle, povNumber] {
32 return joystick->GetPOV(povNumber) == angle;
33 }) {}
34 WPI_UNIGNORE_DEPRECATED
35};
36} // namespace frc2
A class used to bind command scheduling to button presses.
Definition: Button.h:27
A class used to bind command scheduling to joystick POV presses.
Definition: POVButton.h:20
WPI_IGNORE_DEPRECATED POVButton(frc::GenericHID *joystick, int angle, int povNumber=0)
Creates a POVButton that commands can be bound to.
Definition: POVButton.h:30
Handle input from standard HID devices connected to the Driver Station.
Definition: GenericHID.h:24
int GetPOV(int pov=0) const
Get the angle in degrees of a POV on the HID.
Definition: InstantCommand.h:14