IMU-pressure-tempreture sensors

Dependencies:   CMSIS_DSP_401 DHT22 MPU9150_DMP QuaternionMath MODSERIAL mbed-src FATFileSystem111 SDFileSystem11 Camera_LS_Y201_CANSAT

Dependents:   combined_F

BMP085/BMP085.h

Committer:
Hagrass
Date:
2015-08-07
Revision:
0:5f608863559a

File content as of revision 0:5f608863559a:

/*
 * mbed library to use a Bosch Sensortec BMP085 sensor
 * Copyright (c) 2010 Hiroshi Suga
 * Released under the MIT License: http://mbed.org/license/mit
 */
 
#ifndef BMP085_H
#define BMP085_H

#include "mbed.h"

enum BMP085_oss {
    BMP085_oss1 = 0,
    BMP085_oss2 = 1,
    BMP085_oss4 = 2,
    BMP085_oss8 = 3
};

class BMP085
{
public:
    BMP085(PinName p_sda, PinName p_scl, BMP085_oss p_oss = BMP085_oss1);
    BMP085(I2C& p_i2c, BMP085_oss p_oss = BMP085_oss1);

    float get_temperature();
    float get_pressure();
    void update();
float calcAltitude(int pressure);
protected:
    void init(BMP085_oss);
    unsigned short twi_readshort (int, int);
    unsigned long twi_readlong (int, int);
    void twi_writechar (int, int, int);

    I2C i2c;
    float temperature;
    float pressure;

private:

    short ac1, ac2, ac3, b1, b2, mb, mc, md, oss;
    unsigned short ac4, ac5, ac6;
};

#endif