aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGergő J. Miklós2020-11-22 04:04:03 +0100
committerGergő J. Miklós2020-11-22 04:04:03 +0100
commitea1f6adc8e47e2408fda07bbec595daeb1d3f402 (patch)
treed5e22c2993b336caccce38f6c04b45647c28b948
parent47bda328c70858c3b61cddf8e1398ce7ab0ff700 (diff)
downloadi2sensors-master.tar.gz
i2sensors-master.zip
-rw-r--r--src/lm75.c3
-rw-r--r--src/main.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/lm75.c b/src/lm75.c
index 83e74c3..95204af 100644
--- a/src/lm75.c
+++ b/src/lm75.c
@@ -59,7 +59,8 @@ static float calc_temp(float offset){ // Calculate temperature
uint16 rawtemp = 0; //# Signed by default
float temp;
- buf[0] = 0x00; //# Measurement in the REG[0]
+ buf[0] = 0x00;
+ buf[1] = 0x00; //# Measurement in the REG[0]
xchg_data(buf,1,0,2); //# Write: 1byte addr, Read: 2byte data, Wait:0, [buf] = 32 byte
rawtemp = (buf[0]*256 + buf[1]) >> 5; //# /x*256 == x << 8/ (>> 5): Temp is 11bit data register
diff --git a/src/main.c b/src/main.c
index af37eb3..e4bd464 100644
--- a/src/main.c
+++ b/src/main.c
@@ -173,7 +173,7 @@ int main( int argc, char *argv[] ){
addr = (long)strtol(argv[4], NULL, 0); //# strtol() is working with hex-string correctly
- if (ioctl(devicef, I2C_SLAVE_FORCE, addr) < 0){ //# Seeking/Opening the device on the Bus
+ if (ioctl(devicef, I2C_SLAVE, addr) < 0){ //I2C_SLAVE_FORCE //# Seeking/Opening the device on the Bus
//printf("\n\tCan't open i2c DEVICE, errno: %d\n\n",errno);
fprintf (stderr, "\n\tCan't open i2c DEVICE! [ERR: %d, MSG: %s] at %s, line %d. \n", errno, strerror(errno), __FILE__, __LINE__);
close(devicef);