blob: 4f8d666c54cde49dd554ff53e49597ce0955a5be [file] [log] [blame]
Maxwell Henderson80bec322024-01-09 15:48:44 -08001// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#include "frc/StadiaController.h"
6
7#include <hal/FRCUsageReporting.h>
8
9#include "frc/event/BooleanEvent.h"
10
11using namespace frc;
12
13StadiaController::StadiaController(int port) : GenericHID(port) {
14 // re-enable when StadiaController is added to Usage Reporting
15 // HAL_Report(HALUsageReporting::kResourceType_StadiaController, port + 1);
16}
17
18double StadiaController::GetLeftX() const {
19 return GetRawAxis(Axis::kLeftX);
20}
21
22double StadiaController::GetRightX() const {
23 return GetRawAxis(Axis::kRightX);
24}
25
26double StadiaController::GetLeftY() const {
27 return GetRawAxis(Axis::kLeftY);
28}
29
30double StadiaController::GetRightY() const {
31 return GetRawAxis(Axis::kRightY);
32}
33
34bool StadiaController::GetLeftBumper() const {
35 return GetRawButton(Button::kLeftBumper);
36}
37
38bool StadiaController::GetRightBumper() const {
39 return GetRawButton(Button::kRightBumper);
40}
41
42bool StadiaController::GetLeftBumperPressed() {
43 return GetRawButtonPressed(Button::kLeftBumper);
44}
45
46bool StadiaController::GetRightBumperPressed() {
47 return GetRawButtonPressed(Button::kRightBumper);
48}
49
50bool StadiaController::GetLeftBumperReleased() {
51 return GetRawButtonReleased(Button::kLeftBumper);
52}
53
54bool StadiaController::GetRightBumperReleased() {
55 return GetRawButtonReleased(Button::kRightBumper);
56}
57
58BooleanEvent StadiaController::LeftBumper(EventLoop* loop) const {
59 return BooleanEvent(loop, [this]() { return this->GetLeftBumper(); });
60}
61
62BooleanEvent StadiaController::RightBumper(EventLoop* loop) const {
63 return BooleanEvent(loop, [this]() { return this->GetRightBumper(); });
64}
65
66bool StadiaController::GetLeftStickButton() const {
67 return GetRawButton(Button::kLeftStick);
68}
69
70bool StadiaController::GetRightStickButton() const {
71 return GetRawButton(Button::kRightStick);
72}
73
74bool StadiaController::GetLeftStickButtonPressed() {
75 return GetRawButtonPressed(Button::kLeftStick);
76}
77
78bool StadiaController::GetRightStickButtonPressed() {
79 return GetRawButtonPressed(Button::kRightStick);
80}
81
82bool StadiaController::GetLeftStickButtonReleased() {
83 return GetRawButtonReleased(Button::kLeftStick);
84}
85
86bool StadiaController::GetRightStickButtonReleased() {
87 return GetRawButtonReleased(Button::kRightStick);
88}
89
90BooleanEvent StadiaController::LeftStick(EventLoop* loop) const {
91 return BooleanEvent(loop, [this]() { return this->GetLeftStickButton(); });
92}
93
94BooleanEvent StadiaController::RightStick(EventLoop* loop) const {
95 return BooleanEvent(loop, [this]() { return this->GetRightStickButton(); });
96}
97
98bool StadiaController::GetAButton() const {
99 return GetRawButton(Button::kA);
100}
101
102bool StadiaController::GetAButtonPressed() {
103 return GetRawButtonPressed(Button::kA);
104}
105
106bool StadiaController::GetAButtonReleased() {
107 return GetRawButtonReleased(Button::kA);
108}
109
110BooleanEvent StadiaController::A(EventLoop* loop) const {
111 return BooleanEvent(loop, [this]() { return this->GetAButton(); });
112}
113
114bool StadiaController::GetBButton() const {
115 return GetRawButton(Button::kB);
116}
117
118bool StadiaController::GetBButtonPressed() {
119 return GetRawButtonPressed(Button::kB);
120}
121
122bool StadiaController::GetBButtonReleased() {
123 return GetRawButtonReleased(Button::kB);
124}
125
126BooleanEvent StadiaController::B(EventLoop* loop) const {
127 return BooleanEvent(loop, [this]() { return this->GetBButton(); });
128}
129
130bool StadiaController::GetXButton() const {
131 return GetRawButton(Button::kX);
132}
133
134bool StadiaController::GetXButtonPressed() {
135 return GetRawButtonPressed(Button::kX);
136}
137
138bool StadiaController::GetXButtonReleased() {
139 return GetRawButtonReleased(Button::kX);
140}
141
142BooleanEvent StadiaController::X(EventLoop* loop) const {
143 return BooleanEvent(loop, [this]() { return this->GetXButton(); });
144}
145
146bool StadiaController::GetYButton() const {
147 return GetRawButton(Button::kY);
148}
149
150bool StadiaController::GetYButtonPressed() {
151 return GetRawButtonPressed(Button::kY);
152}
153
154bool StadiaController::GetYButtonReleased() {
155 return GetRawButtonReleased(Button::kY);
156}
157
158BooleanEvent StadiaController::Y(EventLoop* loop) const {
159 return BooleanEvent(loop, [this]() { return this->GetYButton(); });
160}
161
162bool StadiaController::GetEllipsesButton() const {
163 return GetRawButton(Button::kEllipses);
164}
165
166bool StadiaController::GetEllipsesButtonPressed() {
167 return GetRawButtonPressed(Button::kEllipses);
168}
169
170bool StadiaController::GetEllipsesButtonReleased() {
171 return GetRawButtonReleased(Button::kEllipses);
172}
173
174BooleanEvent StadiaController::Ellipses(EventLoop* loop) const {
175 return BooleanEvent(loop, [this]() { return this->GetEllipsesButton(); });
176}
177
178bool StadiaController::GetHamburgerButton() const {
179 return GetRawButton(Button::kHamburger);
180}
181
182bool StadiaController::GetHamburgerButtonPressed() {
183 return GetRawButtonPressed(Button::kHamburger);
184}
185
186bool StadiaController::GetHamburgerButtonReleased() {
187 return GetRawButtonReleased(Button::kHamburger);
188}
189
190BooleanEvent StadiaController::Hamburger(EventLoop* loop) const {
191 return BooleanEvent(loop, [this]() { return this->GetHamburgerButton(); });
192}
193
194bool StadiaController::GetStadiaButton() const {
195 return GetRawButton(Button::kStadia);
196}
197
198bool StadiaController::GetStadiaButtonPressed() {
199 return GetRawButtonPressed(Button::kStadia);
200}
201
202bool StadiaController::GetStadiaButtonReleased() {
203 return GetRawButtonReleased(Button::kStadia);
204}
205
206BooleanEvent StadiaController::Stadia(EventLoop* loop) const {
207 return BooleanEvent(loop, [this]() { return this->GetStadiaButton(); });
208}
209
210bool StadiaController::GetGoogleButton() const {
211 return GetRawButton(Button::kGoogle);
212}
213
214bool StadiaController::GetGoogleButtonPressed() {
215 return GetRawButtonPressed(Button::kGoogle);
216}
217
218bool StadiaController::GetGoogleButtonReleased() {
219 return GetRawButtonReleased(Button::kGoogle);
220}
221
222BooleanEvent StadiaController::Google(EventLoop* loop) const {
223 return BooleanEvent(loop, [this]() { return this->GetGoogleButton(); });
224}
225
226bool StadiaController::GetFrameButton() const {
227 return GetRawButton(Button::kFrame);
228}
229
230bool StadiaController::GetFrameButtonPressed() {
231 return GetRawButtonPressed(Button::kFrame);
232}
233
234bool StadiaController::GetFrameButtonReleased() {
235 return GetRawButtonReleased(Button::kFrame);
236}
237
238BooleanEvent StadiaController::Frame(EventLoop* loop) const {
239 return BooleanEvent(loop, [this]() { return this->GetFrameButton(); });
240}
241
242bool StadiaController::GetLeftTriggerButton() const {
243 return GetRawButton(Button::kLeftTrigger);
244}
245
246bool StadiaController::GetLeftTriggerButtonPressed() {
247 return GetRawButtonPressed(Button::kLeftTrigger);
248}
249
250bool StadiaController::GetLeftTriggerButtonReleased() {
251 return GetRawButtonReleased(Button::kLeftTrigger);
252}
253
254BooleanEvent StadiaController::LeftTrigger(EventLoop* loop) const {
255 return BooleanEvent(loop, [this]() { return this->GetLeftTriggerButton(); });
256}
257
258bool StadiaController::GetRightTriggerButton() const {
259 return GetRawButton(Button::kRightTrigger);
260}
261
262bool StadiaController::GetRightTriggerButtonPressed() {
263 return GetRawButtonPressed(Button::kRightTrigger);
264}
265
266bool StadiaController::GetRightTriggerButtonReleased() {
267 return GetRawButtonReleased(Button::kRightTrigger);
268}
269
270BooleanEvent StadiaController::RightTrigger(EventLoop* loop) const {
271 return BooleanEvent(loop, [this]() { return this->GetRightTriggerButton(); });
272}