Modified to run on Renesas GR Peach board
Dependencies: EthernetInterface HTTP-Server Webpage mbed-rpc mbed-src
Fork of HTTPServer_echoback by
Adafruit_10DOF/Adafruit_BMP085_U.h@16:5d102be2566c, 2015-10-07 (annotated)
- Committer:
- webOnBoard
- Date:
- Wed Oct 07 20:42:51 2015 +0000
- Revision:
- 16:5d102be2566c
web based AHRS demo Renesas GR Peach board; Using HTTP Server/RPC Adafruit 10DOF
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
webOnBoard | 16:5d102be2566c | 1 | /*************************************************************************** |
webOnBoard | 16:5d102be2566c | 2 | This is a library for the BMP085 pressure sensor |
webOnBoard | 16:5d102be2566c | 3 | |
webOnBoard | 16:5d102be2566c | 4 | Designed specifically to work with the Adafruit BMP085 or BMP180 Breakout |
webOnBoard | 16:5d102be2566c | 5 | ----> http://www.adafruit.com/products/391 |
webOnBoard | 16:5d102be2566c | 6 | ----> http://www.adafruit.com/products/1603 |
webOnBoard | 16:5d102be2566c | 7 | |
webOnBoard | 16:5d102be2566c | 8 | These displays use I2C to communicate, 2 pins are required to interface. |
webOnBoard | 16:5d102be2566c | 9 | |
webOnBoard | 16:5d102be2566c | 10 | Adafruit invests time and resources providing this open source code, |
webOnBoard | 16:5d102be2566c | 11 | please support Adafruit andopen-source hardware by purchasing products |
webOnBoard | 16:5d102be2566c | 12 | from Adafruit! |
webOnBoard | 16:5d102be2566c | 13 | |
webOnBoard | 16:5d102be2566c | 14 | Written by Kevin Townsend for Adafruit Industries. |
webOnBoard | 16:5d102be2566c | 15 | BSD license, all text above must be included in any redistribution |
webOnBoard | 16:5d102be2566c | 16 | ***************************************************************************/ |
webOnBoard | 16:5d102be2566c | 17 | #ifndef __BMP085_H__ |
webOnBoard | 16:5d102be2566c | 18 | #define __BMP085_H__ |
webOnBoard | 16:5d102be2566c | 19 | |
webOnBoard | 16:5d102be2566c | 20 | #include <Adafruit_Sensor.h> |
webOnBoard | 16:5d102be2566c | 21 | |
webOnBoard | 16:5d102be2566c | 22 | /*========================================================================= |
webOnBoard | 16:5d102be2566c | 23 | I2C ADDRESS/BITS |
webOnBoard | 16:5d102be2566c | 24 | -----------------------------------------------------------------------*/ |
webOnBoard | 16:5d102be2566c | 25 | #define BMP085_ADDRESS (0xEE) |
webOnBoard | 16:5d102be2566c | 26 | /*=========================================================================*/ |
webOnBoard | 16:5d102be2566c | 27 | |
webOnBoard | 16:5d102be2566c | 28 | /*========================================================================= |
webOnBoard | 16:5d102be2566c | 29 | REGISTERS |
webOnBoard | 16:5d102be2566c | 30 | -----------------------------------------------------------------------*/ |
webOnBoard | 16:5d102be2566c | 31 | enum |
webOnBoard | 16:5d102be2566c | 32 | { |
webOnBoard | 16:5d102be2566c | 33 | BMP085_REGISTER_CAL_AC1 = 0xAA, // R Calibration data (16 bits) |
webOnBoard | 16:5d102be2566c | 34 | BMP085_REGISTER_CAL_AC2 = 0xAC, // R Calibration data (16 bits) |
webOnBoard | 16:5d102be2566c | 35 | BMP085_REGISTER_CAL_AC3 = 0xAE, // R Calibration data (16 bits) |
webOnBoard | 16:5d102be2566c | 36 | BMP085_REGISTER_CAL_AC4 = 0xB0, // R Calibration data (16 bits) |
webOnBoard | 16:5d102be2566c | 37 | BMP085_REGISTER_CAL_AC5 = 0xB2, // R Calibration data (16 bits) |
webOnBoard | 16:5d102be2566c | 38 | BMP085_REGISTER_CAL_AC6 = 0xB4, // R Calibration data (16 bits) |
webOnBoard | 16:5d102be2566c | 39 | BMP085_REGISTER_CAL_B1 = 0xB6, // R Calibration data (16 bits) |
webOnBoard | 16:5d102be2566c | 40 | BMP085_REGISTER_CAL_B2 = 0xB8, // R Calibration data (16 bits) |
webOnBoard | 16:5d102be2566c | 41 | BMP085_REGISTER_CAL_MB = 0xBA, // R Calibration data (16 bits) |
webOnBoard | 16:5d102be2566c | 42 | BMP085_REGISTER_CAL_MC = 0xBC, // R Calibration data (16 bits) |
webOnBoard | 16:5d102be2566c | 43 | BMP085_REGISTER_CAL_MD = 0xBE, // R Calibration data (16 bits) |
webOnBoard | 16:5d102be2566c | 44 | BMP085_REGISTER_CHIPID = 0xD0, |
webOnBoard | 16:5d102be2566c | 45 | BMP085_REGISTER_VERSION = 0xD1, |
webOnBoard | 16:5d102be2566c | 46 | BMP085_REGISTER_SOFTRESET = 0xE0, |
webOnBoard | 16:5d102be2566c | 47 | BMP085_REGISTER_CONTROL = 0xF4, |
webOnBoard | 16:5d102be2566c | 48 | BMP085_REGISTER_TEMPDATA = 0xF6, |
webOnBoard | 16:5d102be2566c | 49 | BMP085_REGISTER_PRESSUREDATA = 0xF6, |
webOnBoard | 16:5d102be2566c | 50 | BMP085_REGISTER_READTEMPCMD = 0x2E, |
webOnBoard | 16:5d102be2566c | 51 | BMP085_REGISTER_READPRESSURECMD = 0x34 |
webOnBoard | 16:5d102be2566c | 52 | }; |
webOnBoard | 16:5d102be2566c | 53 | /*=========================================================================*/ |
webOnBoard | 16:5d102be2566c | 54 | |
webOnBoard | 16:5d102be2566c | 55 | /*========================================================================= |
webOnBoard | 16:5d102be2566c | 56 | MODE SETTINGS |
webOnBoard | 16:5d102be2566c | 57 | -----------------------------------------------------------------------*/ |
webOnBoard | 16:5d102be2566c | 58 | typedef enum |
webOnBoard | 16:5d102be2566c | 59 | { |
webOnBoard | 16:5d102be2566c | 60 | BMP085_MODE_ULTRALOWPOWER = 0, |
webOnBoard | 16:5d102be2566c | 61 | BMP085_MODE_STANDARD = 1, |
webOnBoard | 16:5d102be2566c | 62 | BMP085_MODE_HIGHRES = 2, |
webOnBoard | 16:5d102be2566c | 63 | BMP085_MODE_ULTRAHIGHRES = 3 |
webOnBoard | 16:5d102be2566c | 64 | } bmp085_mode_t; |
webOnBoard | 16:5d102be2566c | 65 | /*=========================================================================*/ |
webOnBoard | 16:5d102be2566c | 66 | |
webOnBoard | 16:5d102be2566c | 67 | /*========================================================================= |
webOnBoard | 16:5d102be2566c | 68 | CALIBRATION DATA |
webOnBoard | 16:5d102be2566c | 69 | -----------------------------------------------------------------------*/ |
webOnBoard | 16:5d102be2566c | 70 | typedef struct |
webOnBoard | 16:5d102be2566c | 71 | { |
webOnBoard | 16:5d102be2566c | 72 | int16_t ac1; |
webOnBoard | 16:5d102be2566c | 73 | int16_t ac2; |
webOnBoard | 16:5d102be2566c | 74 | int16_t ac3; |
webOnBoard | 16:5d102be2566c | 75 | uint16_t ac4; |
webOnBoard | 16:5d102be2566c | 76 | uint16_t ac5; |
webOnBoard | 16:5d102be2566c | 77 | uint16_t ac6; |
webOnBoard | 16:5d102be2566c | 78 | int16_t b1; |
webOnBoard | 16:5d102be2566c | 79 | int16_t b2; |
webOnBoard | 16:5d102be2566c | 80 | int16_t mb; |
webOnBoard | 16:5d102be2566c | 81 | int16_t mc; |
webOnBoard | 16:5d102be2566c | 82 | int16_t md; |
webOnBoard | 16:5d102be2566c | 83 | } bmp085_calib_data; |
webOnBoard | 16:5d102be2566c | 84 | /*=========================================================================*/ |
webOnBoard | 16:5d102be2566c | 85 | |
webOnBoard | 16:5d102be2566c | 86 | class Adafruit_BMP085_Unified// : public Adafruit_Sensor |
webOnBoard | 16:5d102be2566c | 87 | { |
webOnBoard | 16:5d102be2566c | 88 | public: |
webOnBoard | 16:5d102be2566c | 89 | Adafruit_BMP085_Unified(int32_t sensorID = -1); |
webOnBoard | 16:5d102be2566c | 90 | |
webOnBoard | 16:5d102be2566c | 91 | bool begin(bmp085_mode_t mode = BMP085_MODE_ULTRAHIGHRES); |
webOnBoard | 16:5d102be2566c | 92 | void getTemperature(float *temp); |
webOnBoard | 16:5d102be2566c | 93 | void getPressure(float *pressure); |
webOnBoard | 16:5d102be2566c | 94 | float pressureToAltitude(float seaLvel, float atmospheric); |
webOnBoard | 16:5d102be2566c | 95 | float seaLevelForAltitude(float altitude, float atmospheric); |
webOnBoard | 16:5d102be2566c | 96 | // Note that the next two functions are just for compatibility with old |
webOnBoard | 16:5d102be2566c | 97 | // code that passed the temperature as a third parameter. A newer |
webOnBoard | 16:5d102be2566c | 98 | // calculation is used which does not need temperature. |
webOnBoard | 16:5d102be2566c | 99 | float pressureToAltitude(float seaLevel, float atmospheric, float temp); |
webOnBoard | 16:5d102be2566c | 100 | float seaLevelForAltitude(float altitude, float atmospheric, float temp); |
webOnBoard | 16:5d102be2566c | 101 | bool getEvent(sensors_event_t*); |
webOnBoard | 16:5d102be2566c | 102 | void getSensor(sensor_t*); |
webOnBoard | 16:5d102be2566c | 103 | |
webOnBoard | 16:5d102be2566c | 104 | private: |
webOnBoard | 16:5d102be2566c | 105 | int32_t computeB5(int32_t ut); |
webOnBoard | 16:5d102be2566c | 106 | int32_t _sensorID; |
webOnBoard | 16:5d102be2566c | 107 | }; |
webOnBoard | 16:5d102be2566c | 108 | |
webOnBoard | 16:5d102be2566c | 109 | #endif |