NAME
    `Device::BusPirate::Chip::MPL3115A2' - use a MPL3115A2 chip with
    `Device::BusPirate'

DESCRIPTION
    This Device::BusPirate::Chip subclass provides specific communication to
    a Freescale Semiconductor MPL3115A2 chip attached to the Bus Pirate via
    I2C.

    The reader is presumed to be familiar with the general operation of this
    chip; the documentation here will not attempt to explain or define
    chip-specific concepts or features, only the use of this module to
    access them.

ACCESSORS
    The following methods documented with a trailing call to `->get' return
    Future instances.

  $config = $mpl->read_config->get
    Returns a `HASH' reference of the contents of control registers
    `CTRL_REG1' to `CTRL_REG3', using fields named from the data sheet.

  $mpl->change_config( %changes )->get
    Writes updates to the control registers `CTRL_REG1' to `CTRL_REG3'. This
    will be performed as a read-modify-write operation, so any fields not
    given as arguments to this method will retain their current values.

    Note that these two methods use a cache of configuration bytes to make
    subsequent modifications more efficient. This cache will not respect the
    "one-shot" nature of the `OST' and `RST' bits.

  $pressure = $mpl->get_sealevel_pressure->get
  $mpl->set_sealevel_pressure->get( $pressure )
    Read or write the barometric pressure calibration register which is used
    to convert pressure to altitude when the chip is in altimeter mode, in
    Pascals. The default value is 101,326 Pa.

  $pressure = $mpl->read_pressure->get
    Returns the value of the `OUT_P_*' registers, suitably converted into
    Pascals. (The chip must be in barometer mode and must *not* be in `RAW'
    mode for the conversion to work).

  $altitude = $mpl->read_altitude->get
    Returns the value of the `OUT_P_*' registers, suitably converted into
    metres. (The chip must be in altimeter mode and must *not* be in `RAW'
    mode for the conversion to work).

  $temperature = $mpl->read_temperature->get
    Returns the value of the `OUT_T_*' registers, suitable converted into
    degrees C. (The chip must *not* be in `RAW' mode for the conversion to
    work).

  $pressure = $mpl->read_min_pressure->get
  $pressure = $mpl->read_max_pressure->get
    Returns the values of the `P_MIN' and `P_MAX' registers, suitably
    converted into Pascals.

  $mpl->clear_min_pressure->get
  $mpl->clear_max_pressure->get
    Clear the `P_MIN' or `P_MAX' registers, resetting them to start again
    from the next measurement.

  $altitude = $mpl->read_min_altitude->get
  $altitude = $mpl->read_max_altitude->get
    Returns the values of the `P_MIN' and `P_MAX' registers, suitably
    converted into metres.

  $mpl->clear_min_altitude->get
  $mpl->clear_max_altitude->get
    Clear the `P_MIN' or `P_MAX' registers, resetting them to start again
    from the next measurement.

  $temperature = $mpl->read_min_temperature->get
  $temperature = $mpl->read_max_temperature->get
    Returns the values of the `T_MIN' and `T_MAX' registers, suitably
    converted into metres.

  $mpl->clear_min_temperature->get
  $mpl->clear_max_temperature->get
    Clear the `T_MIN' or `T_MAX' registers, resetting them to start again
    from the next measurement.

METHODS
  $mpl->check_id->get
    Reads the `WHO_AM_I' register and checks for a valid ID result. The
    returned future fails if the expected result is not received.

  $mpl->start_oneshot->get
    Sets the `OST' bit of `CTRL_REG1' to start a one-shot measurement when
    in standby mode. After calling this method you will need to use
    `busywait_oneshot' to wait for the measurement to finish, or rely
    somehow on the interrupts.

  $mpl->busywait_oneshot->get
    Repeatedly reads the `OST' bit of `CTRL_REG1' until it becomes clear.

  $mpl->oneshot->get
    A convenient wrapper around `start_oneshot' and `busywait_oneshot'.

AUTHOR
    Paul Evans <leonerd@leonerd.org.uk>

