conf->last_accessed_register = TMP_REG_TEMPERATURE;
}
- if (ret == 2) {
- if (raw != NULL) {
- *raw = byte_swap_16(temp);
- }
- if (deci_degrees != NULL) {
- *deci_degrees = tmp101_convert_to_deci_degrees(byte_swap_16(temp));
- }
- return 0;
+ if (ret != 2) {
+ conf->probe_ok = 0;
+ return ret;
}
- return ret;
+
+ if (raw != NULL) {
+ *raw = byte_swap_16(temp);
+ }
+ if (deci_degrees != NULL) {
+ *deci_degrees = tmp101_convert_to_deci_degrees(byte_swap_16(temp));
+ }
+ return 0;
}
msleep(1);
ret = i2c_write(conf->bus_num, cmd, 3, NULL);
conf->last_accessed_register = TMP_REG_CONFIG;
- if (ret == 3) {
- return 0; /* Config success */
+ if (ret != 3) {
+ conf->probe_ok = 0;
+ return ret;
}
- return ret;
+ return 0; /* Config success */
}
/* Start a conversion when the sensor is in shutdown mode. */
cmd[2] |= TMP_ONE_SHOT_TRIGGER;
ret = i2c_write(conf->bus_num, cmd, 3, NULL);
conf->last_accessed_register = TMP_REG_CONFIG;
- if (ret == 3) {
- return 0; /* Conversion start success */
+ if (ret != 3) {
+ conf->probe_ok = 0;
+ return ret;
}
- return ret;
+ return 0; /* Conversion start success */
}
}
ret = i2c_read(conf->bus_num, cmd_buf, ID_BUF_SIZE, ctrl_buf, &id, 1);
if (ret != 1) {
+ conf->probe_ok = 0;
return ret;
}
return id;
ret = i2c_read(conf->bus_num, cmd_buf, READ_BUF_SIZE, ctrl_buf, data, 4);
if (ret != 4) {
+ conf->probe_ok = 0;
return ret;
}
comb_raw = (data[0] & 0xFF) | ((data[1] << 8) & 0xFF00);
}
ret = i2c_write(conf->bus_num, cmd_buf, CONF_BUF_SIZE, NULL);
if (ret != CONF_BUF_SIZE) {
+ conf->probe_ok = 0;
return -EIO;
}
return 0;
cmd_buf = ((conf->addr + 2) | I2C_READ_BIT);
ret = i2c_read(conf->bus_num, &cmd_buf, 1, NULL, &data, 1);
if (ret != 1) {
+ conf->probe_ok = 0;
return ret;
}
*uv_raw = ((uint16_t)data << 8) & 0xFF00;
cmd_buf = (conf->addr | I2C_READ_BIT);
ret = i2c_read(conf->bus_num, &cmd_buf, 1, NULL, &data, 1);
if (ret != 1) {
+ conf->probe_ok = 0;
return ret;
}
*uv_raw |= (uint16_t)data & 0x00FF;
msleep(1);
ret = i2c_write(conf->bus_num, cmd_buf, CONF_BUF_SIZE, NULL);
if (ret != CONF_BUF_SIZE) {
+ conf->probe_ok = 0;
return -EIO;
}
return 0;