[hal, wpilib] Remove SPI support (#7678)

This commit is contained in:
Thad House
2025-01-17 00:22:29 -08:00
committed by GitHub
parent dc335ddedb
commit 92f0a3c961
84 changed files with 12 additions and 12763 deletions

View File

@@ -1,63 +0,0 @@
// 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/simulation/ADXL345Sim.h" // NOLINT(build/include_order)
#include <gtest/gtest.h>
#include <hal/HAL.h>
#include "frc/ADXL345_I2C.h"
#include "frc/ADXL345_SPI.h"
namespace frc::sim {
TEST(ADXL345SimTest, SetSpiAttributes) {
HAL_Initialize(500, 0);
ADXL345_SPI accel(SPI::kMXP, ADXL345_SPI::kRange_2G);
ADXL345Sim sim(accel);
EXPECT_EQ(0, accel.GetX());
EXPECT_EQ(0, accel.GetY());
EXPECT_EQ(0, accel.GetZ());
sim.SetX(1.91);
sim.SetY(-3.405);
sim.SetZ(2.29);
EXPECT_EQ(1.91, accel.GetX());
EXPECT_EQ(-3.405, accel.GetY());
EXPECT_EQ(2.29, accel.GetZ());
ADXL345_SPI::AllAxes allAccel = accel.GetAccelerations();
EXPECT_EQ(1.91, allAccel.XAxis);
EXPECT_EQ(-3.405, allAccel.YAxis);
EXPECT_EQ(2.29, allAccel.ZAxis);
}
TEST(ADXL345SimTest, SetI2CAttribute) {
HAL_Initialize(500, 0);
ADXL345_I2C accel(I2C::kMXP);
ADXL345Sim sim(accel);
EXPECT_EQ(0, accel.GetX());
EXPECT_EQ(0, accel.GetY());
EXPECT_EQ(0, accel.GetZ());
sim.SetX(1.91);
sim.SetY(-3.405);
sim.SetZ(2.29);
EXPECT_EQ(1.91, accel.GetX());
EXPECT_EQ(-3.405, accel.GetY());
EXPECT_EQ(2.29, accel.GetZ());
ADXL345_I2C::AllAxes allAccel = accel.GetAccelerations();
EXPECT_EQ(1.91, allAccel.XAxis);
EXPECT_EQ(-3.405, allAccel.YAxis);
EXPECT_EQ(2.29, allAccel.ZAxis);
}
} // namespace frc::sim

View File

@@ -1,38 +0,0 @@
// 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/simulation/ADXL362Sim.h" // NOLINT(build/include_order)
#include <gtest/gtest.h>
#include <hal/HAL.h>
#include "frc/ADXL362.h"
namespace frc::sim {
TEST(ADXL362SimTest, SetAttributes) {
HAL_Initialize(500, 0);
ADXL362 accel(SPI::kMXP, ADXL362::kRange_2G);
ADXL362Sim sim(accel);
EXPECT_EQ(0, accel.GetX());
EXPECT_EQ(0, accel.GetY());
EXPECT_EQ(0, accel.GetZ());
sim.SetX(1.91);
sim.SetY(-3.405);
sim.SetZ(2.29);
EXPECT_EQ(1.91, accel.GetX());
EXPECT_EQ(-3.405, accel.GetY());
EXPECT_EQ(2.29, accel.GetZ());
ADXL362::AllAxes allAccel = accel.GetAccelerations();
EXPECT_EQ(1.91, allAccel.XAxis);
EXPECT_EQ(-3.405, allAccel.YAxis);
EXPECT_EQ(2.29, allAccel.ZAxis);
}
} // namespace frc::sim

View File

@@ -1,35 +0,0 @@
// 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/simulation/ADXRS450_GyroSim.h" // NOLINT(build/include_order)
#include <gtest/gtest.h>
#include <hal/HAL.h>
#include "frc/ADXRS450_Gyro.h"
namespace frc::sim {
TEST(ADXRS450GyroSimTest, SetAttributes) {
HAL_Initialize(500, 0);
ADXRS450_Gyro gyro;
ADXRS450_GyroSim sim{gyro};
EXPECT_EQ(0, gyro.GetAngle());
EXPECT_EQ(0, gyro.GetRate());
constexpr units::degree_t TEST_ANGLE{123.456};
constexpr units::degrees_per_second_t TEST_RATE{229.3504};
sim.SetAngle(TEST_ANGLE);
sim.SetRate(TEST_RATE);
EXPECT_EQ(TEST_ANGLE.value(), gyro.GetAngle());
EXPECT_EQ(TEST_RATE.value(), gyro.GetRate());
gyro.Reset();
EXPECT_EQ(0, gyro.GetAngle());
}
} // namespace frc::sim

View File

@@ -21,7 +21,6 @@
#include "frc/simulation/PWMSim.h"
#include "frc/simulation/PowerDistributionSim.h"
#include "frc/simulation/RoboRioSim.h"
#include "frc/simulation/SPIAccelerometerSim.h"
using namespace frc::sim;
@@ -42,7 +41,6 @@ TEST(SimInitializationTest, AllInitialize) {
PWMSim pwmsim{0};
RoboRioSim rrsim;
(void)rrsim;
SPIAccelerometerSim sasim{0};
DutyCycleSim dcsim = DutyCycleSim::CreateForIndex(0);
(void)dcsim;
AddressableLEDSim adLED;