Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MPL115A2Sample dataloger_for_modelrocket ARLISS2012_Hidaka
MPL115A2.h
- Committer:
- yamaguch
- Date:
- 2011-05-14
- Revision:
- 2:d77bd4340924
File content as of revision 2:d77bd4340924:
#ifndef MPL115A2
#define MPL115A
#include "mbed.h"
/**
* MPL115A2 (I2C) pressure sensor
*/
class MPL115A2 {
public:
/**
* Create an MPL115A(I2C) interface with specified pins
*
* @param PinName sda SDA pin (default = p9)
* @param PinName scl SCL pin (default = p10)
*/
MPL115A2(PinName sda = p9, PinName scl = p10) : i2c(sda, scl) {
}
/**
* Read current pressure and/or temperature
*
* @param puressure pointer to a float area to receive pressure
* @param padc pointer to an int area to receive pressure adc value
* @param tadc pointer to an int area to receive temperature adc value
* @param data pointer to an array of adc's and coefficients (byte array of size 16)
*
* @returns 0 (success), or -1 (I2C error)
*/
int read(float *pressure, char *data);
/**
* Read current pressure
*
* @returns current pressure (in hPa)
*/
float readPressure();
/**
* Operator shorthand for readPressure()
*/
operator float() {
return readPressure();
}
private:
I2C i2c;
};
#endif