ok

Fork of myBMP085 by Taijun Kozarashi

Committer:
stepJun
Date:
Thu Jun 05 12:02:46 2014 +0000
Revision:
0:b9870f4bc956
ok

Who changed what in which revision?

UserRevisionLine numberNew contents of line
stepJun 0:b9870f4bc956 1 /*
stepJun 0:b9870f4bc956 2 * mbed library to use a Bosch Sensortec BMP085 sensor
stepJun 0:b9870f4bc956 3 * Copyright (c) 2010 Hiroshi Suga
stepJun 0:b9870f4bc956 4 * Released under the MIT License: http://mbed.org/license/mit
stepJun 0:b9870f4bc956 5 */
stepJun 0:b9870f4bc956 6
stepJun 0:b9870f4bc956 7 #ifndef BMP085_H
stepJun 0:b9870f4bc956 8 #define BMP085_H
stepJun 0:b9870f4bc956 9
stepJun 0:b9870f4bc956 10 #include "mbed.h"
stepJun 0:b9870f4bc956 11
stepJun 0:b9870f4bc956 12 enum BMP085_oss {
stepJun 0:b9870f4bc956 13 BMP085_oss1 = 0,
stepJun 0:b9870f4bc956 14 BMP085_oss2 = 1,
stepJun 0:b9870f4bc956 15 BMP085_oss4 = 2,
stepJun 0:b9870f4bc956 16 BMP085_oss8 = 3
stepJun 0:b9870f4bc956 17 };
stepJun 0:b9870f4bc956 18
stepJun 0:b9870f4bc956 19 class BMP085{
stepJun 0:b9870f4bc956 20 public:
stepJun 0:b9870f4bc956 21 BMP085(PinName p_sda, PinName p_scl, BMP085_oss p_oss = BMP085_oss1);
stepJun 0:b9870f4bc956 22 BMP085(I2C& p_i2c, BMP085_oss p_oss = BMP085_oss1);
stepJun 0:b9870f4bc956 23
stepJun 0:b9870f4bc956 24 float get_temperature();
stepJun 0:b9870f4bc956 25 long get_pressure();
stepJun 0:b9870f4bc956 26 //float get_pressure();
stepJun 0:b9870f4bc956 27 void update();
stepJun 0:b9870f4bc956 28
stepJun 0:b9870f4bc956 29 protected:
stepJun 0:b9870f4bc956 30 void init(BMP085_oss);
stepJun 0:b9870f4bc956 31 unsigned short twi_readshort (int, int);
stepJun 0:b9870f4bc956 32 unsigned long twi_readlong (int, int);
stepJun 0:b9870f4bc956 33 void twi_writechar (int, int, int);
stepJun 0:b9870f4bc956 34
stepJun 0:b9870f4bc956 35 I2C i2c;
stepJun 0:b9870f4bc956 36 float temperature;
stepJun 0:b9870f4bc956 37 long pressure;
stepJun 0:b9870f4bc956 38 //float pressure;
stepJun 0:b9870f4bc956 39
stepJun 0:b9870f4bc956 40 private:
stepJun 0:b9870f4bc956 41
stepJun 0:b9870f4bc956 42 short ac1, ac2, ac3, b1, b2, mb, mc, md, oss;
stepJun 0:b9870f4bc956 43 unsigned short ac4, ac5, ac6;
stepJun 0:b9870f4bc956 44 };
stepJun 0:b9870f4bc956 45
stepJun 0:b9870f4bc956 46 #endif