BMP180 is a digital barometric pressure sensor made by Bosch Sensortec (I2C Interface)

Dependents:   LPC1114_data_logger ProjectIOT Wether_Meter LPC1114_barometer_with_data_logging

Revision:
0:9c1a7a1f0d97
Child:
1:23942d7b7023
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BMP180.h	Sun Jun 15 03:28:26 2014 +0000
@@ -0,0 +1,56 @@
+/*
+ * mbed library program 
+ *  Control BMP180(Bosch) Pressure Sensor
+ *
+ * Copyright (c) 2014 Kenji Arai / JH1PJL
+ *  http://www.page.sannet.ne.jp/kenjia/index.html
+ *  http://mbed.org/users/kenjiArai/
+ *      Created: August    14th, 2013   for STM32L152 
+ *      Changed: May       21st, 2014   mbed LPC1114
+ *      Revised: June      14th, 2014
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
+ * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef BMP180_H
+#define BMP180_H
+
+#include "mbed.h"
+
+class BMP180 {
+public:
+    BMP180(PinName p_sda, PinName p_scl);
+    BMP180(I2C& p_i2c);
+
+    float read_temperature();
+    float read_pressure();
+    uint8_t read_baro_id();
+    void normalize();
+
+protected:
+    void init(void);
+    void i2c_read_n_bytes(int, char*, int);
+    void i2c_write_n_bytes(int, char*, int);
+
+    I2C i2c;
+    float temperature;
+    float pressure;
+    uint8_t id_number;
+
+private:
+    //  save EEPROM Data (Coefficient data)
+    int16_t  eep_ac1, eep_ac2, eep_ac3;
+    uint16_t eep_ac4, eep_ac5, eep_ac6;
+    int16_t  eep_b1,  eep_b2,  eep_mb;     // eep_mb:not use
+    int16_t  eep_mc,  eep_md;
+    // temporary save
+    char     baro_dt[4];
+    //  address
+    char BMP180_addr;
+};
+
+#endif // BMP180_H
\ No newline at end of file