COSA
An Object-Oriented Platform for Arduino Programming
BMP085 Class Reference

#include <BMP085.hh>

Inheritance diagram for BMP085:
Inheritance graph
Collaboration diagram for BMP085:
Collaboration graph

Classes

struct  param_t
 

Public Types

enum  Mode { ULTRA_LOW_POWER = 0, STANDARD = 1, HIGH_RESOLUTION = 2, ULTRA_HIGH_RESOLUTION = 3 }
 

Public Member Functions

 BMP085 ()
 
bool begin (Mode mode=ULTRA_LOW_POWER)
 
bool sample_temperature_request ()
 
bool read_temperature ()
 
bool sample_temperature ()
 
bool sample_pressure_request ()
 
bool read_pressure ()
 
bool sample_pressure ()
 
bool sample ()
 
int16_t temperature () const
 
int32_t pressure () const
 

Protected Attributes

param_t m_param
 
Mode m_mode
 
uint8_t m_cmd
 
uint16_t m_start
 
int32_t B5
 
int32_t m_pressure
 

Static Protected Attributes

static const uint8_t TEMP_CONV_MS = 5
 
static const uint8_t PRESSURE_CONV_MS[] __PROGMEM
 
static const uint8_t COEFF_REG = 0xAA
 
static const uint8_t CMD_REG = 0xF4
 
static const uint8_t RES_REG = 0xF6
 
static const uint8_t TEMP_CONV_CMD = 0x2E
 
static const uint8_t PRESSURE_CONV_CMD = 0x34
 

Private Member Functions

bool is_async () const
 
void sync_request ()
 
void async_request ()
 
virtual void on_completion (uint8_t type, int count)
 

Private Attributes

uint8_t m_addr
 
bool m_async
 

Detailed Description

Cosa TWI driver for Bosch BMP085 Digital pressure sensor

Circuit

The GY-80 10DOF module with pull-up resistors (4K7) for TWI signals and 3V3 internal voltage converter.

GY-80
+------------+
(VCC)---------------1-|VCC |
2-|3V3 |
(GND)---------------3-|GND |
(A5/SCL)------------4-|SCL |
(A4/SDA)------------5-|SDA |
6-|M-DRDY |
7-|A-INT1 |
8-|T-INT1 |
9-|P-XCLR |
(Dn/EXTn)----------10-|P-EOC |
+------------+

References

  1. http://media.digikey.com/pdf/Data%20Sheets/Bosch/BMP085.pdf BST-BMP085-DS000-03, Rev. 1.0, 01 July 2008.

Definition at line 54 of file BMP085.hh.

Member Enumeration Documentation

Oversampling modes (table, pp. 10).

Enumerator
ULTRA_LOW_POWER 
STANDARD 
HIGH_RESOLUTION 
ULTRA_HIGH_RESOLUTION 

Definition at line 59 of file BMP085.hh.

Constructor & Destructor Documentation

BMP085::BMP085 ( )
inline

Construct BMP085 driver with I2C address(0x77) and default ULTRA_LOW_POWER mode.

Definition at line 70 of file BMP085.hh.

Member Function Documentation

bool BMP085::begin ( Mode  mode = ULTRA_LOW_POWER)

Initiate device driver. Load calibration coefficients from device. Return true if successful otherwise false.

Parameters
[in]modeoversampling mode (Default ULTRA_LOW_POWER).
Returns
boolean.

Definition at line 34 of file BMP085.cpp.

int32_t BMP085::pressure ( ) const
inline

Return latest calculated pressure from temperature and pressure raw sensor data.

Returns
calculated pressure in steps of 1 Pa (0,01 hPa).

Definition at line 162 of file BMP085.hh.

bool BMP085::read_pressure ( )

Read the raw pressure sensor. Return true(1) if successful otherwise false.

Returns
bool

Definition at line 113 of file BMP085.cpp.

bool BMP085::read_temperature ( )

Read the raw temperature sensor. Will wait for the conversion to complete. Return true(1) if successful otherwise false.

Returns
bool

Definition at line 68 of file BMP085.cpp.

bool BMP085::sample ( )
inline

Sample and read the raw temperature and pressure sensor. Return true(1) if successful otherwise false.

Returns
bool

Definition at line 141 of file BMP085.hh.

bool BMP085::sample_pressure ( )
inline

Sample and read the raw pressure sensor. Return true(1) if successful otherwise false.

Returns
bool

Definition at line 130 of file BMP085.hh.

bool BMP085::sample_pressure_request ( )

Issue a sample request of the raw pressure sensor. Will wait for the conversion to complete. Return true(1) if successful otherwise false.

Returns
bool

Definition at line 96 of file BMP085.cpp.

bool BMP085::sample_temperature ( )
inline

Sample the raw temperature sensor. Return true(1) if successful otherwise false.

Returns
bool

Definition at line 106 of file BMP085.hh.

bool BMP085::sample_temperature_request ( )

Issue a sample raw temperature sensor request. Return true(1) if successful otherwise false.

Returns
bool

Definition at line 51 of file BMP085.cpp.

int16_t BMP085::temperature ( ) const
inline

Calculate temperature from the latest raw sensor reading.

Returns
calculated temperature in steps of 0.1 C

Definition at line 151 of file BMP085.hh.

Member Data Documentation

const uint8_t PRESSURE_CONV_MS [] BMP085::__PROGMEM
staticprotected

Pressure conversion time max table (ms), index with mode.

Definition at line 172 of file BMP085.hh.

int32_t BMP085::B5
protected

Common intermediate temperature factor.

Definition at line 220 of file BMP085.hh.

const uint8_t BMP085::CMD_REG = 0xF4
staticprotected

Command register address.

Definition at line 196 of file BMP085.hh.

const uint8_t BMP085::COEFF_REG = 0xAA
staticprotected

Calibration coefficients register address.

Definition at line 193 of file BMP085.hh.

uint8_t BMP085::m_cmd
protected

Currrent command.

Definition at line 214 of file BMP085.hh.

Mode BMP085::m_mode
protected

Pressure conversion mode.

Definition at line 211 of file BMP085.hh.

param_t BMP085::m_param
protected

Device calibration data.

Definition at line 208 of file BMP085.hh.

int32_t BMP085::m_pressure
protected

Latest calculated pressure.

Definition at line 223 of file BMP085.hh.

uint16_t BMP085::m_start
protected

Sample request start time (ms).

Definition at line 217 of file BMP085.hh.

const uint8_t BMP085::PRESSURE_CONV_CMD = 0x34
staticprotected

Pressure conversion command.

Definition at line 205 of file BMP085.hh.

const uint8_t BMP085::RES_REG = 0xF6
staticprotected

Result register address.

Definition at line 199 of file BMP085.hh.

const uint8_t BMP085::TEMP_CONV_CMD = 0x2E
staticprotected

Temperature conversion command.

Definition at line 202 of file BMP085.hh.

const uint8_t BMP085::TEMP_CONV_MS = 5
staticprotected

Temperature conversion time max (ms).

Definition at line 169 of file BMP085.hh.


The documentation for this class was generated from the following files: