BSP430  20141115
Board Support Package for MSP430 microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Data Structures | Macros | Typedefs | Functions
bmp180.h File Reference

Interface to the Bosch Sensotec BMP180 Barometric Pressure Sensor or its predecessor BMP085. More...

#include <bsp430/serial.h>
#include <bsp430/periph/timer.h>

Go to the source code of this file.

Data Structures

struct  sBSP430sensorsBMP180calibration
 
struct  sBSP430sensorsBMP180sample
 

Macros

#define BSP430_SENSORS_BMP180_I2C_ADDRESS   0x77
 

Typedefs

typedef struct sBSP430sensorsBMP180calibration sBSP430sensorsBMP180calibration
 
typedef sBSP430sensorsBMP180calibrationhBSP430sensorsBMP180calibration
 
typedef struct sBSP430sensorsBMP180sample sBSP430sensorsBMP180sample
 
typedef sBSP430sensorsBMP180samplehBSP430sensorsBMP180sample
 

Functions

int iBSP430sensorsBMP180getCalibration (hBSP430halSERIAL i2c, hBSP430sensorsBMP180calibration calh)
 
int iBSP430sensorsBMP180getSample (hBSP430halSERIAL i2c, hBSP430sensorsBMP180sample sample)
 
void vBSP430sensorsBMP180convertSample (const sBSP430sensorsBMP180calibration *calp, hBSP430sensorsBMP180sample sample)
 

Detailed Description

Interface to the Bosch Sensotec BMP180 Barometric Pressure Sensor or its predecessor BMP085.

This device measures absolute atmospheric pressure and temperature.

To use this with BSP430 you will need an I2C device. See examples/sensors/bmp085 for an example of how to use it.

Note
For all operations that involve I2C, the following conditions apply at the time the function is invoked:
  • The caller must hold the i2c resource
  • i2c may be in reset mode on entry, in which case it will be put back into reset mode before returning. i2c must not be in hold mode .
  • The slave address of the i2c resource will be reconfigured as a side effect of calling the function.
Homepage
http://github.com/pabigot/bsp430

Macro Definition Documentation

#define BSP430_SENSORS_BMP180_I2C_ADDRESS   0x77

The 7-bit I2C slave address for the device. This is not configurable.

Typedef Documentation

A handle for BMP180 calibration constants

A handle for a BMP180 sample

Calibration constants retrieved from the device

Data defining a BMP180 sample

Function Documentation

int iBSP430sensorsBMP180getCalibration ( hBSP430halSERIAL  i2c,
hBSP430sensorsBMP180calibration  calh 
)

Read the calibration data from an BMP180 device.

Parameters
i2cthe I2C bus on which the BMP180 device can be contacted.
calhreference to the calibration structure for the device.

return 0 if the calibration constants could be read; otherwise a negative error code.

int iBSP430sensorsBMP180getSample ( hBSP430halSERIAL  i2c,
hBSP430sensorsBMP180sample  sample 
)

Read a single sample from the device.

Note
This function will not return until the sample has been obtained or an error detected. Time required to request and retrieve a sample ranges from about 10ms to 30ms depending on sBSP430sensorsBMP180sample::oversampling. The function will sleep in LPM0 with interrupts enabled while awaiting the result.
Parameters
i2cthe I2C bus on which the BMP180 device can be contacted
samplea pointer to where the sample data should be stored. sBSP430sensorsBMP180sample::oversampling must have been set prior to the call. On a successful call, sBSP430sensorsBMP180sample::temperature_uncomp and sBSP430sensorsBMP180sample::pressure_uncomp will have been updated.
Returns
0 if the sample was successfully retrieved, otherwise a negative error code.
void vBSP430sensorsBMP180convertSample ( const sBSP430sensorsBMP180calibration calp,
hBSP430sensorsBMP180sample  sample 
)

Apply calibration correction to set the final temperature and pressure values for a sample.

Parameters
calpreference to calibration constants retrieved by iBSP430sensorsBMP180getCalibration()
samplereference to a sample retrieved by iBSP430sensorsBMP180getSample. On return, sBSP430sensorsBMP180sample::temperature_dK and sBSP430sensorsBMP180sample::pressure_Pa will have been updated.