From a57266316774c5442a0783d48851808010a505a7 Mon Sep 17 00:00:00 2001 From: Gold856 <117957790+Gold856@users.noreply.github.com> Date: Thu, 27 Jun 2024 02:16:38 -0400 Subject: [PATCH] Remove unnecessary comments and conversion functions --- wpilibc/src/main/native/cpp/ADIS16448_IMU.cpp | 17 +------------- wpilibc/src/main/native/cpp/ADIS16470_IMU.cpp | 23 ------------------- 2 files changed, 1 insertion(+), 39 deletions(-) diff --git a/wpilibc/src/main/native/cpp/ADIS16448_IMU.cpp b/wpilibc/src/main/native/cpp/ADIS16448_IMU.cpp index a0c6a4045a1..5dcb95f0883 100644 --- a/wpilibc/src/main/native/cpp/ADIS16448_IMU.cpp +++ b/wpilibc/src/main/native/cpp/ADIS16448_IMU.cpp @@ -40,10 +40,6 @@ static inline int16_t BuffToShort(const uint32_t* buf) { return (static_cast(buf[0]) << 8) | buf[1]; } -static inline uint16_t ToUShort(const uint8_t* buf) { - return (static_cast(buf[0]) << 8) | buf[1]; -} - using namespace frc; namespace { @@ -485,13 +481,6 @@ void ADIS16448_IMU::Calibrate() { m_integ_gyro_angle_z = 0.0; } -/** - * This function reads the contents of an 8-bit register location by - *transmitting the register location byte along with a null (0x00) byte using - *the standard WPILib API. The response (two bytes) is read back using the - *WPILib API and joined using a helper function. This function assumes the - *controller is set to standard SPI mode. - **/ uint16_t ADIS16448_IMU::ReadRegister(uint8_t reg) { uint8_t buf[2]; buf[0] = reg & 0x7f; @@ -500,7 +489,7 @@ uint16_t ADIS16448_IMU::ReadRegister(uint8_t reg) { m_spi->Write(buf, 2); m_spi->Read(false, buf, 2); - return ToUShort(buf); + return (static_cast(buf[0]) << 8) | buf[1]; } /** @@ -520,10 +509,6 @@ void ADIS16448_IMU::WriteRegister(uint8_t reg, uint16_t val) { m_spi->Write(buf, 2); } -/** - * This function resets (zeros) the accumulated (integrated) angle estimates for - *the xgyro, ygyro, and zgyro outputs. - **/ void ADIS16448_IMU::Reset() { std::scoped_lock sync(m_mutex); m_integ_gyro_angle_x = 0.0; diff --git a/wpilibc/src/main/native/cpp/ADIS16470_IMU.cpp b/wpilibc/src/main/native/cpp/ADIS16470_IMU.cpp index 4decdcb239d..5af75b8a6d1 100644 --- a/wpilibc/src/main/native/cpp/ADIS16470_IMU.cpp +++ b/wpilibc/src/main/native/cpp/ADIS16470_IMU.cpp @@ -56,9 +56,6 @@ inline void ADISReportError(int32_t status, const char* file, int line, #define REPORT_ERROR(msg) \ ADISReportError(err::Error, __FILE__, __LINE__, __FUNCTION__, msg) -/** - * Constructor. - */ ADIS16470_IMU::ADIS16470_IMU() : ADIS16470_IMU(kZ, kY, kX, SPI::Port::kOnboardCS0, CalibrationTime::_1s) {} @@ -490,20 +487,6 @@ void ADIS16470_IMU::Calibrate() { } } -/** - * @brief Reads the contents of a specified register location over SPI. - * - * @param reg An unsigned, 8-bit register location. - * - * @return An unsigned, 16-bit number representing the contents of the requested - *register location. - * - * This function reads the contents of an 8-bit register location by - *transmitting the register location byte along with a null (0x00) byte using - *the standard WPILib API. The response (two bytes) is read back using the - *WPILib API and joined using a helper function. This function assumes the - *controller is set to standard SPI mode. - **/ uint16_t ADIS16470_IMU::ReadRegister(uint8_t reg) { uint8_t buf[2]; buf[0] = reg & 0x7f; @@ -540,12 +523,6 @@ void ADIS16470_IMU::WriteRegister(uint8_t reg, uint16_t val) { m_spi->Write(buf, 2); } -/** - * @brief Resets (zeros) the xgyro, ygyro, and zgyro angle integrations. - * - * This function resets (zeros) the accumulated (integrated) angle estimates for - *the xgyro, ygyro, and zgyro outputs. - **/ void ADIS16470_IMU::Reset() { std::scoped_lock sync(m_mutex); m_integ_angle_x = 0.0;