PLANET-Q LPS22HB Library
Dependents: IZU2020_AVIONICS qqq_izu_main_test IZU2020_AVIONICS Hybrid_OB2021_MAIN
Diff: PQLPS22HB.h
- Revision:
- 0:9b51ce752415
- Child:
- 1:e77331b61ce6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PQLPS22HB.h Tue Dec 17 09:11:42 2019 +0000 @@ -0,0 +1,32 @@ +#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 \ No newline at end of file