Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame^] | 1 | /*----------------------------------------------------------------------------*/ |
| 2 | /* Copyright (c) FIRST 2011. All Rights Reserved. |
| 3 | */ |
| 4 | /* Open Source Software - may be modified and shared by FRC teams. The code */ |
| 5 | /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */ |
| 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); } |