diff --git a/drivers/sensor/tmp116/tmp116.c b/drivers/sensor/tmp116/tmp116.c index 01a15caab0d..7849cfacca4 100644 --- a/drivers/sensor/tmp116/tmp116.c +++ b/drivers/sensor/tmp116/tmp116.c @@ -51,7 +51,7 @@ static inline int tmp116_device_id_check(struct device *dev) return -EIO; } - if (value != TMP116_DEVICE_ID) { + if ((value != TMP116_DEVICE_ID) && (value != TMP117_DEVICE_ID)) { LOG_ERR("%s: Failed to match the device IDs!", DT_INST_0_TI_TMP116_LABEL); return -EINVAL; @@ -100,9 +100,9 @@ static int tmp116_channel_get(struct device *dev, enum sensor_channel chan, * See datasheet "Temperature Results and Limits" section for more * details on processing sample data. */ - tmp = (s32_t)drv_data->sample * TMP116_RESOLUTION; - val->val1 = tmp / 10000000; /* Tens of uCelsius */ - val->val2 = tmp % 10000000; + tmp = ((s16_t)drv_data->sample * (s32_t)TMP116_RESOLUTION) / 10; + val->val1 = tmp / 1000000; /* uCelsius */ + val->val2 = tmp % 1000000; return 0; } diff --git a/drivers/sensor/tmp116/tmp116.h b/drivers/sensor/tmp116/tmp116.h index 0c8107bbbdb..da6acdc10e7 100644 --- a/drivers/sensor/tmp116/tmp116.h +++ b/drivers/sensor/tmp116/tmp116.h @@ -22,6 +22,7 @@ #define TMP116_RESOLUTION_DIV 10000000 #define TMP116_DEVICE_ID 0x1116 +#define TMP117_DEVICE_ID 0x0117 struct tmp116_data { struct device *i2c;