From 32385b29109592a7eb4c2b61b6b79f677a4bdb90 Mon Sep 17 00:00:00 2001 From: Antonio Lignan Date: Wed, 24 Aug 2016 16:34:02 +0200 Subject: [PATCH] Zoul: fix TMP102 value conversion --- platform/zoul/dev/tmp102.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/zoul/dev/tmp102.c b/platform/zoul/dev/tmp102.c index 2d3e897e2..4b2de59b0 100644 --- a/platform/zoul/dev/tmp102.c +++ b/platform/zoul/dev/tmp102.c @@ -58,7 +58,8 @@ tmp102_read(uint16_t *data) if(i2c_single_send(TMP102_ADDR, TMP102_TEMP) == I2C_MASTER_ERR_NONE) { /* Read two bytes only */ if(i2c_burst_receive(TMP102_ADDR, buf, 2) == I2C_MASTER_ERR_NONE) { - temp = (buf[0] << 8) + buf[1]; + /* 12-bit value, TMP102 SBOS397F Table 8-9 */ + temp = (buf[0] << 4) + (buf[1] >> 4); if(temp > 2047) { temp -= (1 << 12); }