Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
bmp085.h
00001 /** 00002 @file bmp085.h 00003 00004 @brief Header file containing member functions and variables 00005 00006 */ 00007 00008 #ifndef __BMP085_H__ 00009 #define __BMP085_H__ 00010 00011 #include "mbed.h" 00012 00013 #define BMP085_I2C_ADDR_READ (0xEF) 00014 #define BMP085_I2C_ADDR_WRITE (0xEE) 00015 00016 #define CTRL_REG_ADDR (0xF4) 00017 #define DATA_REG_ADDR (0xF6) 00018 00019 #define MEASURE_TEMP_CMD (0x2E) 00020 #define MEASURE_PRES_CMD (0x34) 00021 00022 // MSB addresses, MSB first 00023 #define CAL_DATA_AC1 (0xAA) 00024 #define CAL_DATA_AC2 (0xAC) 00025 #define CAL_DATA_AC3 (0xAE) 00026 #define CAL_DATA_AC4 (0xB0) 00027 #define CAL_DATA_AC5 (0xB2) 00028 #define CAL_DATA_AC6 (0xB4) 00029 #define CAL_DATA_B1 (0xB6) 00030 #define CAL_DATA_B2 (0xB8) 00031 #define CAL_DATA_MB (0xBA) 00032 #define CAL_DATA_MC (0xBC) 00033 #define CAL_DATA_MD (0xBE) 00034 00035 00036 /** 00037 @brief Simple library for interfacing with Bosch BMP085 00038 00039 @brief Revision 1.0 00040 00041 @author Tim Meese 00042 @date January 2015 00043 * 00044 * Example: 00045 * @code 00046 00047 #include "mbed.h" 00048 #include "bmp085.h" 00049 00050 00051 * @endcode 00052 */ 00053 00054 00055 class BMP085 00056 { 00057 00058 private: 00059 00060 // I2C interface 00061 I2C * i2c; 00062 00063 const float p0 = 101325; // Pressure at sea level (Pa) 00064 float altitude; 00065 00066 // Calibration parameters 00067 short AC1; 00068 short AC2; 00069 short AC3; 00070 unsigned short AC4; 00071 unsigned short AC5; 00072 unsigned short AC6; 00073 short B1; 00074 short B2; 00075 short MB; 00076 short MC; 00077 short MD; 00078 00079 // uncalibrated temp, pressure 00080 long UT; 00081 long UP; 00082 00083 // shared values 00084 long X1; 00085 long X2; 00086 long X3; 00087 long B3; 00088 unsigned long B4; 00089 long B5; 00090 long B6; 00091 unsigned long B7; 00092 long T; // temp in 0.1 degrees C 00093 long p; // pressure in Pascals 00094 00095 void readCalData(); 00096 void readUncompTemp(); 00097 void readUncompPressure(int mode); 00098 00099 public: 00100 /** Create a BMP085 object connected to the specified pins 00101 * 00102 * @param clkPin Pin connected to clk 00103 * @param dataPin Pin connected to data 00104 * 00105 */ 00106 BMP085(PinName clkPin, PinName dataPin); 00107 00108 /** Initialise SHT11 00109 * 00110 */ 00111 void init(); 00112 float getTemperature(); 00113 float getPressure(int oss); 00114 long getUT(); 00115 long getUP(); 00116 }; 00117 00118 #endif /* __BMP085_H__ */
Generated on Fri Jul 15 2022 18:48:42 by
1.7.2