mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
291 lines
8.7 KiB
C++
Generated
291 lines
8.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 "wpi/driverstation/NiDsPS4Controller.hpp"
|
|
|
|
#include "wpi/hal/UsageReporting.hpp"
|
|
#include "wpi/util/sendable/SendableBuilder.hpp"
|
|
|
|
#include "wpi/event/BooleanEvent.hpp"
|
|
|
|
using namespace wpi;
|
|
|
|
NiDsPS4Controller::NiDsPS4Controller(int port) : GenericHID(port) {
|
|
HAL_ReportUsage("HID", port, "NiDsPS4Controller");
|
|
}
|
|
|
|
double NiDsPS4Controller::GetLeftX() const {
|
|
return GetRawAxis(Axis::kLeftX);
|
|
}
|
|
|
|
double NiDsPS4Controller::GetLeftY() const {
|
|
return GetRawAxis(Axis::kLeftY);
|
|
}
|
|
|
|
double NiDsPS4Controller::GetRightX() const {
|
|
return GetRawAxis(Axis::kRightX);
|
|
}
|
|
|
|
double NiDsPS4Controller::GetRightY() const {
|
|
return GetRawAxis(Axis::kRightY);
|
|
}
|
|
|
|
double NiDsPS4Controller::GetL2Axis() const {
|
|
return GetRawAxis(Axis::kL2);
|
|
}
|
|
|
|
double NiDsPS4Controller::GetR2Axis() const {
|
|
return GetRawAxis(Axis::kR2);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetSquareButton() const {
|
|
return GetRawButton(Button::kSquare);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetSquareButtonPressed() {
|
|
return GetRawButtonPressed(Button::kSquare);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetSquareButtonReleased() {
|
|
return GetRawButtonReleased(Button::kSquare);
|
|
}
|
|
|
|
BooleanEvent NiDsPS4Controller::Square(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetSquareButton(); });
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetCrossButton() const {
|
|
return GetRawButton(Button::kCross);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetCrossButtonPressed() {
|
|
return GetRawButtonPressed(Button::kCross);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetCrossButtonReleased() {
|
|
return GetRawButtonReleased(Button::kCross);
|
|
}
|
|
|
|
BooleanEvent NiDsPS4Controller::Cross(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetCrossButton(); });
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetCircleButton() const {
|
|
return GetRawButton(Button::kCircle);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetCircleButtonPressed() {
|
|
return GetRawButtonPressed(Button::kCircle);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetCircleButtonReleased() {
|
|
return GetRawButtonReleased(Button::kCircle);
|
|
}
|
|
|
|
BooleanEvent NiDsPS4Controller::Circle(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetCircleButton(); });
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetTriangleButton() const {
|
|
return GetRawButton(Button::kTriangle);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetTriangleButtonPressed() {
|
|
return GetRawButtonPressed(Button::kTriangle);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetTriangleButtonReleased() {
|
|
return GetRawButtonReleased(Button::kTriangle);
|
|
}
|
|
|
|
BooleanEvent NiDsPS4Controller::Triangle(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetTriangleButton(); });
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetL1Button() const {
|
|
return GetRawButton(Button::kL1);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetL1ButtonPressed() {
|
|
return GetRawButtonPressed(Button::kL1);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetL1ButtonReleased() {
|
|
return GetRawButtonReleased(Button::kL1);
|
|
}
|
|
|
|
BooleanEvent NiDsPS4Controller::L1(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetL1Button(); });
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetR1Button() const {
|
|
return GetRawButton(Button::kR1);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetR1ButtonPressed() {
|
|
return GetRawButtonPressed(Button::kR1);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetR1ButtonReleased() {
|
|
return GetRawButtonReleased(Button::kR1);
|
|
}
|
|
|
|
BooleanEvent NiDsPS4Controller::R1(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetR1Button(); });
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetL2Button() const {
|
|
return GetRawButton(Button::kL2);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetL2ButtonPressed() {
|
|
return GetRawButtonPressed(Button::kL2);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetL2ButtonReleased() {
|
|
return GetRawButtonReleased(Button::kL2);
|
|
}
|
|
|
|
BooleanEvent NiDsPS4Controller::L2(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetL2Button(); });
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetR2Button() const {
|
|
return GetRawButton(Button::kR2);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetR2ButtonPressed() {
|
|
return GetRawButtonPressed(Button::kR2);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetR2ButtonReleased() {
|
|
return GetRawButtonReleased(Button::kR2);
|
|
}
|
|
|
|
BooleanEvent NiDsPS4Controller::R2(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetR2Button(); });
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetShareButton() const {
|
|
return GetRawButton(Button::kShare);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetShareButtonPressed() {
|
|
return GetRawButtonPressed(Button::kShare);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetShareButtonReleased() {
|
|
return GetRawButtonReleased(Button::kShare);
|
|
}
|
|
|
|
BooleanEvent NiDsPS4Controller::Share(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetShareButton(); });
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetOptionsButton() const {
|
|
return GetRawButton(Button::kOptions);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetOptionsButtonPressed() {
|
|
return GetRawButtonPressed(Button::kOptions);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetOptionsButtonReleased() {
|
|
return GetRawButtonReleased(Button::kOptions);
|
|
}
|
|
|
|
BooleanEvent NiDsPS4Controller::Options(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetOptionsButton(); });
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetL3Button() const {
|
|
return GetRawButton(Button::kL3);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetL3ButtonPressed() {
|
|
return GetRawButtonPressed(Button::kL3);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetL3ButtonReleased() {
|
|
return GetRawButtonReleased(Button::kL3);
|
|
}
|
|
|
|
BooleanEvent NiDsPS4Controller::L3(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetL3Button(); });
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetR3Button() const {
|
|
return GetRawButton(Button::kR3);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetR3ButtonPressed() {
|
|
return GetRawButtonPressed(Button::kR3);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetR3ButtonReleased() {
|
|
return GetRawButtonReleased(Button::kR3);
|
|
}
|
|
|
|
BooleanEvent NiDsPS4Controller::R3(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetR3Button(); });
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetPSButton() const {
|
|
return GetRawButton(Button::kPS);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetPSButtonPressed() {
|
|
return GetRawButtonPressed(Button::kPS);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetPSButtonReleased() {
|
|
return GetRawButtonReleased(Button::kPS);
|
|
}
|
|
|
|
BooleanEvent NiDsPS4Controller::PS(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetPSButton(); });
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetTouchpadButton() const {
|
|
return GetRawButton(Button::kTouchpad);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetTouchpadButtonPressed() {
|
|
return GetRawButtonPressed(Button::kTouchpad);
|
|
}
|
|
|
|
bool NiDsPS4Controller::GetTouchpadButtonReleased() {
|
|
return GetRawButtonReleased(Button::kTouchpad);
|
|
}
|
|
|
|
BooleanEvent NiDsPS4Controller::Touchpad(EventLoop* loop) const {
|
|
return BooleanEvent(loop, [this]() { return this->GetTouchpadButton(); });
|
|
}
|
|
|
|
void NiDsPS4Controller::InitSendable(wpi::util::SendableBuilder& builder) {
|
|
builder.SetSmartDashboardType("HID");
|
|
builder.PublishConstString("ControllerType", "NiDsPS4");
|
|
builder.AddDoubleProperty("L2 Axis", [this] { return GetL2Axis(); }, nullptr);
|
|
builder.AddDoubleProperty("R2 Axis", [this] { return GetR2Axis(); }, nullptr);
|
|
builder.AddDoubleProperty("LeftX", [this] { return GetLeftX(); }, nullptr);
|
|
builder.AddDoubleProperty("LeftY", [this] { return GetLeftY(); }, nullptr);
|
|
builder.AddDoubleProperty("RightX", [this] { return GetRightX(); }, nullptr);
|
|
builder.AddDoubleProperty("RightY", [this] { return GetRightY(); }, nullptr);
|
|
builder.AddBooleanProperty("Square", [this] { return GetSquareButton(); }, nullptr);
|
|
builder.AddBooleanProperty("Cross", [this] { return GetCrossButton(); }, nullptr);
|
|
builder.AddBooleanProperty("Circle", [this] { return GetCircleButton(); }, nullptr);
|
|
builder.AddBooleanProperty("Triangle", [this] { return GetTriangleButton(); }, nullptr);
|
|
builder.AddBooleanProperty("L1", [this] { return GetL1Button(); }, nullptr);
|
|
builder.AddBooleanProperty("R1", [this] { return GetR1Button(); }, nullptr);
|
|
builder.AddBooleanProperty("L2", [this] { return GetL2Button(); }, nullptr);
|
|
builder.AddBooleanProperty("R2", [this] { return GetR2Button(); }, nullptr);
|
|
builder.AddBooleanProperty("Share", [this] { return GetShareButton(); }, nullptr);
|
|
builder.AddBooleanProperty("Options", [this] { return GetOptionsButton(); }, nullptr);
|
|
builder.AddBooleanProperty("L3", [this] { return GetL3Button(); }, nullptr);
|
|
builder.AddBooleanProperty("R3", [this] { return GetR3Button(); }, nullptr);
|
|
builder.AddBooleanProperty("PS", [this] { return GetPSButton(); }, nullptr);
|
|
builder.AddBooleanProperty("Touchpad", [this] { return GetTouchpadButton(); }, nullptr);
|
|
} |