HiPi::Interface::MPL3115A2
This module provides an interface to the Freescale MPL3115A2 pressure and temperature sensor.
It uses HiPi::Device::I2C as a backend.
Currently only one shot methods and some utilities are wrapped. It is recommeded that you implement your own module inheriting from HiPi::Interface::MPL3115A2 to suit your own requirement.
Methods
- new
- sysmod
- who_am_i
- active
- mode
- oversample
- delay_from_oversample
- reboot
- os_all_data
- os_both_data
- os_any_data
- os_altitude
- os_pressure
- os_temperature
- unpack_pressure
- pack_pressure
- unpack_altitude
- pack_altitude
- unpack_temperature
- pack_temperature
Method Description
# Method Example
Method Description
# Method Example
Method Description
# Method Example
Method Description
# Method Example
Method Description
# Method Example
Method Description
# Method Example
Method Description
# Method Example
Method Description
# Method Example
Method Description
# Method Example
Method Description
# Method Example
Method Description
# Method Example
Method Description
# Method Example
Method Description
# Method Example
Method Description
# Method Example
Method Description
# Method Example
Method Description
# Method Example
Method Description
# Method Example
Method Description
# Method Example
Method Description
# Method Example
Method Description
# Method Example
Example
use HiPi qw( :mpl3115a2 ); use HiPi::Interface::MPL3115A2; my $mpl = HiPi::Interface::MPL3115A2->new( address => 0x60 ); my $mplid = $mpl->who_am_i; print qq(Device ID $mplid\n); unless( $mplid == MPL3115A2_ID ) { die qq(bad device id); } my ( $alt, $pre, $tem ) = $mpl->os_all_data() ; print qq(Temperature $tem\n); print qq(Raw Pressure $pre\n); print qq(Raw Altitude $alt\n); # Google tells me my elevation my $elevation = 38.0; my $msl = $mpl->sea_level_pressure($pre, $elevation, $tem ); print qq(SL Pressure $msl\n\n);