blob: 4edc64e42b8df0d621619a01187e746c79c14a53 [file] [log] [blame]
Brian Silvermanf7f267a2017-02-04 16:16:08 -08001/*----------------------------------------------------------------------------*/
2/* Copyright (c) FIRST 2011-2017. 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#include "Buttons/Button.h"
9
10using namespace frc;
11
12/**
13 * Specifies the command to run when a button is first pressed.
14 *
15 * @param command The pointer to the command to run
16 */
17void Button::WhenPressed(Command* command) { WhenActive(command); }
18
19/**
20 * Specifies the command to be scheduled while the button is pressed.
21 *
22 * The command will be scheduled repeatedly while the button is pressed and will
23 * be canceled when the button is released.
24 *
25 * @param command The pointer to the command to run
26 */
27void Button::WhileHeld(Command* command) { WhileActive(command); }
28
29/**
30 * Specifies the command to run when the button is released.
31 *
32 * The command will be scheduled a single time.
33 *
34 * @param command The pointer to the command to run
35 */
36void Button::WhenReleased(Command* command) { WhenInactive(command); }
37
38/**
39 * Cancels the specificed command when the button is pressed.
40 *
41 * @param command The command to be canceled
42 */
43void Button::CancelWhenPressed(Command* command) { CancelWhenActive(command); }
44
45/**
46 * Toggle the specified command when the button is pressed.
47 *
48 * @param command The command to be toggled
49 */
50void Button::ToggleWhenPressed(Command* command) { ToggleWhenActive(command); }