Adafruit MPL3115A2 Arduino Library
Classes | Public Member Functions | List of all members
Adafruit_MPL3115A2 Class Reference

Class that stores state and functions for interacting with MPL3115A2 altimeter. More...

#include <Adafruit_MPL3115A2.h>

Public Member Functions

 Adafruit_MPL3115A2 ()
 Instantiates a new MPL3115A2 class.
 
boolean begin (TwoWire *twoWire=&Wire)
 Setups the HW (reads coefficients values, etc.) More...
 
float getPressure (void)
 Get barometric pressure. More...
 
float getAltitude (void)
 Get altitude. More...
 
int8_t getAltitudeOffset (void)
 Get the altitude offset. More...
 
void setAltitudeOffset (int8_t offset)
 Set the altitude offset. More...
 
float getTemperature (void)
 Get temperature. More...
 
void setSeaPressure (float SLP)
 Set the local sea level pressure. More...
 
void setMode (mpl3115a2_mode_t mode=MPL3115A2_BAROMETER)
 Set measurement mode. More...
 
void startOneShot (void)
 Initiate a one-shot measurement.
 
bool conversionComplete (void)
 Check for measurement conversion completion. More...
 
float getLastConversionResults (mpl3115a2_meas_t value=MPL3115A2_PRESSURE)
 Get results from last measurement. More...
 
void write8 (uint8_t a, uint8_t d)
 write a byte of data to the specified address More...
 

Detailed Description

Class that stores state and functions for interacting with MPL3115A2 altimeter.

Member Function Documentation

◆ begin()

boolean Adafruit_MPL3115A2::begin ( TwoWire *  twoWire = &Wire)

Setups the HW (reads coefficients values, etc.)

Parameters
twoWireOptional TwoWire I2C object
Returns
true on successful startup, false otherwise

◆ getPressure()

float Adafruit_MPL3115A2::getPressure ( void  )

Get barometric pressure.

Returns
pressure reading as a floating point value in hPa

◆ getAltitude()

float Adafruit_MPL3115A2::getAltitude ( void  )

Get altitude.

Returns
altitude reading as a floating-point value in meters

◆ getAltitudeOffset()

int8_t Adafruit_MPL3115A2::getAltitudeOffset ( void  )

Get the altitude offset.

Returns
Offset value in meters

◆ setAltitudeOffset()

void Adafruit_MPL3115A2::setAltitudeOffset ( int8_t  offset)

Set the altitude offset.

Parameters
offsetOffset value in meters, from -127 to 128

◆ getTemperature()

float Adafruit_MPL3115A2::getTemperature ( void  )

Get temperature.

Returns
temperature reading as a floating-point value in degC

◆ setSeaPressure()

void Adafruit_MPL3115A2::setSeaPressure ( float  SLP)

Set the local sea level pressure.

Parameters
SLPsea level pressure in hPa

◆ setMode()

void Adafruit_MPL3115A2::setMode ( mpl3115a2_mode_t  mode = MPL3115A2_BAROMETER)

Set measurement mode.

Parameters
modeThe measurement mode. Can be MPL3115A2_BAROMETER or MPL3115A2_ALTIMETER.

◆ conversionComplete()

bool Adafruit_MPL3115A2::conversionComplete ( void  )

Check for measurement conversion completion.

Returns
true if conversion is complete, otherwise false.

◆ getLastConversionResults()

float Adafruit_MPL3115A2::getLastConversionResults ( mpl3115a2_meas_t  value = MPL3115A2_PRESSURE)

Get results from last measurement.

Parameters
valueMeasurement value, can be MPL3115A2_PRESSURE, MPL3115A2_ALTITUDE, or MPL3115A2_TEMPERATURE
Returns
The measurement value.

◆ write8()

void Adafruit_MPL3115A2::write8 ( uint8_t  a,
uint8_t  d 
)

write a byte of data to the specified address

Parameters
athe address to write to
dthe byte to write

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