mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
[hal,wpilib] Rename I2C constants to all caps
This commit is contained in:
@@ -13,7 +13,7 @@ using namespace wpi;
|
||||
|
||||
ADXL345_I2C::ADXL345_I2C(I2C::Port port, Range range, int deviceAddress)
|
||||
: m_i2c(port, deviceAddress),
|
||||
m_simDevice("Accel:ADXL345_I2C", port, deviceAddress) {
|
||||
m_simDevice("Accel:ADXL345_I2C", static_cast<int>(port), deviceAddress) {
|
||||
if (m_simDevice) {
|
||||
m_simRange = m_simDevice.CreateEnumDouble(
|
||||
"range", wpi::hal::SimDevice::kOutput, {"2G", "4G", "8G", "16G"},
|
||||
@@ -31,7 +31,7 @@ ADXL345_I2C::ADXL345_I2C(I2C::Port port, Range range, int deviceAddress)
|
||||
fmt::format("I2C[{}][{}]", static_cast<int>(port), deviceAddress),
|
||||
"ADXL345");
|
||||
|
||||
wpi::util::SendableRegistry::Add(this, "ADXL345_I2C", port);
|
||||
wpi::util::SendableRegistry::Add(this, "ADXL345_I2C", static_cast<int>(port));
|
||||
}
|
||||
|
||||
I2C::Port ADXL345_I2C::GetI2CPort() const {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
using namespace wpi::sim;
|
||||
|
||||
ADXL345Sim::ADXL345Sim(const wpi::ADXL345_I2C& accel) {
|
||||
wpi::sim::SimDeviceSim deviceSim{"Accel:ADXL345_I2C", accel.GetI2CPort(),
|
||||
wpi::sim::SimDeviceSim deviceSim{"Accel:ADXL345_I2C",
|
||||
static_cast<int>(accel.GetI2CPort()),
|
||||
accel.GetI2CDeviceAddress()};
|
||||
m_simX = deviceSim.GetDouble("x");
|
||||
m_simY = deviceSim.GetDouble("y");
|
||||
|
||||
@@ -23,11 +23,11 @@ class I2C {
|
||||
/**
|
||||
* I2C connection ports.
|
||||
*/
|
||||
enum Port {
|
||||
enum class Port {
|
||||
/// I2C Port 0.
|
||||
kPort0 = 0,
|
||||
PORT_0 = 0,
|
||||
/// I2C Port 1.
|
||||
kPort1
|
||||
PORT_1
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -154,7 +154,7 @@ class I2C {
|
||||
bool VerifySensor(int registerAddress, int count, const uint8_t* expected);
|
||||
|
||||
private:
|
||||
wpi::hal::Handle<HAL_I2CPort, HAL_CloseI2C, HAL_I2C_kInvalid> m_port;
|
||||
wpi::hal::Handle<HAL_I2CPort, HAL_CloseI2C, HAL_I2C_PORT_INVALID> m_port;
|
||||
int m_deviceAddress;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user