summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-12-25 23:19:33 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-12-25 23:19:33 +0100
commitbf0e6a5eb0dd6ec9ebf1d4fb2cf2f804de946f44 (patch)
treedef9fe4886bf707160b47c88c1b39ed995eeed50
parentd11fc8116e7ccd2663ef911249fc7ecb3429b625 (diff)
lm75: overtemperature threshold and hysteresis are _signed_ 8bit ints
-rw-r--r--include/driver/lm75.h6
-rw-r--r--src/driver/lm75.cc6
2 files changed, 8 insertions, 4 deletions
diff --git a/include/driver/lm75.h b/include/driver/lm75.h
index 357be71..c1a9ddf 100644
--- a/include/driver/lm75.h
+++ b/include/driver/lm75.h
@@ -2,6 +2,8 @@
* Copyright 2020 Daniel Friesel
*
* SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Driver for LM75B Digital Temperature Sensor and Thermal Watchdog.
*/
#ifndef LM75_H
#define LM75_H
@@ -19,8 +21,8 @@ class LM75 {
float getTemp();
unsigned int getOS();
unsigned int getHyst();
- void setOS(unsigned char os);
- void setHyst(unsigned char hyst);
+ void setOS(signed char os);
+ void setHyst(signed char hyst);
void init();
void shutdown();
};
diff --git a/src/driver/lm75.cc b/src/driver/lm75.cc
index 3fd1483..8aab05d 100644
--- a/src/driver/lm75.cc
+++ b/src/driver/lm75.cc
@@ -2,6 +2,8 @@
* Copyright 2020 Daniel Friesel
*
* SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Driver for LM75B Digital Temperature Sensor and Thermal Watchdog.
*/
#include "driver/lm75.h"
#if defined(MULTIPASS_ARCH_HAS_I2C) && !defined(CONFIG_driver_softi2c)
@@ -40,7 +42,7 @@ unsigned int LM75::getHyst()
return rxbuf[0];
}
-void LM75::setOS(unsigned char os)
+void LM75::setOS(signed char os)
{
txbuf[0] = 0x03;
txbuf[1] = os;
@@ -48,7 +50,7 @@ void LM75::setOS(unsigned char os)
i2c.xmit(address, 3, txbuf, 0, rxbuf);
}
-void LM75::setHyst(unsigned char hyst)
+void LM75::setHyst(signed char hyst)
{
txbuf[0] = 0x02;
txbuf[1] = hyst;