ADS1015 library

Dependents:   s-rov-firmware

Files at this revision

API Documentation at this revision

Comitter:
YJ_Kim
Date:
Thu Jan 26 18:02:32 2017 +0000
Parent:
1:fa7b90993eb3
Commit message:
fix bug

Changed in this revision

ads1015.cpp Show annotated file Show diff for this revision Revisions of this file
ads1015.h Show annotated file Show diff for this revision Revisions of this file
--- a/ads1015.cpp	Thu Jan 26 17:31:08 2017 +0000
+++ b/ads1015.cpp	Thu Jan 26 18:02:32 2017 +0000
@@ -13,7 +13,7 @@
     uint16_t config = ADS1015_CONFIG_COMP_QUE_NONE    | // disable comparator
                       ADS1015_CONFIG_COMP_LAT_NONE    | // nonlatching comparator
                       ADS1015_CONFIG_COMP_POL_ACTVLOW | // Alert/Rdy active low
-                      CONFIG_COMP_MODE_TRAD           | // Traditional comparator
+                      ADS1015_CONFIG_COMP_MODE_TRAD           | // Traditional comparator
                       ADS1015_CONFIG_DR_1600SPS       | // Data rate : 1600sps
                       ADS1015_CONFIG_MODE_SINGLE      | // Single shot mode
                       m_gain;                           // Set gain
@@ -54,5 +54,5 @@
     cmd[0] = reg;
     i2c->write(ADS1015_ADDR, cmd, 1);
     i2c->read(ADS1015_ADDR, cmd, 2);
-    return (data[0] << 8 | data[1]);    
+    return (cmd[0] << 8 | cmd[1]);    
 }
\ No newline at end of file
--- a/ads1015.h	Thu Jan 26 17:31:08 2017 +0000
+++ b/ads1015.h	Thu Jan 26 18:02:32 2017 +0000
@@ -82,8 +82,8 @@
     
     private:
         uint8_t ADS1015_ADDR;
+        I2C* i2c;
         uint16_t m_gain;
-        I2C* i2c;
-}
+};
 
 #endif
\ No newline at end of file