ok
Diff: BMP085.h
- Revision:
- 0:b9870f4bc956
diff -r 000000000000 -r b9870f4bc956 BMP085.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BMP085.h Thu Jun 05 12:02:46 2014 +0000 @@ -0,0 +1,46 @@ +/* + * 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(); + long get_pressure(); + //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; + long pressure; + //float pressure; + +private: + + short ac1, ac2, ac3, b1, b2, mb, mc, md, oss; + unsigned short ac4, ac5, ac6; +}; + +#endif \ No newline at end of file