HDC1050 Library
HDC1050.h
- Committer:
- zebrin1422
- Date:
- 2018-05-02
- Revision:
- 4:daaadb8bc892
- Parent:
- 1:db08a3faa811
File content as of revision 4:daaadb8bc892:
#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);//詳細は.cppを参照 int Connection_check();//0が返ってくればOK,1ならばError void get_temp_hum(float *temp, float *hum);//同時にとる方が演算量は少ない float get_temp();//個別でデータが欲しい時はこちら float get_hum(); private: I2C *i2c; double temp,hum; unsigned int val[4]; char cmd[2][2],buff[4],reg,check[2]; }; #endif