API for the MPL3115A2 Atmospheric Pressure Sensor.
More...
Freescale Semiconductor* MPL3115A2 is a high-precision, ultra-low power consumption pressure sensor. Its operating range is 50-110 kPa.
while (true) {
System.out.println("Pressure: " + sensor.getPressure());
System.out.println("Altitude: " + sensor.getAltitude());
System.out.println("Sealevel pressure: " + sensor.getSealevelPressure());
System.out.println("Temperature: " + sensor.getTemperature());
System.out.println();
Thread.sleep(1000);
}
|
|
synchronized void | delete () |
| |
| | MPL3115A2 (int bus, int devAddr, short mode) |
| |
|
| MPL3115A2 (int bus, int devAddr) |
| |
|
| MPL3115A2 (int bus) |
| |
|
int | testSensor () |
| |
|
int | resetSensor () |
| |
|
void | dumpSensor () |
| |
|
int | sampleData () |
| |
| int | getPressureReg (int reg) |
| |
| int | getTempReg (int reg) |
| |
| float | getPressure (int bSampleData) |
| |
|
float | getPressure () |
| |
| float | getTemperature (int bSampleData) |
| |
|
float | getTemperature () |
| |
| float | getSealevelPressure (float altitudeMeters) |
| |
|
float | getSealevelPressure () |
| |
| float | getAltitude (float sealevelPressure) |
| |
|
float | getAltitude () |
| |
| void | setOversampling (short oversampling) |
| |
|
short | getOversampling () |
| |
|
float | getTemperatureMax () |
| |
|
float | getTemperatureMin () |
| |
|
float | getPressureMax () |
| |
|
float | getPressureMin () |
| |
| float | convertTempCtoF (float fTemp) |
| |
| float | convertPaToinHg (float fPressure) |
| |
| int | i2cWriteReg (short reg, short value) |
| |
| int | i2cReadReg_16 (int reg) |
| |
| short | i2cReadReg_8 (int reg) |
| |
| MPL3115A2 |
( |
int |
bus, |
|
|
int |
devAddr, |
|
|
short |
mode |
|
) |
| |
Instantiates an MPL3115A2 object
- Parameters
-
| bus | Number of the used bus |
| devAddr | Address of the used I2C device |
| mode | MPL3115A2 oversampling (6 = 64x) |
| float convertPaToinHg |
( |
float |
fPressure | ) |
|
Converts pressure from Pa*100 to inHg*10000 This is set for 15degC (Pa = 0.0002961 in Hg) TODO: Change the function to add temperature calibration
- Parameters
-
| float convertTempCtoF |
( |
float |
fTemp | ) |
|
Converts temperature from degC*1000 to degF*1000
- Parameters
-
| float getAltitude |
( |
float |
sealevelPressure | ) |
|
Reads the current pressure and, using a known sea level pressure, calculates the altitude value [m] This function should be preceded by the sampleData() call
- Parameters
-
| sealevelPressure | Current sea level pressure |
| float getPressure |
( |
int |
bSampleData | ) |
|
Reads the current pressure value from MPL3115A2 [Pa]
- Parameters
-
| bSampleData | Sets non-zero to a sample reading |
| int getPressureReg |
( |
int |
reg | ) |
|
Reads the pressure value from MPL3115A2 [Pa * 100]
- Parameters
-
| reg | Base address of the pressure register |
| float getSealevelPressure |
( |
float |
altitudeMeters | ) |
|
Reads the current pressure and, using a known altitude, calculates the sea level pressure value [Pa] This function should be preceded by the sampleData() call
- Parameters
-
| altitudeMeters | Altitude in meters |
| float getTemperature |
( |
int |
bSampleData | ) |
|
Reads the current temperature value from MPL3115A2 [degC]
- Parameters
-
| bSampleData | Sets non-zero to a sample reading |
| int getTempReg |
( |
int |
reg | ) |
|
Reads the temperature value from MPL3115A2 [degC * 1000]
- Parameters
-
| reg | Base address of the temperature register |
| int i2cReadReg_16 |
( |
int |
reg | ) |
|
Reads two bytes from an I2C register
- Parameters
-
| reg | Address of the register |
| short i2cReadReg_8 |
( |
int |
reg | ) |
|
Reads a one-byte register
- Parameters
-
| reg | Address of the register |
| int i2cWriteReg |
( |
short |
reg, |
|
|
short |
value |
|
) |
| |
Writes one byte to an I2C register
- Parameters
-
| reg | Address of the register |
| value | Byte to be written |
| void setOversampling |
( |
short |
oversampling | ) |
|
Defines the oversampling setting (ranges from 0 to 7). The value represents 2^n samples (ranging from 1 to 128). The time to calculate a sample is approximately (2^n * 4 + 2) ms
- Parameters
-
| oversampling | New oversampling value |
The documentation for this class was generated from the following file:
- /var/lib/jenkins/workspace/upm-doc-stable/build-33/src/mpl3115a2/MPL3115A2.java