syscom project

Dependencies:   BLE_API mbed nRF51822

Fork of nRF51822_SimpleControls by RedBearLab

Committer:
mehdiham
Date:
Sun Jan 08 22:06:54 2017 +0000
Revision:
4:608e9604ca26
1

Who changed what in which revision?

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