sensors: Add separation between ambient and die temperature

Some device include a temperature sensor, usually used as a
companion for helping in drift compensation, that measure the
die temperature. This temperature IS NOT related to the the
ambient temperature, hence a clean separation between the two
is required.

This commit introduces a clean separation between the two
types of temperature leaving the old deprecated definition
still there.

The list of current drivers that read the die (and not the ambient)
temperature is the following:

 - adxl362
 - bma280
 - bmg160
 - bmi160
 - fxos8700
 - lis3mdl
 - lsm6ds0
 - lsm6dsl
 - lsm9ds0
 - mpu6050

Signed-off-by: Armando Visconti <armando.visconti@st.com>
This commit is contained in:
Armando Visconti 2018-03-23 09:41:09 +01:00 committed by Anas Nashif
commit 87d6c50e47
42 changed files with 70 additions and 66 deletions

View file

@ -81,7 +81,7 @@ static int tmp112_attr_set(struct device *dev,
s64_t value;
u16_t cr;
if (chan != SENSOR_CHAN_TEMP) {
if (chan != SENSOR_CHAN_AMBIENT_TEMP) {
return -ENOTSUP;
}
@ -153,7 +153,7 @@ static int tmp112_sample_fetch(struct device *dev, enum sensor_channel chan)
struct tmp112_data *drv_data = dev->driver_data;
u16_t val;
__ASSERT_NO_MSG(chan == SENSOR_CHAN_ALL || chan == SENSOR_CHAN_TEMP);
__ASSERT_NO_MSG(chan == SENSOR_CHAN_ALL || chan == SENSOR_CHAN_AMBIENT_TEMP);
if (tmp112_reg_read(drv_data, TMP112_REG_TEMPERATURE, &val) < 0) {
return -EIO;
@ -175,7 +175,7 @@ static int tmp112_channel_get(struct device *dev,
struct tmp112_data *drv_data = dev->driver_data;
s32_t uval;
if (chan != SENSOR_CHAN_TEMP) {
if (chan != SENSOR_CHAN_AMBIENT_TEMP) {
return -ENOTSUP;
}