PLANET-Q LPS22HB Library

Dependents:   IZU2020_AVIONICS qqq_izu_main_test IZU2020_AVIONICS Hybrid_OB2021_MAIN

PQLPS22HB.h

Committer:
tanahashi
Date:
2019-12-17
Revision:
0:9b51ce752415
Child:
1:e77331b61ce6

File content as of revision 0:9b51ce752415:

#ifndef PQLPS22HB_H
#define PQLPS22HB_H

#define LPS22HB_ADDR_HIGH 0b1011101<<1
#define LPS22HB_ADDR_LOW 0b1011100<<1
#define WHO_AM_I 0x0F
#define CTRL_REG1 0x10
#define PRESS_XL 0x28
#define TEMP_L 0x2B

typedef enum{
    SA0_HIGH = LPS22HB_ADDR_HIGH,
    SA0_LOW = LPS22HB_ADDR_LOW
}SA0_t;

class LPS22HB{
private:
    I2C *_i2c;
    int _addr;
    char cmd[2];
    char buff[6];
        
public:
    LPS22HB(I2C &i2c, SA0_t SA0);
    void begin();
    bool test();
    void read(float *press, float *temp);
    void read_press(float *press);
    void read_temp(float *temp);
};

#endif