Skip to content

Commit 67e1a23

Browse files
committed
Remove unused variable
1 parent aa152ab commit 67e1a23

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

obc/app/drivers/ina230/ina230.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ obc_error_code_t initINA230() {
100100
uint8_t alertRegisterUnpacked[] = {device.alertRegister >> 8, device.alertRegister & 0xFF};
101101
uint8_t calibrationRegisterUnpacked[] = {device.calibrationRegister >> 8, device.calibrationRegister & 0xFF};
102102

103-
uint8_t deviceAddress = device.i2cDeviceAddress;
104103
RETURN_IF_ERROR_CODE(writeINA230Register(INA230_CONFIG_REGISTER_ADDR, configRegisterUnpacked,
105104
sizeof(configRegisterUnpacked) / sizeof(configRegisterUnpacked[0]), i));
106105
RETURN_IF_ERROR_CODE(writeINA230Register(INA230_MASK_ENABLE_REGISTER_ADDR, maskEnRegisterUnpacked,
@@ -202,8 +201,8 @@ obc_error_code_t getINA230ShuntVoltage(ina230_device_t device, float* shuntVolta
202201
obc_error_code_t errCode;
203202

204203
// Read the 16-bit shunt voltage register
205-
errCode = i2cReadReg(ina230Devices[device].i2cDeviceAddress, INA230_SHUNT_VOLTAGE_REGISTER_ADDR,
206-
shuntVoltageRaw, 2, I2C_TRANSFER_TIMEOUT_TICKS);
204+
errCode = i2cReadReg(ina230Devices[device].i2cDeviceAddress, INA230_SHUNT_VOLTAGE_REGISTER_ADDR, shuntVoltageRaw, 2,
205+
I2C_TRANSFER_TIMEOUT_TICKS);
207206
if (errCode != OBC_ERR_CODE_SUCCESS) return errCode;
208207

209208
// Combine the two bytes into a 16-bit value
@@ -223,7 +222,7 @@ obc_error_code_t disableNoAlert(ina230_device_t device) {
223222
uint8_t pinLocation =
224223
ina230Devices[device].tcaEnablePort; // specific pin on TCA that this ina230 controls, should this be alertPort?
225224
uint8_t index = ((pinLocation & 0x0F) +
226-
((pinLocation >> 1) & 0x18)); // converts the pinLocation to an index in the 24 bit IOPortValue
225+
((pinLocation >> 1) & 0x18)); // converts the pinLocation to an index in the 24 bit IOPortValue
227226
// disbale
228227
uint8_t drivePort = INA230_DISABLE_LOAD;
229228
RETURN_IF_ERROR_CODE(driveTCA6424APinOutput(pinLocation, drivePort));
@@ -248,7 +247,7 @@ obc_error_code_t getINA230BusVoltage(ina230_device_t device, float* busVoltage)
248247
obc_error_code_t errCode;
249248
uint8_t busVoltageRaw[2] = {};
250249
RETURN_IF_ERROR_CODE(i2cReadReg(ina230Devices[device].i2cDeviceAddress, INA230_BUS_VOLTAGE_REGISTER_ADDR,
251-
busVoltageRaw, 2, I2C_TRANSFER_TIMEOUT_TICKS));
250+
busVoltageRaw, 2, I2C_TRANSFER_TIMEOUT_TICKS));
252251
uint16_t busVoltageValue = (busVoltageRaw[0] << 8) | busVoltageRaw[1];
253252
*busVoltage = busVoltageValue * INA230_BUS_VOLTAGE_LSB;
254253

@@ -272,8 +271,8 @@ obc_error_code_t getINA230Power(ina230_device_t device, float* power) {
272271
return OBC_ERR_CODE_INVALID_ARG;
273272
}
274273
uint8_t powerRaw[INA_REG_CONF_BUFF_SIZE] = {};
275-
RETURN_IF_ERROR_CODE(i2cReadReg(ina230Devices[device].i2cDeviceAddress, INA230_POWER_REGISTER_ADDR, powerRaw,
276-
2, I2C_TRANSFER_TIMEOUT_TICKS));
274+
RETURN_IF_ERROR_CODE(i2cReadReg(ina230Devices[device].i2cDeviceAddress, INA230_POWER_REGISTER_ADDR, powerRaw, 2,
275+
I2C_TRANSFER_TIMEOUT_TICKS));
277276
uint16_t powerValue = (powerRaw[0] << 8) | powerRaw[1];
278277
*power = powerValue * (INA230_CURRENT_LSB * INA230_POWER_LSB_MULTIPLIER);
279278
return OBC_ERR_CODE_SUCCESS;
@@ -297,8 +296,8 @@ obc_error_code_t getINA230Current(ina230_device_t device, float* current) {
297296
}
298297

299298
uint8_t currentRaw[INA_REG_CONF_BUFF_SIZE] = {};
300-
RETURN_IF_ERROR_CODE(i2cReadReg(ina230Devices[device].i2cDeviceAddress, INA230_CURRENT_REGISTER_ADDR,
301-
currentRaw, 2, I2C_TRANSFER_TIMEOUT_TICKS));
299+
RETURN_IF_ERROR_CODE(i2cReadReg(ina230Devices[device].i2cDeviceAddress, INA230_CURRENT_REGISTER_ADDR, currentRaw, 2,
300+
I2C_TRANSFER_TIMEOUT_TICKS));
302301
int16_t currentValue = (currentRaw[0] << 8) | currentRaw[1];
303302
*current = currentValue * INA230_CURRENT_LSB;
304303
return OBC_ERR_CODE_SUCCESS;

0 commit comments

Comments
 (0)