mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilib] Add BooleanEvent/Trigger factories on HID classes (#4247)
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
// 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.
|
||||
|
||||
#include "frc2/command/button/CommandGenericHID.h"
|
||||
|
||||
using namespace frc2;
|
||||
|
||||
Trigger CommandGenericHID::Button(int button, frc::EventLoop* loop) const {
|
||||
return GenericHID::Button(button, loop).CastTo<Trigger>();
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// 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.
|
||||
|
||||
#include "frc2/command/button/CommandJoystick.h"
|
||||
|
||||
using namespace frc2;
|
||||
|
||||
Trigger CommandJoystick::Button(int button, frc::EventLoop* loop) const {
|
||||
return GenericHID::Button(button, loop).CastTo<class Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandJoystick::Trigger(frc::EventLoop* loop) const {
|
||||
return Joystick::Trigger(loop).CastTo<class Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandJoystick::Top(frc::EventLoop* loop) const {
|
||||
return Joystick::Top(loop).CastTo<class Trigger>();
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
// 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.
|
||||
|
||||
#include "frc2/command/button/CommandPS4Controller.h"
|
||||
|
||||
using namespace frc2;
|
||||
|
||||
Trigger CommandPS4Controller::Square(frc::EventLoop* loop) const {
|
||||
return PS4Controller::Square(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandPS4Controller::Cross(frc::EventLoop* loop) const {
|
||||
return PS4Controller::Cross(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandPS4Controller::Circle(frc::EventLoop* loop) const {
|
||||
return PS4Controller::Circle(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandPS4Controller::Triangle(frc::EventLoop* loop) const {
|
||||
return PS4Controller::Triangle(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandPS4Controller::L1(frc::EventLoop* loop) const {
|
||||
return PS4Controller::L1(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandPS4Controller::R1(frc::EventLoop* loop) const {
|
||||
return PS4Controller::R1(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandPS4Controller::L2(frc::EventLoop* loop) const {
|
||||
return PS4Controller::L2(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandPS4Controller::R2(frc::EventLoop* loop) const {
|
||||
return PS4Controller::R2(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandPS4Controller::Options(frc::EventLoop* loop) const {
|
||||
return PS4Controller::Options(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandPS4Controller::L3(frc::EventLoop* loop) const {
|
||||
return PS4Controller::L3(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandPS4Controller::R3(frc::EventLoop* loop) const {
|
||||
return PS4Controller::R3(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandPS4Controller::PS(frc::EventLoop* loop) const {
|
||||
return PS4Controller::PS(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandPS4Controller::Touchpad(frc::EventLoop* loop) const {
|
||||
return PS4Controller::Touchpad(loop).CastTo<Trigger>();
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// 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.
|
||||
|
||||
#include "frc2/command/button/CommandXboxController.h"
|
||||
|
||||
using namespace frc2;
|
||||
|
||||
Trigger CommandXboxController::LeftBumper(frc::EventLoop* loop) const {
|
||||
return XboxController::LeftBumper(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandXboxController::RightBumper(frc::EventLoop* loop) const {
|
||||
return XboxController::RightBumper(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandXboxController::LeftStick(frc::EventLoop* loop) const {
|
||||
return XboxController::LeftStick(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandXboxController::RightStick(frc::EventLoop* loop) const {
|
||||
return XboxController::RightStick(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandXboxController::A(frc::EventLoop* loop) const {
|
||||
return XboxController::A(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandXboxController::B(frc::EventLoop* loop) const {
|
||||
return XboxController::B(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandXboxController::X(frc::EventLoop* loop) const {
|
||||
return XboxController::X(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandXboxController::Y(frc::EventLoop* loop) const {
|
||||
return XboxController::Y(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandXboxController::Back(frc::EventLoop* loop) const {
|
||||
return XboxController::Back(loop).CastTo<Trigger>();
|
||||
}
|
||||
|
||||
Trigger CommandXboxController::Start(frc::EventLoop* loop) const {
|
||||
return XboxController::Start(loop).CastTo<Trigger>();
|
||||
}
|
||||
Reference in New Issue
Block a user