William Thenaers / BMP180
Embed: (wiki syntax)

« Back to documentation index

BMP180 Class Reference

BMP180 class. More...

#include <BMP180.h>

Public Member Functions

 BMP180 (I2C &i2c)
 Create a BMP180 instance.
int initialize (float altitude=0.F, OverSamplingSetting oss=STANDARD)
 Initialization: set member values and read BMP180 calibration parameters.
int readData (float &pTemperature, float &pPressure)
 Read pressure and temperature from the BMP180.

Protected Member Functions

int ReadRawTemperature (long *pUt)
 Perform temperature measurement.
int ReadRawPressure (long *pUp)
 Perform pressure measurement.
float TrueTemperature (long ut)
 Calculation of the temperature from the digital output.
float TruePressure (long up)
 Calculation of the pressure from the digital output.

Detailed Description

BMP180 class.

Read Pressure and temperature from the BMP180 Breakout I2C sensor

Example:

 #include "mbed.h"
 #include "BMP180.h"

 int main() {
     BMP180 bmp180(PIN_SDA, PIN_SCL);
     float pressure, temperature;

     // bmp180.Initialize(); // no altitude compensation and normal oversampling
     bmp180.Initialize(64, BMP180_OSS_ULTRA_LOW_POWER); // 64m altitude compensation and low power oversampling

     while(1) {
         if (bmp180.ReadData(&pressure, &temperature))
             printf("Pressure(hPa): %8.2f \t Temperature(C): %8.2f\n", pressure, temperature);
         wait(1);
     }
 }

Definition at line 47 of file BMP180.h.


Constructor & Destructor Documentation

BMP180 ( I2C &  i2c )

Create a BMP180 instance.

Parameters:
i2cobject

Definition at line 8 of file BMP180.cpp.


Member Function Documentation

int initialize ( float  altitude = 0.F,
OverSamplingSetting  oss = STANDARD 
)

Initialization: set member values and read BMP180 calibration parameters.

Parameters:
altitude(in meter)
overSamplingSetting
Returns:
1 on success, 0 on error

Definition at line 13 of file BMP180.cpp.

int readData ( float &  pTemperature,
float &  pPressure 
)

Read pressure and temperature from the BMP180.

Parameters:
pressure(hPa)
temperature(C)
Returns:
1 on success, 0 on error

Definition at line 46 of file BMP180.cpp.

int ReadRawPressure ( long *  pUp ) [protected]

Perform pressure measurement.

Returns:
pressure (mbar)

Definition at line 79 of file BMP180.cpp.

int ReadRawTemperature ( long *  pUt ) [protected]

Perform temperature measurement.

Returns:
temperature (C)

Definition at line 58 of file BMP180.cpp.

float TruePressure ( long  up ) [protected]

Calculation of the pressure from the digital output.

Definition at line 115 of file BMP180.cpp.

float TrueTemperature ( long  ut ) [protected]

Calculation of the temperature from the digital output.

Definition at line 105 of file BMP180.cpp.