Brian Silverman | f7f267a | 2017-02-04 16:16:08 -0800 | [diff] [blame^] | 1 | /*----------------------------------------------------------------------------*/ |
| 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 | |
| 10 | using 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 | */ |
| 17 | void 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 | */ |
| 27 | void 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 | */ |
| 36 | void 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 | */ |
| 43 | void 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 | */ |
| 50 | void Button::ToggleWhenPressed(Command* command) { ToggleWhenActive(command); } |