Skip to content

Commit ee6c008

Browse files
aviscontinashif
authored andcommitted
drivers/sensor: lis2dux12: fix temperature conversion
Return to sensor_api i/f the temperature in Celsius instead of the register raw value in LSB. Fixes #75686 Signed-off-by: Armando Visconti <[email protected]> (cherry picked from commit a1f9793)
1 parent a6cbc32 commit ee6c008

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

drivers/sensor/st/lis2dux12/lis2dux12.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ static int lis2dux12_sample_fetch_temp(const struct device *dev)
221221
return -EIO;
222222
}
223223

224-
data->sample_temp = sys_le16_to_cpu(temp_data.heat.raw);
224+
data->sample_temp = sys_le16_to_cpu(temp_data.heat.deg_c);
225225

226226
return 0;
227227
}
@@ -282,7 +282,7 @@ static inline int lis2dux12_get_channel(enum sensor_channel chan, struct sensor_
282282
break;
283283
#if defined(CONFIG_LIS2DUX12_ENABLE_TEMP)
284284
case SENSOR_CHAN_DIE_TEMP:
285-
sensor_value_from_double(val, data->sample_temp);
285+
sensor_value_from_float(val, data->sample_temp);
286286
break;
287287
#endif
288288
default:

drivers/sensor/st/lis2dux12/lis2dux12.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct lis2dux12_data {
5555
uint8_t odr;
5656

5757
#ifdef CONFIG_LIS2DUX12_ENABLE_TEMP
58-
int sample_temp;
58+
float sample_temp;
5959
#endif
6060

6161
#ifdef CONFIG_LIS2DUX12_TRIGGER

0 commit comments

Comments
 (0)