C code and C++ library, driver software for Maxim Integrated DS1775, DS75 thermometer and thermostat temperature sensor. Code supports continuous or shut-down/standby, hysteresis, alarm limits, comparator or interrupt mode, fault filtering, and active low/high. Compact 5-pin SOT23 packaging

Dependents:   DS1775_Digital_Thermostat_Temperature

Revision:
17:ca86c0b37244
Parent:
16:1ecfc243d4ef
Child:
18:69436cb7b19e
--- a/ds1775_cpp.cpp	Mon Apr 08 00:14:08 2019 +0000
+++ b/ds1775_cpp.cpp	Mon Apr 08 02:36:00 2019 +0000
@@ -155,35 +155,25 @@
     }
 }
 
+
 /******************************************************************************/
-int DS1775::write_reg8(uint8_t value, char reg) 
+int DS1775::write_cfg_reg(uint8_t cfg)
 {
     int32_t ret;
     char cmd[2];
 
-    if (reg == DS1775_REG_CONFIGURATION) {
-        cmd[0] = reg;
-        cmd[1] = value;
-        ret = m_i2c.write(m_write_address, cmd, 2, false);
-        if (ret == 0) {
-            return DS1775_NO_ERROR;
-        } else {
-            printf("%s: I2C write error %d\r\n",__func__, ret);
-            return DS1775_ERROR;
-        }
+    cmd[0] = DS1775_REG_CONFIGURATION;
+    cmd[1] = cfg;
+    ret = m_i2c.write(m_write_address, cmd, 2, false);
+    if (ret == 0) {
+        return DS1775_NO_ERROR;
     } else {
-        printf("%s: register value invalid %x\r\n",__func__, reg);
+        printf("%s: I2C write error %d\r\n",__func__, ret);
         return DS1775_ERROR;
     }
 }
 
 /******************************************************************************/
-int DS1775::write_cfg_reg(uint8_t cfg)
-{
-    return write_reg8(cfg, DS1775_REG_CONFIGURATION);
-}
-
-/******************************************************************************/
 int DS1775::write_trip_low(float temperature)
 {
     ds1775_raw_data raw;