mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
322 lines
9.7 KiB
C++
Generated
322 lines
9.7 KiB
C++
Generated
// Copyright (c) FIRST and other WPILib contributors.
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
// the WPILib BSD license file in the root directory of this project.
|
|
|
|
// THIS FILE WAS AUTO-GENERATED BY ./wpilibc/generate_hids.py. DO NOT MODIFY
|
|
|
|
#include "frc/StadiaController.h"
|
|
|
|
#include <hal/UsageReporting.h>
|
|
#include <wpi/sendable/SendableBuilder.h>
|
|
|
|
#include "frc/event/BooleanEvent.h"
|
|
|
|
using namespace frc;
|
|
|
|
StadiaController::StadiaController(int port) : GenericHID(port) {
|
|
HAL_ReportUsage("HID", port, "StadiaController");
|
|
}
|
|
|
|
double StadiaController::GetLeftX() const {
|
|
return GetRawAxis(Axis::kLeftX);
|
|
}
|
|
|
|
double StadiaController::GetRightX() const {
|
|
return GetRawAxis(Axis::kRightX);
|
|
}
|
|
|
|
double StadiaController::GetLeftY() const {
|
|
return GetRawAxis(Axis::kLeftY);
|
|
}
|
|
|
|
double StadiaController::GetRightY() const {
|
|
return GetRawAxis(Axis::kRightY);
|
|
}
|
|
|
|
bool StadiaController::GetAButton() const {
|
|
return GetRawButton(Button::kA);
|
|
}
|
|
|
|
bool StadiaController::GetAButtonPressed() {
|
|
return GetRawButtonPressed(Button::kA);
|
|
}
|
|
|
|
bool StadiaController::GetAButtonReleased() {
|
|
return GetRawButtonReleased(Button::kA);
|
|
}
|
|
|
|
BooleanEvent StadiaController::A(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetAButton(); });
|
|
}
|
|
|
|
bool StadiaController::GetBButton() const {
|
|
return GetRawButton(Button::kB);
|
|
}
|
|
|
|
bool StadiaController::GetBButtonPressed() {
|
|
return GetRawButtonPressed(Button::kB);
|
|
}
|
|
|
|
bool StadiaController::GetBButtonReleased() {
|
|
return GetRawButtonReleased(Button::kB);
|
|
}
|
|
|
|
BooleanEvent StadiaController::B(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetBButton(); });
|
|
}
|
|
|
|
bool StadiaController::GetXButton() const {
|
|
return GetRawButton(Button::kX);
|
|
}
|
|
|
|
bool StadiaController::GetXButtonPressed() {
|
|
return GetRawButtonPressed(Button::kX);
|
|
}
|
|
|
|
bool StadiaController::GetXButtonReleased() {
|
|
return GetRawButtonReleased(Button::kX);
|
|
}
|
|
|
|
BooleanEvent StadiaController::X(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetXButton(); });
|
|
}
|
|
|
|
bool StadiaController::GetYButton() const {
|
|
return GetRawButton(Button::kY);
|
|
}
|
|
|
|
bool StadiaController::GetYButtonPressed() {
|
|
return GetRawButtonPressed(Button::kY);
|
|
}
|
|
|
|
bool StadiaController::GetYButtonReleased() {
|
|
return GetRawButtonReleased(Button::kY);
|
|
}
|
|
|
|
BooleanEvent StadiaController::Y(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetYButton(); });
|
|
}
|
|
|
|
bool StadiaController::GetLeftBumperButton() const {
|
|
return GetRawButton(Button::kLeftBumper);
|
|
}
|
|
|
|
bool StadiaController::GetLeftBumperButtonPressed() {
|
|
return GetRawButtonPressed(Button::kLeftBumper);
|
|
}
|
|
|
|
bool StadiaController::GetLeftBumperButtonReleased() {
|
|
return GetRawButtonReleased(Button::kLeftBumper);
|
|
}
|
|
|
|
BooleanEvent StadiaController::LeftBumper(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetLeftBumperButton(); });
|
|
}
|
|
|
|
bool StadiaController::GetRightBumperButton() const {
|
|
return GetRawButton(Button::kRightBumper);
|
|
}
|
|
|
|
bool StadiaController::GetRightBumperButtonPressed() {
|
|
return GetRawButtonPressed(Button::kRightBumper);
|
|
}
|
|
|
|
bool StadiaController::GetRightBumperButtonReleased() {
|
|
return GetRawButtonReleased(Button::kRightBumper);
|
|
}
|
|
|
|
BooleanEvent StadiaController::RightBumper(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetRightBumperButton(); });
|
|
}
|
|
|
|
bool StadiaController::GetLeftStickButton() const {
|
|
return GetRawButton(Button::kLeftStick);
|
|
}
|
|
|
|
bool StadiaController::GetLeftStickButtonPressed() {
|
|
return GetRawButtonPressed(Button::kLeftStick);
|
|
}
|
|
|
|
bool StadiaController::GetLeftStickButtonReleased() {
|
|
return GetRawButtonReleased(Button::kLeftStick);
|
|
}
|
|
|
|
BooleanEvent StadiaController::LeftStick(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetLeftStickButton(); });
|
|
}
|
|
|
|
bool StadiaController::GetRightStickButton() const {
|
|
return GetRawButton(Button::kRightStick);
|
|
}
|
|
|
|
bool StadiaController::GetRightStickButtonPressed() {
|
|
return GetRawButtonPressed(Button::kRightStick);
|
|
}
|
|
|
|
bool StadiaController::GetRightStickButtonReleased() {
|
|
return GetRawButtonReleased(Button::kRightStick);
|
|
}
|
|
|
|
BooleanEvent StadiaController::RightStick(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetRightStickButton(); });
|
|
}
|
|
|
|
bool StadiaController::GetEllipsesButton() const {
|
|
return GetRawButton(Button::kEllipses);
|
|
}
|
|
|
|
bool StadiaController::GetEllipsesButtonPressed() {
|
|
return GetRawButtonPressed(Button::kEllipses);
|
|
}
|
|
|
|
bool StadiaController::GetEllipsesButtonReleased() {
|
|
return GetRawButtonReleased(Button::kEllipses);
|
|
}
|
|
|
|
BooleanEvent StadiaController::Ellipses(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetEllipsesButton(); });
|
|
}
|
|
|
|
bool StadiaController::GetHamburgerButton() const {
|
|
return GetRawButton(Button::kHamburger);
|
|
}
|
|
|
|
bool StadiaController::GetHamburgerButtonPressed() {
|
|
return GetRawButtonPressed(Button::kHamburger);
|
|
}
|
|
|
|
bool StadiaController::GetHamburgerButtonReleased() {
|
|
return GetRawButtonReleased(Button::kHamburger);
|
|
}
|
|
|
|
BooleanEvent StadiaController::Hamburger(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetHamburgerButton(); });
|
|
}
|
|
|
|
bool StadiaController::GetStadiaButton() const {
|
|
return GetRawButton(Button::kStadia);
|
|
}
|
|
|
|
bool StadiaController::GetStadiaButtonPressed() {
|
|
return GetRawButtonPressed(Button::kStadia);
|
|
}
|
|
|
|
bool StadiaController::GetStadiaButtonReleased() {
|
|
return GetRawButtonReleased(Button::kStadia);
|
|
}
|
|
|
|
BooleanEvent StadiaController::Stadia(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetStadiaButton(); });
|
|
}
|
|
|
|
bool StadiaController::GetRightTriggerButton() const {
|
|
return GetRawButton(Button::kRightTrigger);
|
|
}
|
|
|
|
bool StadiaController::GetRightTriggerButtonPressed() {
|
|
return GetRawButtonPressed(Button::kRightTrigger);
|
|
}
|
|
|
|
bool StadiaController::GetRightTriggerButtonReleased() {
|
|
return GetRawButtonReleased(Button::kRightTrigger);
|
|
}
|
|
|
|
BooleanEvent StadiaController::RightTrigger(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetRightTriggerButton(); });
|
|
}
|
|
|
|
bool StadiaController::GetLeftTriggerButton() const {
|
|
return GetRawButton(Button::kLeftTrigger);
|
|
}
|
|
|
|
bool StadiaController::GetLeftTriggerButtonPressed() {
|
|
return GetRawButtonPressed(Button::kLeftTrigger);
|
|
}
|
|
|
|
bool StadiaController::GetLeftTriggerButtonReleased() {
|
|
return GetRawButtonReleased(Button::kLeftTrigger);
|
|
}
|
|
|
|
BooleanEvent StadiaController::LeftTrigger(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetLeftTriggerButton(); });
|
|
}
|
|
|
|
bool StadiaController::GetGoogleButton() const {
|
|
return GetRawButton(Button::kGoogle);
|
|
}
|
|
|
|
bool StadiaController::GetGoogleButtonPressed() {
|
|
return GetRawButtonPressed(Button::kGoogle);
|
|
}
|
|
|
|
bool StadiaController::GetGoogleButtonReleased() {
|
|
return GetRawButtonReleased(Button::kGoogle);
|
|
}
|
|
|
|
BooleanEvent StadiaController::Google(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetGoogleButton(); });
|
|
}
|
|
|
|
bool StadiaController::GetFrameButton() const {
|
|
return GetRawButton(Button::kFrame);
|
|
}
|
|
|
|
bool StadiaController::GetFrameButtonPressed() {
|
|
return GetRawButtonPressed(Button::kFrame);
|
|
}
|
|
|
|
bool StadiaController::GetFrameButtonReleased() {
|
|
return GetRawButtonReleased(Button::kFrame);
|
|
}
|
|
|
|
BooleanEvent StadiaController::Frame(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetFrameButton(); });
|
|
}
|
|
|
|
bool StadiaController::GetLeftBumper() const {
|
|
return GetRawButton(Button::kLeftBumper);
|
|
}
|
|
|
|
bool StadiaController::GetRightBumper() const {
|
|
return GetRawButton(Button::kRightBumper);
|
|
}
|
|
|
|
bool StadiaController::GetLeftBumperPressed() {
|
|
return GetRawButtonPressed(Button::kLeftBumper);
|
|
}
|
|
|
|
bool StadiaController::GetRightBumperPressed() {
|
|
return GetRawButtonPressed(Button::kRightBumper);
|
|
}
|
|
|
|
bool StadiaController::GetLeftBumperReleased() {
|
|
return GetRawButtonReleased(Button::kLeftBumper);
|
|
}
|
|
|
|
bool StadiaController::GetRightBumperReleased() {
|
|
return GetRawButtonReleased(Button::kRightBumper);
|
|
}
|
|
|
|
void StadiaController::InitSendable(wpi::SendableBuilder& builder) {
|
|
builder.SetSmartDashboardType("HID");
|
|
builder.PublishConstString("ControllerType", "Stadia");
|
|
builder.AddDoubleProperty("LeftX", [this] { return GetLeftX(); }, nullptr);
|
|
builder.AddDoubleProperty("RightX", [this] { return GetRightX(); }, nullptr);
|
|
builder.AddDoubleProperty("LeftY", [this] { return GetLeftY(); }, nullptr);
|
|
builder.AddDoubleProperty("RightY", [this] { return GetRightY(); }, nullptr);
|
|
builder.AddBooleanProperty("A", [this] { return GetAButton(); }, nullptr);
|
|
builder.AddBooleanProperty("B", [this] { return GetBButton(); }, nullptr);
|
|
builder.AddBooleanProperty("X", [this] { return GetXButton(); }, nullptr);
|
|
builder.AddBooleanProperty("Y", [this] { return GetYButton(); }, nullptr);
|
|
builder.AddBooleanProperty("LeftBumper", [this] { return GetLeftBumperButton(); }, nullptr);
|
|
builder.AddBooleanProperty("RightBumper", [this] { return GetRightBumperButton(); }, nullptr);
|
|
builder.AddBooleanProperty("LeftStick", [this] { return GetLeftStickButton(); }, nullptr);
|
|
builder.AddBooleanProperty("RightStick", [this] { return GetRightStickButton(); }, nullptr);
|
|
builder.AddBooleanProperty("Ellipses", [this] { return GetEllipsesButton(); }, nullptr);
|
|
builder.AddBooleanProperty("Hamburger", [this] { return GetHamburgerButton(); }, nullptr);
|
|
builder.AddBooleanProperty("Stadia", [this] { return GetStadiaButton(); }, nullptr);
|
|
builder.AddBooleanProperty("RightTrigger", [this] { return GetRightTriggerButton(); }, nullptr);
|
|
builder.AddBooleanProperty("LeftTrigger", [this] { return GetLeftTriggerButton(); }, nullptr);
|
|
builder.AddBooleanProperty("Google", [this] { return GetGoogleButton(); }, nullptr);
|
|
builder.AddBooleanProperty("Frame", [this] { return GetFrameButton(); }, nullptr);
|
|
} |