NAME
    `Device::Chip::MPL3115A2' - chip driver for a MPL3115A2

DESCRIPTION
    This Device::Chip subclass provides specific communication to a
    Freescale Semiconductor MPL3115A2 attached to a computer via an I²C
    adapter.

    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.

  read_config
       $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.

  change_config
       $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.

  get_sealevel_pressure
  set_sealevel_pressure
       $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.

  read_pressure
       $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).

  read_altitude
       $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).

  read_temperature
       $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).

  read_min_pressure
  read_max_pressure
       $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.

  clear_min_pressure
  clear_max_pressure
       $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.

  read_min_altitude
  read_max_altitude
       $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.

  clear_min_altitude
  clear_max_altitude
       $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.

  read_min_temperature
  read_max_temperature
       $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.

  clear_min_temperature
  clear_max_temperature
       $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
  check_id
       $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.

  start_oneshot
       $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.

  busywait_oneshot
       $mpl->busywait_oneshot->get

    Repeatedly reads the `OST' bit of `CTRL_REG1' until it becomes clear.

  oneshot
       $mpl->oneshot->get

    A convenient wrapper around `start_oneshot' and `busywait_oneshot'.

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

