Modified to run on Renesas GR Peach board

Dependencies:   EthernetInterface HTTP-Server Webpage mbed-rpc mbed-src

Fork of HTTPServer_echoback by Takuya Urakawa

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Adafruit_BMP085_U.h Source File

Adafruit_BMP085_U.h

00001 /***************************************************************************
00002   This is a library for the BMP085 pressure sensor
00003 
00004   Designed specifically to work with the Adafruit BMP085 or BMP180 Breakout 
00005   ----> http://www.adafruit.com/products/391
00006   ----> http://www.adafruit.com/products/1603
00007 
00008   These displays use I2C to communicate, 2 pins are required to interface.
00009 
00010   Adafruit invests time and resources providing this open source code,
00011   please support Adafruit andopen-source hardware by purchasing products
00012   from Adafruit!
00013 
00014   Written by Kevin Townsend for Adafruit Industries.  
00015   BSD license, all text above must be included in any redistribution
00016  ***************************************************************************/
00017 #ifndef __BMP085_H__
00018 #define __BMP085_H__
00019 
00020 #include <Adafruit_Sensor.h>
00021 
00022 /*=========================================================================
00023     I2C ADDRESS/BITS
00024     -----------------------------------------------------------------------*/
00025     #define BMP085_ADDRESS                (0xEE)
00026 /*=========================================================================*/
00027 
00028 /*=========================================================================
00029     REGISTERS
00030     -----------------------------------------------------------------------*/
00031     enum
00032     {
00033       BMP085_REGISTER_CAL_AC1            = 0xAA,  // R   Calibration data (16 bits)
00034       BMP085_REGISTER_CAL_AC2            = 0xAC,  // R   Calibration data (16 bits)
00035       BMP085_REGISTER_CAL_AC3            = 0xAE,  // R   Calibration data (16 bits)
00036       BMP085_REGISTER_CAL_AC4            = 0xB0,  // R   Calibration data (16 bits)
00037       BMP085_REGISTER_CAL_AC5            = 0xB2,  // R   Calibration data (16 bits)
00038       BMP085_REGISTER_CAL_AC6            = 0xB4,  // R   Calibration data (16 bits)
00039       BMP085_REGISTER_CAL_B1             = 0xB6,  // R   Calibration data (16 bits)
00040       BMP085_REGISTER_CAL_B2             = 0xB8,  // R   Calibration data (16 bits)
00041       BMP085_REGISTER_CAL_MB             = 0xBA,  // R   Calibration data (16 bits)
00042       BMP085_REGISTER_CAL_MC             = 0xBC,  // R   Calibration data (16 bits)
00043       BMP085_REGISTER_CAL_MD             = 0xBE,  // R   Calibration data (16 bits)
00044       BMP085_REGISTER_CHIPID             = 0xD0,
00045       BMP085_REGISTER_VERSION            = 0xD1,
00046       BMP085_REGISTER_SOFTRESET          = 0xE0,
00047       BMP085_REGISTER_CONTROL            = 0xF4,
00048       BMP085_REGISTER_TEMPDATA           = 0xF6,
00049       BMP085_REGISTER_PRESSUREDATA       = 0xF6,
00050       BMP085_REGISTER_READTEMPCMD        = 0x2E,
00051       BMP085_REGISTER_READPRESSURECMD    = 0x34
00052     };
00053 /*=========================================================================*/
00054 
00055 /*=========================================================================
00056     MODE SETTINGS
00057     -----------------------------------------------------------------------*/
00058     typedef enum
00059     {
00060       BMP085_MODE_ULTRALOWPOWER          = 0,
00061       BMP085_MODE_STANDARD               = 1,
00062       BMP085_MODE_HIGHRES                = 2,
00063       BMP085_MODE_ULTRAHIGHRES           = 3
00064     } bmp085_mode_t;
00065 /*=========================================================================*/
00066 
00067 /*=========================================================================
00068     CALIBRATION DATA
00069     -----------------------------------------------------------------------*/
00070     typedef struct
00071     {
00072       int16_t  ac1;
00073       int16_t  ac2;
00074       int16_t  ac3;
00075       uint16_t ac4;
00076       uint16_t ac5;
00077       uint16_t ac6;
00078       int16_t  b1;
00079       int16_t  b2;
00080       int16_t  mb;
00081       int16_t  mc;
00082       int16_t  md;
00083     } bmp085_calib_data;
00084 /*=========================================================================*/
00085 
00086 class Adafruit_BMP085_Unified// : public Adafruit_Sensor
00087 {
00088   public:
00089     Adafruit_BMP085_Unified(int32_t sensorID = -1);
00090   
00091     bool  begin(bmp085_mode_t mode = BMP085_MODE_ULTRAHIGHRES);
00092     void  getTemperature(float *temp);
00093     void  getPressure(float *pressure);
00094     float pressureToAltitude(float seaLvel, float atmospheric);
00095     float seaLevelForAltitude(float altitude, float atmospheric);
00096     // Note that the next two functions are just for compatibility with old
00097     // code that passed the temperature as a third parameter.  A newer
00098     // calculation is used which does not need temperature.
00099     float pressureToAltitude(float seaLevel, float atmospheric, float temp);
00100     float seaLevelForAltitude(float altitude, float atmospheric, float temp);
00101     bool  getEvent(sensors_event_t*);
00102     void  getSensor(sensor_t*);
00103 
00104   private:
00105     int32_t computeB5(int32_t ut);
00106     int32_t _sensorID;
00107 };
00108 
00109 #endif