* this project can be found here: https://pi4j.com/
*
*
https://www.nxp.com/docs/en/data-sheet/MPL3115A2.pdf
----Pi------------------MPL3115A2 -------
3.3v--------------------P1---Vdd
Grnd--------------------P2---Gnd
3.3v--------------------P3---3v
GPIO26------------------P4---INT2 USE: for DRDY
GPIO15------------------P5---INT1 USE: for P/A & T interrupt
SCL---------------------P6---SCL
SDA---------------------P7---SDA
At present supports retrieval Temperature Pressure and Altitude.
A future commit will incorporate 'target' interrupt support.
- ./mvnw clean package
- cd target/distribution
- sudo ./runMPL3115A2.sh
The application demonstrates usage of public interfaces to the chip.
The app obtains pressure, altitide and temperature in the commons formats.
It then adjusts the altitude calculation to use the local pressure Pa value.
Use of different bus or device address or GPIO, use the applicable values
in the following command.
sudo ./runMPL3115A2.sh -b 0x01 -a 0x60 -int1 15 -int2 26 -t trace
Bus and address, GPIOs connected to int1 and int2 Trace level
sudo ./runMPL3115A2.sh -b 0x01 -a 0x60 -int1 15 -int2 26 -t trace -x
Bus and address, GPIOs connected to int1 and int2 Trace level
-x reset chip. Initial chip access may fail to retrieve data and log an error
message. When the chip has completed reset normal data retrieval will resume.
// using limits and window
sudo ./runMPL3115A2.sh -b 0x01 -a 0x60 -int1 15 -int2 26 -t trace
Read the temperature 'C' value. Set -TW and -TG a few degrees above this
value.
-PW pressure/alt window -PG pressure/alt limit -TW temp window -TG temp limit
sudo ./runMPL3115A2.sh -b 0x01 -a 0x60 -int1 15 -int2 26 -t info -PW 3 -PG 314 -TW 1 -TG 35
Use heat gun on circuit board and temp interrupt1 will fire.
The altimeter and pressure share the same registers for limit and window.
Whether your application last called getting the altimeter or pressure will
effect the chips comparisons and interrupt handler.
Example: If you set the altitude to 300 meters limit, but the previous
operation was getting the pressure, the chip will compare the pressure which
is a large value to that 300 limit and fire the interrupt.
So in this case, get the altitude value from the chip before setting the
altitude limit.
sudo ./runMPL3115A2.sh -b 0x01 -a 0x60 -int1 15 -int2 26 -Pa 97720
To restore the chip using its default pressure, set -Pa 101326 or reset
the chip.