Digital Humidity Sensor with Temperature Sensor by TI. Default address sets Akizuki kit module.

Dependents:   AmbientExampleLPC1768 HumidifierController_LPC824 TYBLE16_mbedlized_Thermometer

Files at this revision

API Documentation at this revision

Comitter:
kenjiArai
Date:
Tue Aug 22 10:11:30 2017 +0000
Parent:
0:927110422689
Commit message:
countermeasure for NonCopyable

Changed in this revision

HDC1000.cpp Show annotated file Show diff for this revision Revisions of this file
HDC1000.h Show annotated file Show diff for this revision Revisions of this file
diff -r 927110422689 -r c8f2c01befe1 HDC1000.cpp
--- a/HDC1000.cpp	Sun Feb 22 01:04:44 2015 +0000
+++ b/HDC1000.cpp	Tue Aug 22 10:11:30 2017 +0000
@@ -3,28 +3,24 @@
  *  Low Power, High Accuracy Digital Humidity Sensor with Integrated Temperature Sensor
  *  HDC1000 Texas Instruments
  *
- * Copyright (c) 2015 Kenji Arai / JH1PJL
+ * Copyright (c) 2015,'17 Kenji Arai / JH1PJL
  *  http://www.page.sannet.ne.jp/kenjia/index.html
  *  http://mbed.org/users/kenjiArai/
  *      Created: Feburary   9th, 2015
- *      Revised: Feburary  22nd, 2015
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
- * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *      Revised: AAugust   21st, 2017
  */
 
 #include "HDC1000.h"
 
-HDC1000::HDC1000 (PinName p_sda, PinName p_scl) : _i2c(p_sda, p_scl)
+HDC1000::HDC1000 (PinName p_sda, PinName p_scl) :
+ _i2c_p(new I2C(p_sda, p_scl)), _i2c(*_i2c_p)
 {
     HDC1000_addr = HDC1000ADDR;
     init();
 }
 
-HDC1000::HDC1000 (PinName p_sda, PinName p_scl, uint8_t addr) : _i2c(p_sda, p_scl)
+HDC1000::HDC1000 (PinName p_sda, PinName p_scl, uint8_t addr) :
+ _i2c_p(new I2C(p_sda, p_scl)), _i2c(*_i2c_p)
 {
     HDC1000_addr = addr;
     init();
diff -r 927110422689 -r c8f2c01befe1 HDC1000.h
--- a/HDC1000.h	Sun Feb 22 01:04:44 2015 +0000
+++ b/HDC1000.h	Tue Aug 22 10:11:30 2017 +0000
@@ -3,22 +3,16 @@
  *  Low Power, High Accuracy Digital Humidity Sensor with Integrated Temperature Sensor
  *  HDC1000 Texas Instruments
  *
- * Copyright (c) 2015 Kenji Arai / JH1PJL
+ * Copyright (c) 2015,'17 Kenji Arai / JH1PJL
  *  http://www.page.sannet.ne.jp/kenjia/index.html
  *  http://mbed.org/users/kenjiArai/
  *      Created: Feburary   9th, 2015
- *      Revised: Feburary  22nd, 2015
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
- * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *      Revised: AAugust   21st, 2017
  */
 /*
  *---------------- REFERENCE ----------------------------------------------------------------------
  *  http://www.ti.com/product/HDC1000/description
- *  http://akizukidenshi.com/catalog/g/gM-08775/
+ *  http://akizukidenshi.com/catalog/g/gM-08775/ (Not avairable now)
  */
 
 #ifndef HDC1000_H
@@ -83,10 +77,15 @@
 class HDC1000
 {
 public:
-    /** Configure data pin
+    /** Configure data pin (with other devices on I2C line)
       * @param data SDA and SCL pins
       */
     HDC1000(PinName p_sda, PinName p_scl);
+
+    /** Configure data pin (with other devices on I2C line)
+      * @param data SDA and SCL pins
+      * @param device address
+      */
     HDC1000(PinName p_sda, PinName p_scl, uint8_t addr);
 
     /** Configure data pin (with other devices on I2C line)
@@ -156,7 +155,8 @@
     uint16_t read_D_ID(void);
 
 protected:
-    I2C  _i2c;
+    I2C *_i2c_p;
+    I2C &_i2c;
 
     void get_IDs(void);
     void init(void);