From 47e2d82e045f89c5384ff7878cf982eb4ec44744 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 23 Jul 2019 03:17:08 -0400 Subject: [PATCH] fixed x_fd in function call --- afsk/main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index f668b8a6..9837a8a2 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -143,14 +143,14 @@ struct SensorData read_sensor_data(struct SensorConfig sensor) { return data; } - wiringPiI2CWriteReg16(x_fd, INA219_REG_CALIBRATION, sensor.calValue); - wiringPiI2CWriteReg16(x_fd, INA219_REG_CONFIG, sensor.config); - wiringPiI2CWriteReg16(x_fd, INA219_REG_CALIBRATION, sensor.calValue); - data.current = wiringPiI2CReadReg16(x_fd, INA219_REG_CURRENT) / sensor.currentDivider; + wiringPiI2CWriteReg16(sensor.fd, INA219_REG_CALIBRATION, sensor.calValue); + wiringPiI2CWriteReg16(sensor.fd, INA219_REG_CONFIG, sensor.config); + wiringPiI2CWriteReg16(sensor.fd, INA219_REG_CALIBRATION, sensor.calValue); + data.current = wiringPiI2CReadReg16(sensor.fd, INA219_REG_CURRENT) / sensor.currentDivider; #ifdef DEBUG_LOGGING - value = (uint16_t)wireReadRegister(x_fd, INA219_REG_BUSVOLTAGE); + uint16_t value = (uint16_t)wireReadRegister(sensor.fd, INA219_REG_BUSVOLTAGE); data.voltage = ((double)(value >> 3) * 4) / 1000; - data.power = wiringPiI2CReadReg16(x_fd, INA219_REG_POWER) * sensor.powerMultiplier; + data.power = wiringPiI2CReadReg16(sensor.fd, INA219_REG_POWER) * sensor.powerMultiplier; #endif return data;