SHT31-DIS Library

Dependents:   HYBRYD2018_IZU_ROCKET

SHT3x.h

Committer:
Sigma884
Date:
2018-11-14
Revision:
4:9a5de0485008
Parent:
3:16d45bca7580

File content as of revision 4:9a5de0485008:

#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_SHT;
        char SLV_READ_SHT;
        double temp,hum;
        unsigned int val[4];
        char cmd[3],buff[4];

        
        
};

#endif