LPS22HBのライブラリ
Dependents: HYBRYD2018_IZU_ROCKET Hybrid_IZU201811_STMBBM_v4 Hybrid_IZU2019
Diff: pqLPS22HB_lib.h
- Revision:
- 1:42cd33e0f174
- Parent:
- 0:52880f880b81
- Child:
- 4:b5c758ebd064
--- a/pqLPS22HB_lib.h Mon Jun 26 08:16:14 2017 +0000 +++ b/pqLPS22HB_lib.h Thu Aug 10 21:00:39 2017 +0000 @@ -3,11 +3,6 @@ #include "mbed.h" -typedef enum{ - AD0_LOW = 0xB8, - AD0_HIGH = 0xBA -}AD0; - #define WHO_AM_I 0x0F #define CTRL_REG1 0x10 @@ -28,8 +23,14 @@ コンストラクタ ・AD0がHIGHかLOWかを選択 ・使用するI2Cを選択 + +ex) pqLPS22HB_lib myLPS22HB(pqLPS22HB_lib :: AD0_LOW, I2C); **********/ public: + typedef enum{ + AD0_LOW = 0xB8, + AD0_HIGH = 0xBA + }AD0; pqLPS22HB_lib(AD0 ad0, I2C &userI2C); private: char slave; @@ -84,6 +85,18 @@ private: char cmd_t[2]; int data_t[2]; + +/********** +高度を取得(float) +・引数に0m地点での気圧・温度を入れる +・計算式のソース:http://www.geocities.jp/u4ren6/Main/Excel_Data0017.html +**********/ + public: + float getAlt(float P_0, float T_0); + private: + float pres_0; + float temp_0; + float pres_now; }; #endif