SHT31-DIS Library
Dependents: HYBRYD2018_IZU_ROCKET
Diff: SHT3x.h
- Revision:
- 2:e87793cb9185
- Child:
- 3:16d45bca7580
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SHT3x.h Sun Nov 19 13:16:35 2017 +0000 @@ -0,0 +1,55 @@ +#ifndef SHTx +#define SHTx + +#define SLV_ADDR_HIGH 0b10001010 +#define SLV_ADDR_LOW 0b10001000 + + + +//I2C i2c(PB_7, PB_6); // sda, scl +//Serial pc(USBTX, USBRX); //tx, rx + +/** +* @bref SHT31-DIS Class +* @author Seiya Maemura +*/ + + +class mySHT3x +{ +public: + + typedef enum AD0{ + AD0_HIGH = 1, + AD0_LOW = 0 + } AD0; + + mySHT3x(I2C &i2cBus, AD0 celect = AD0_HIGH); + + void heater_set(int i);//0ならヒーターOFF,1ならヒーターON + + void get_temp_hum(float *temp, float *hum); + + float get_temp();//二つまとめて受信するのと変わらない + + float get_hum();//上に同じ + + int get_state(); + + +private: + + I2C *i2c; + char _addr; + char SLV_WRITE; + char SLV_READ; + double temp,hum; + unsigned int val[4]; + char cmd[3],buff[4]; + + + +}; + +#endif + \ No newline at end of file