Skip to content

Commit 75cac17

Browse files
aviscontiChromeos LUCI
authored and
Chromeos LUCI
committed
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 zephyrproject-rtos#75686 (cherry picked from commit a1f9793) Original-Signed-off-by: Armando Visconti <[email protected]> GitOrigin-RevId: a1f9793 Change-Id: Ic4592a023d021d46a3b7e36e795f61cee4082068 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5745016 Commit-Queue: Fabio Baltieri <[email protected]> Reviewed-by: Fabio Baltieri <[email protected]> Tested-by: ChromeOS Prod (Robot) <[email protected]>
1 parent 015ccda commit 75cac17

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)