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:
parent
22399c327e
commit
87d6c50e47
42 changed files with 70 additions and 66 deletions
|
@ -162,7 +162,7 @@ static int dht_channel_get(struct device *dev,
|
|||
{
|
||||
struct dht_data *drv_data = dev->driver_data;
|
||||
|
||||
__ASSERT_NO_MSG(chan == SENSOR_CHAN_TEMP || chan == SENSOR_CHAN_HUMIDITY);
|
||||
__ASSERT_NO_MSG(chan == SENSOR_CHAN_AMBIENT_TEMP || chan == SENSOR_CHAN_HUMIDITY);
|
||||
|
||||
/* see data calculation example from datasheet */
|
||||
#if defined(CONFIG_DHT_CHIP_DHT11)
|
||||
|
@ -170,7 +170,7 @@ static int dht_channel_get(struct device *dev,
|
|||
if (chan == SENSOR_CHAN_HUMIDITY) {
|
||||
val->val1 = drv_data->sample[0];
|
||||
val->val2 = 0;
|
||||
} else { /* chan == SENSOR_CHAN_TEMP */
|
||||
} else { /* chan == SENSOR_CHAN_AMBIENT_TEMP */
|
||||
val->val1 = drv_data->sample[2];
|
||||
val->val2 = 0;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ static int dht_channel_get(struct device *dev,
|
|||
raw_val = (drv_data->sample[0] << 8) | drv_data->sample[1];
|
||||
val->val1 = raw_val / 10;
|
||||
val->val2 = (raw_val % 10) * 100000;
|
||||
} else { /* chan == SENSOR_CHAN_TEMP */
|
||||
} else { /* chan == SENSOR_CHAN_AMBIENT_TEMP */
|
||||
raw_val = (drv_data->sample[2] << 8) | drv_data->sample[3];
|
||||
|
||||
sign = raw_val & 0x8000;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue