driver: sensor: adxl367: Temp conversion
Fix for conversion of temperature values in adxl367_temp_convert and missing break statement. Signed-off-by: Vladislav Pejic <vladislav.pejic@orioninc.com>
This commit is contained in:
parent
eb15f306b6
commit
19fe816f28
1 changed files with 4 additions and 3 deletions
|
@ -903,10 +903,10 @@ void adxl367_temp_convert(struct sensor_value *val, int16_t value)
|
|||
static void adxl367_temp_convert(struct sensor_value *val, int16_t value)
|
||||
#endif /*CONFIG_SENSOR_ASYNC_API*/
|
||||
{
|
||||
int64_t temp_data = (value + ADXL367_TEMP_OFFSET) * ADXL367_TEMP_SCALE;
|
||||
int64_t temp_data = (value - ADXL367_TEMP_25C);
|
||||
|
||||
val->val1 = temp_data / ADXL367_TEMP_SCALE_DIV;
|
||||
val->val2 = temp_data % ADXL367_TEMP_SCALE_DIV;
|
||||
val->val1 = temp_data / 54 /*temp sensitivity LSB/C*/ + 25/*bias test conditions*/;
|
||||
val->val2 = temp_data % 54 * 10000;
|
||||
}
|
||||
|
||||
static int adxl367_channel_get(const struct device *dev,
|
||||
|
@ -932,6 +932,7 @@ static int adxl367_channel_get(const struct device *dev,
|
|||
break;
|
||||
case SENSOR_CHAN_DIE_TEMP:
|
||||
adxl367_temp_convert(val, data->temp_val);
|
||||
break;
|
||||
default:
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue