diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-12-25 23:14:24 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-12-25 23:14:36 +0100 |
commit | d11fc8116e7ccd2663ef911249fc7ecb3429b625 (patch) | |
tree | ff9bf2e78b19f348e792ef0c65f0200d22197d2b /src/driver/lm75.cc | |
parent | 5d3d59ce58916084667b3b8d435e938ca3339b9f (diff) |
lm75: correctly read out sub-zero temperatures
Diffstat (limited to 'src/driver/lm75.cc')
-rw-r--r-- | src/driver/lm75.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/driver/lm75.cc b/src/driver/lm75.cc index 6c6c60a..3fd1483 100644 --- a/src/driver/lm75.cc +++ b/src/driver/lm75.cc @@ -10,6 +10,8 @@ #include "driver/soft_i2c.h" #endif +#include <stdint.h> + float LM75::getTemp() { txbuf[0] = 0; @@ -17,7 +19,7 @@ float LM75::getTemp() rxbuf[1] = 0; i2c.xmit(address, 1, txbuf, 2, rxbuf); - return rxbuf[0] + (rxbuf[1] / 256.0); + return (int8_t)rxbuf[0] + (rxbuf[1] / 256.0); } unsigned int LM75::getOS() |