libpropeller
Making PropellerGCC Easier
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | List of all members
MS5611 Class Reference

MS5611 Barometer interface. More...

#include <ms5611.h>

Public Types

enum  AddressLSB { LSB_0, LSB_1 }
 Specify the least significant address bit. More...
 

Public Member Functions

 MS5611 ()
 Initialize a new MS5611 instance. More...
 
bool Init (I2C *newbus, const AddressLSB address=LSB_0)
 Initialize MS5611 Barometer instance. More...
 
bool Touch (void)
 Keep the MS5611 running. More...
 
void Get (int &tPressure, int &tTemperature, const bool calibrationCalculation=true)
 Get the most current readings from the MS5611 sensor. More...
 
bool GetStatus (void)
 
bool Reset (void)
 Reset the pressure sensor. More...
 

Detailed Description

MS5611 Barometer interface.

Provides a simple interface to the MS5611 barometer and temperature sensor. Uses the I2C interface to the sensor.

Author
SRLM (srlm@.nosp@m.srlm.nosp@m.produ.nosp@m.ctio.nosp@m.ns.co.nosp@m.m)

Member Enumeration Documentation

Specify the least significant address bit.

Enumerator
LSB_0 
LSB_1 

Constructor & Destructor Documentation

MS5611::MS5611 ( )
inline

Initialize a new MS5611 instance.

Member Function Documentation

void MS5611::Get ( int &  tPressure,
int &  tTemperature,
const bool  calibrationCalculation = true 
)
inline

Get the most current readings from the MS5611 sensor.

Test results indicate that the Get function takes the following amounts of time, at 80MHz in when calibrationCalculation == true:

  • CMM -Os mode: 48448 cycles (~0.62ms)
  • LMM -Os mode: 13968 cycles (~0.17ms)
Warning
Second order temperature compensation has not been tested! Particularly the very low temperature compensation!
Parameters
tPressureThe pressure, either raw or in units of 0.01 mBar
tTemperatureThe temperature, either raw or in units of 0.01C
calibrationCalculationPerform calculations to calibrate (they involve 64 bit integers, so they take a while).
bool MS5611::GetStatus ( void  )
inline
Returns
true if device is present and ready, false otherwise

Here is the call graph for this function:

bool MS5611::Init ( I2C newbus,
const AddressLSB  address = LSB_0 
)
inline

Initialize MS5611 Barometer instance.

This resets and initializes the sensor, reads the PROM, and begins a conversion.

Touch() should be called no sooner than 8.5ms after MS5611 initialization.

Parameters
newbusThe I2C bus to use.
addressThe least significant byte of the I2C address. Use the enum constants.

Here is the call graph for this function:

bool MS5611::Reset ( void  )
inline

Reset the pressure sensor.

Warning
untested! (How do I test this?)
Returns
true if successfully reset, false otherwise. Takes 2.8ms to reload.

Here is the call graph for this function:

bool MS5611::Touch ( void  )
inline

Keep the MS5611 running.

In general, must be called twice for every associated Get().

"Touches" the sensor to make sure that it keeps converting at the maximum pace.

Warning
Undefined behavior if called more than every 8.5 ms or less than every 53 seconds.

Test results indicate that the Touch function takes the following amount of time, at 80MHz in:

  • CMM -Os mode: 49056 cycles (~0.62ms)
  • LMM -Os mode: 22624 cycles (~0.28ms)
    Returns
    true when a new set of data is ready. If result is true, then Get() should be called.

Here is the call graph for this function:


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