HDC1050 Library

Revision:
0:771ed287f6a8
Child:
1:db08a3faa811
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HDC1050.h	Sat Jul 08 17:56:35 2017 +0000
@@ -0,0 +1,65 @@
+#ifndef HDC1050
+#define HDC1050
+
+#define SLV_WRITE           0b10000000
+#define SLV_READ            0b10000001
+
+#define check_reg           0xFF
+#define Ctrl_reg            0x02
+#define Temperature_reg     0x00
+#define Humidity_reg        0x01
+
+//I2C i2c(PB_7, PB_6);    // sda, scl
+//Serial pc(USBTX, USBRX); //tx, rx
+
+/**
+*  @bref  HDC1050 Class
+*  @author Seiya Maemura
+*/
+
+/*
+温度の値は信頼出来るが湿度の値は全く信用できない
+注意されたし
+※少なくとも試験用に使ったモジュールでは
+*/
+
+
+
+class myHDC1050
+{
+public:
+
+
+        myHDC1050(I2C &i2cBus);
+        
+        void setup(int i);//使わない
+        
+        int Connection_check();//0が返ってくればOK,1ならばError
+        
+        void get_temp_hum(float *temp, float *hum);
+        
+        void get_temp(float *temp);//個別でデータが欲しい時はこちら
+        
+        void get_hum(float *hum);
+        
+        void get_temp_heater(float *temp);
+
+        
+private: 
+
+        I2C *i2c;
+        double temp,hum;
+        unsigned int val[4];
+        char cmd[2][2],buff[4],reg,check[2];
+
+        
+        
+};
+
+#endif
+        
+    
+    
+    
+    
+    
\ No newline at end of file