[wpilib] Add PS4Controller, remove Hand from GenericHID/XboxController (#3345)

- GenericHID is now concrete, and has only getRawAxis/Button(int) functionality
- getXxx() has been moved into Joystick as that's the only place where it makes sense
- Hand (and therefore getXxx(Hand)) has been removed, replaced by specific getLeft/RightXxx() methods in XboxController and the new PS4Controller class
- C++ ::Button:: and ::Axis:: enums have been converted to identically-namespaced static constexpr ints
This commit is contained in:
Starlight220
2021-08-14 20:00:46 +03:00
committed by GitHub
parent 25f6f478a5
commit 031962608b
82 changed files with 2548 additions and 934 deletions

View File

@@ -0,0 +1,37 @@
// 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 "frc/PS4Controller.h" // NOLINT(build/include_order)
#include "JoystickTestMacros.h"
#include "frc/simulation/PS4ControllerSim.h"
#include "gtest/gtest.h"
using namespace frc;
BUTTON_TEST(PS4Controller, SquareButton)
BUTTON_TEST(PS4Controller, CrossButton)
BUTTON_TEST(PS4Controller, CircleButton)
BUTTON_TEST(PS4Controller, TriangleButton)
BUTTON_TEST(PS4Controller, L1Button)
BUTTON_TEST(PS4Controller, R1Button)
BUTTON_TEST(PS4Controller, L2Button)
BUTTON_TEST(PS4Controller, R2Button)
BUTTON_TEST(PS4Controller, ShareButton)
BUTTON_TEST(PS4Controller, OptionsButton)
BUTTON_TEST(PS4Controller, L3Button)
BUTTON_TEST(PS4Controller, R3Button)
BUTTON_TEST(PS4Controller, PSButton)
BUTTON_TEST(PS4Controller, Touchpad)
AXIS_TEST(PS4Controller, LeftX)
AXIS_TEST(PS4Controller, RightX)
AXIS_TEST(PS4Controller, LeftY)
AXIS_TEST(PS4Controller, RightY)
AXIS_TEST(PS4Controller, L2Axis)
AXIS_TEST(PS4Controller, R2Axis)