Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame] | 1 | /*----------------------------------------------------------------------------*/ |
Brian Silverman | 1a67511 | 2016-02-20 20:42:49 -0500 | [diff] [blame^] | 2 | /* Copyright (c) FIRST 2011-2016. All Rights Reserved. */ |
Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame] | 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ |
Brian Silverman | 1a67511 | 2016-02-20 20:42:49 -0500 | [diff] [blame^] | 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ |
| 5 | /* the project. */ |
Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame] | 6 | /*----------------------------------------------------------------------------*/ |
| 7 | |
| 8 | #include "Buttons/Button.h" |
| 9 | |
| 10 | /** |
| 11 | * Specifies the command to run when a button is first pressed |
| 12 | * @param command The pointer to the command to run |
| 13 | */ |
| 14 | void Button::WhenPressed(Command *command) { WhenActive(command); } |
| 15 | |
| 16 | /** |
| 17 | * Specifies the command to be scheduled while the button is pressed |
| 18 | * The command will be scheduled repeatedly while the button is pressed and will |
| 19 | * be canceled when the button is released. |
| 20 | * @param command The pointer to the command to run |
| 21 | */ |
| 22 | void Button::WhileHeld(Command *command) { WhileActive(command); } |
| 23 | |
| 24 | /** |
| 25 | * Specifies the command to run when the button is released |
| 26 | * The command will be scheduled a single time. |
| 27 | * @param The pointer to the command to run |
| 28 | */ |
| 29 | void Button::WhenReleased(Command *command) { WhenInactive(command); } |
| 30 | |
| 31 | /** |
| 32 | * Cancels the specificed command when the button is pressed |
| 33 | * @param The command to be canceled |
| 34 | */ |
| 35 | void Button::CancelWhenPressed(Command *command) { CancelWhenActive(command); } |
| 36 | |
| 37 | /** |
| 38 | * Toggle the specified command when the button is pressed |
| 39 | * @param The command to be toggled |
| 40 | */ |
| 41 | void Button::ToggleWhenPressed(Command *command) { ToggleWhenActive(command); } |