Skip to content

Commit

Permalink
Remove unnecessary comments and conversion functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold856 committed Jul 12, 2024
1 parent f663d13 commit a2fd149
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 39 deletions.
17 changes: 1 addition & 16 deletions wpilibc/src/main/native/cpp/ADIS16448_IMU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ static inline int16_t BuffToShort(const uint32_t* buf) {
return (static_cast<int16_t>(buf[0]) << 8) | buf[1];
}

static inline uint16_t ToUShort(const uint8_t* buf) {
return (static_cast<uint16_t>(buf[0]) << 8) | buf[1];
}

using namespace frc;

namespace {
Expand Down Expand Up @@ -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;
Expand All @@ -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<uint16_t>(buf[0]) << 8) | buf[1];
}

/**
Expand All @@ -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;
Expand Down
23 changes: 0 additions & 23 deletions wpilibc/src/main/native/cpp/ADIS16470_IMU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a2fd149

Please sign in to comment.