I2C 接続の温度センサ ADT7410 用のライブラリ. Library for temperature sensor ADT7410 connected using I2C interface.

Dependents:   Mbed2_ConnectTestAll Demo_ADT7410

Revision:
2:c134a43c7875
Parent:
1:ad3046485a3e
Child:
4:3769397d3803
--- a/ADT7410.cpp	Mon Jun 15 07:26:05 2015 +0000
+++ b/ADT7410.cpp	Mon Jun 15 09:18:19 2015 +0000
@@ -1,5 +1,6 @@
 //--------------------------------------------------------------
 //  Class for using ADT7410
+//      Default: 13-bit resolution
 //  2015/06/15, Copyright (c) 2015 MIKAMI, Naoki
 //--------------------------------------------------------------
 
@@ -44,8 +45,8 @@
         i2c_.read(addr_, rReg, 2);
 
         int16_t value = (rReg[0] << 8) | rReg[1];
-        if ( (GetConfig() & 0x80) != 0x80 )
-            value &= 0xfff8;        // 13-bit resolution
+        if ( (GetConfig() & 0x80) == 0x00 )
+            value &= 0xfff8;        // For 13-bit resolution
 
         return value/128.0f;
     }
@@ -56,8 +57,6 @@
     {
         WriteSingleByte(RESET_);
         wait_ms(250);
+        SetConfig(0x00);
     }
 }
-
-
-