Skip to content

Commit

Permalink
[wpilib] Make protected fields in accelerometers/gyros private (#6134)
Browse files Browse the repository at this point in the history
This avoids needing add redundant JavaDocs to them, and better reflects
how we design our modern classes (the classes modified here were around
with minimal changes since 2008 or so).
  • Loading branch information
calcmogul authored Jan 2, 2024
1 parent e7c9f27 commit 91d8837
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion wpilibc/src/main/native/include/frc/ADXL345_I2C.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class ADXL345_I2C : public nt::NTSendable,

void InitSendable(nt::NTSendableBuilder& builder) override;

protected:
private:
I2C m_i2c;

hal::SimDevice m_simDevice;
Expand Down
2 changes: 1 addition & 1 deletion wpilibc/src/main/native/include/frc/ADXL345_SPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class ADXL345_SPI : public nt::NTSendable,

void InitSendable(nt::NTSendableBuilder& builder) override;

protected:
private:
SPI m_spi;

hal::SimDevice m_simDevice;
Expand Down
4 changes: 1 addition & 3 deletions wpilibc/src/main/native/include/frc/AnalogGyro.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,8 @@ class AnalogGyro : public wpi::Sendable,

void InitSendable(wpi::SendableBuilder& builder) override;

protected:
std::shared_ptr<AnalogInput> m_analog;

private:
std::shared_ptr<AnalogInput> m_analog;
hal::Handle<HAL_GyroHandle> m_gyroHandle;
};

Expand Down
12 changes: 6 additions & 6 deletions wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_I2C.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ public static class AllAxes {
public double ZAxis;
}

protected I2C m_i2c;
private I2C m_i2c;

protected SimDevice m_simDevice;
protected SimEnum m_simRange;
protected SimDouble m_simX;
protected SimDouble m_simY;
protected SimDouble m_simZ;
private SimDevice m_simDevice;
private SimEnum m_simRange;
private SimDouble m_simX;
private SimDouble m_simY;
private SimDouble m_simZ;

/**
* Constructs the ADXL345 Accelerometer with I2C address 0x1D.
Expand Down
12 changes: 6 additions & 6 deletions wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_SPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ public static class AllAxes {
public double ZAxis;
}

protected SPI m_spi;
private SPI m_spi;

protected SimDevice m_simDevice;
protected SimEnum m_simRange;
protected SimDouble m_simX;
protected SimDouble m_simY;
protected SimDouble m_simZ;
private SimDevice m_simDevice;
private SimEnum m_simRange;
private SimDouble m_simX;
private SimDouble m_simY;
private SimDouble m_simZ;

/**
* Constructor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
public class AnalogGyro implements Sendable, AutoCloseable {
private static final double kDefaultVoltsPerDegreePerSecond = 0.007;
protected AnalogInput m_analog;
private AnalogInput m_analog;
private boolean m_channelAllocated;

private int m_gyroHandle;
Expand Down

0 comments on commit 91d8837

Please sign in to comment.