Bosh pressure sensor

Dependencies:   mbed

Fork of BMP085 by Suga koubou

BMP085.h

Committer:
jose_claudiojr
Date:
2013-06-12
Revision:
2:dee533027e61
Parent:
1:80e4c62baf09

File content as of revision 2:dee533027e61:

#ifndef BMP085_H
#define BMP085_H

#include "mbed.h"

enum BMP085_oss {
    BMP085_oss1 = 0, ///< ultra low power (1 time)
    BMP085_oss2 = 1, ///< standard (2 times)
    BMP085_oss4 = 2, ///< high resolution (4 times)
    BMP085_oss8 = 3  ///< ultra high resolution (8 times)
};

class BMP085
{
public:
    BMP085(PinName sda, PinName scl, BMP085_oss p_oss = BMP085_oss1);

    float get_temperature();
    float get_pressure();
    void update();

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