LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
buttonBase.hpp
Go to the documentation of this file.
1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 */
6#pragma once
7
9
10namespace okapi {
11class ButtonBase : public AbstractButton {
12 public:
17 explicit ButtonBase(bool iinverted = false);
18
22 bool isPressed() override;
23
27 bool changed() override;
28
33 bool changedToPressed() override;
34
39 bool changedToReleased() override;
40
41 protected:
42 bool inverted{false};
43 bool wasPressedLast_c{false};
44 bool wasPressedLast_ctp{false};
45 bool wasPressedLast_ctr{false};
46
47 virtual bool currentlyPressed() = 0;
48
49 private:
50 bool changedImpl(bool &prevState);
51};
52} // namespace okapi
bool changed() override
Return whether the state of the button changed since the last time this method was called.
ButtonBase(bool iinverted=false)
virtual bool currentlyPressed()=0
bool changedToReleased() override
Return whether the state of the button to not pressed since the last time this method was called.
bool isPressed() override
Return whether the button is currently pressed.
bool changedToPressed() override
Return whether the state of the button changed to pressed since the last time this method was called.