drivers/sensor: iis2mdc: Fix the temperature in celsius

Fix the formula to translate raw temperature read from
register to Celsius.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
This commit is contained in:
Armando Visconti 2020-10-06 17:15:12 +02:00 committed by Maureen Helm
commit 4250028483

View file

@ -205,7 +205,7 @@ static int iis2mdc_sample_fetch_temp(const struct device *dev)
}
/* formula is temp = 25 + (temp / 8) C */
temp = (sys_le16_to_cpu(raw_temp.i16bit) & 0x8FFF);
temp = sys_le16_to_cpu(raw_temp.i16bit);
iis2mdc->temp_sample = 2500 + (temp * 100) / 8;
return 0;