Library to wrapper most of the functions on the MPL3115A2 pressure and temperature sensor.

Dependents:   WeatherBalloon4180 WeatherBalloon4180 mbed_rifletool Smart_Watch_4180_Final_Design ... more

Embed: (wiki syntax)

« Back to documentation index

Altitude Class Reference

Altitude provides a wrapper around altitude data coming from the sensor. More...

#include <Altitude.h>

Public Types

enum  unitsType
 

The units we support converting the sensor data to.

More...

Public Member Functions

 operator char * (void)
 Allows using the object directly in an I2C read operation.
 operator float (void)
 Same as calling altitude with METERS as the parameter.
float altitude (unitsType units=FEET)
 Returns the altitude in the units you specifiy, defaulting to FEET if none specified.
void setAltitude ()
 Call to decompress the sensor data after an I2C read.
const char * print (unitsType units=FEET)
 Returns the altitude as a string in the units specified, defaulting to FEET if none specified.

Static Public Member Functions

static float MetersToFeet (float meters)
 Converts meters to feet.
static float FeetToMeters (float feet)
 Converts feet to meters.

Static Public Attributes

static const int size = 3
 The size of the compressed data buffer from the sensor. Used in an I2C read.

Detailed Description

Altitude provides a wrapper around altitude data coming from the sensor.

The class handles working with compressed data from the sensor and provides convenient functions for retreiving the data in various units (with room to add more if needed).

Definition at line 24 of file Altitude.h.


Member Enumeration Documentation

enum unitsType

The units we support converting the sensor data to.

Definition at line 32 of file Altitude.h.


Member Function Documentation

float altitude ( unitsType  units = FEET )

Returns the altitude in the units you specifiy, defaulting to FEET if none specified.

Definition at line 49 of file Altitude.cpp.

static float FeetToMeters ( float  feet ) [static]

Converts feet to meters.

Definition at line 58 of file Altitude.h.

static float MetersToFeet ( float  meters ) [static]

Converts meters to feet.

Definition at line 56 of file Altitude.h.

operator char * ( void   )

Allows using the object directly in an I2C read operation.

Definition at line 40 of file Altitude.h.

operator float ( void   )

Same as calling altitude with METERS as the parameter.

Definition at line 42 of file Altitude.h.

const char * print ( unitsType  units = FEET )

Returns the altitude as a string in the units specified, defaulting to FEET if none specified.

Definition at line 60 of file Altitude.cpp.

void setAltitude (  )

Call to decompress the sensor data after an I2C read.

Definition at line 28 of file Altitude.cpp.


Field Documentation

const int size = 3 [static]

The size of the compressed data buffer from the sensor. Used in an I2C read.

Definition at line 29 of file Altitude.h.