MPL3115A2 (mpl3115a2 v1.0.1)

MPL3115A2 Driver for Elixir using Wafer.

Link to this section Summary

Functions

Acquire a connection to the MPL3115A2 device using the passed in I2C connection.

ALARM_SEL The bit selects the Target value for SRC_PW/SRC_TW and SRC_PTH/SRC_TTH

ALARM_SEL The bit selects the Target value for SRC_PW/SRC_TW and SRC_PTH/SRC_TTH

OUT_P Altitude in meters.

OUT_P_DELTA Altitude delta in meters.

OFF_H Altitude Offset

OFF_H Altitude Offset

SRC_PCHG Delta P interrupt status.

SRC_PW Altitude/Pressure alerter status near or equal to target Pressure/Altitude.

SRC_PTH Altitude/Pressure threshold interrupt.

BAR_IN Barometric input for altitude calculations.

BAR_IN Barometric input for altitude calculations.

ST Auto acquisition time step.

ST Auto acquisition time step.

DREM Set data ready event mode.

DREM Get data ready event mode.

SRC_DRDY Data ready interrupt status.

F_WMRK Get FIFO Event Sample Count Watermark.

F_WMRK Set FIFO Event Sample Count Watermark.

SRC_FIFO FIFO interrupt status.

F_MODE get FIFO mode

F_MODE set FIFO mode

F_OVF FIFO overflow events detected?

F_DATA Read FIFO data in Altitude mode.

F_DATA Read FIFO data in Barometer mode.

F_CNT FIFO sample count

F_WMRK_FLAG FIFO watermark events detected?

IPOL1 The IPOL bit selects the polarity of the interrupt signal.

IPOL1 The IPOL bit selects the polarity of the interrupt signal.

PP_OD1 This bit configures the interrupt pin to Push-Pull or in Open Drain mode.

PP_OD1 This bit configures the interrupt pin to Push-Pull or in Open Drain mode.

IPOL2 The IPOL bit selects the polarity of the interrupt signal.

IPOL2 The IPOL bit selects the polarity of the interrupt signal.

PP_OD2 This bit configures the interrupt pin to Push-Pull or in Open Drain mode.

PP_OD2 This bit configures the interrupt pin to Push-Pull or in Open Drain mode.

INT_CFG_DRDY Data Ready Interrupt Pin Select.

INT_EN_DRDY Data Ready Interrupt Enable.

INT_EN_DRDY Data Ready Interrupt Enable.

INT_EN_FIFO FIFO Interrupt Enable.

INT_EN_FIFO FIFO Interrupt Enable.

INT_EN_PCHG Pressure Change Interrupt Enable.

INT_EN_PCHG Pressure Change Interrupt Enable.

INT_EN_PTH Pressure Threshold Interrupt Enable.

INT_EN_PTH Pressure Threshold Interrupt Enable.

INT_EN_PW Pressure Window Interrupt Enable.

INT_EN_PW Pressure Window Interrupt Enable.

INT_EN_TCHG Temperature Change Interrupt Enable.

INT_EN_TCHG Temperature Change Interrupt Enable.

INT_EN_TTH Temperature Threshold Interrupt Enable.

INT_EN_TTH Temperature Threshold Interrupt Enable.

INT_EN_TW Temperature Window Interrupt Enable.

INT_EN_TW Temperature Window Interrupt Enable.

INT_CFG_FIFO FIFO Interrupt Pin Select.

INT_CFG_FIFO FIFO Interrupt Pin Select.

INT_CFG_PCHG - Pressure Change Interrupt Pin Select

INT_CFG_PCHG - Pressure Change Interrupt Pin Select

INT_CFG_PTH Pressure Threshold Interrupt Pin Select

INT_CFG_PTH Pressure Threshold Interrupt Pin Select

INT_CFG_PW Pressure Window Interrupt Pin Select

INT_CFG_PW Pressure Window Interrupt Pin Select

INT_CFG_TCHG - Temperature Change Interrupt Pin Select

INT_CFG_TCHG - Temperature Change Interrupt Pin Select

INT_CFG_TTH Temperature Threshold Interrupt Pin Select

INT_CFG_TTH Temperature Threshold Interrupt Pin Select

INT_CFG_TW Temperature Window Interrupt Pin Select

INT_CFG_TW Temperature Window Interrupt Pin Select

INT_CFG_DRDY Data Ready Interrupt Pin Select.

LOAD_OUTPUT This is to load the target values for SRC_PW/SRC_TW and SRC_PTH/SRC_TTH.

LOAD_OUTPUT This is to load the target values for SRC_PW/SRC_TW and SRC_PTH/SRC_TTH.

P_MAX Captured maximum Pressure/Altitude value.

P_MAX Captured maximum Pressure/Altitude value.

T_MAX Captured maximum temperature value.

P_MIN Captured minimum Pressure/Altitude value.

P_MIN Captured minimum Pressure/Altitude value.

T_MIN Captured minimum temperature value.

OST One-shot measurement

OST One-shot measurement

ALT Altimeter-Barometer mode.

ALT Altimeter-Barometer mode.

Oversample delay in milliseconds.

OS Oversample Ratio.

OS Oversample Ratio.

OUT_P Pressure in Pascals.

PDEFE Data event flag enable on new Pressure/Altitude data.

PDEFE Data event flag enable on new Pressure/Altitude data.

P_WND Pressure/Altitude window value.

P_WND Pressure/Altitude window value.

POW Pressure/Altitude data overwrite.

PDR Pressure/Altitude new data available.

OUT_P_DELTA Pressure delta in Pascals.

OFF_P Pressure Offset

OFF_P Pressure Offset

P_TGT Altitude/Pressure target value.

P_TGT Altitude/Pressure target value.

PTOW Pressure/Altitude OR Temperature data overwrite.

PTDR Pressure/Altitude OR Temperature data ready.

RAW Raw output mode.

RAW Raw output mode.

RST Software Reset.

SBYB System Standby

SBYB System Standby

SYSMOD Get System Mode, either :standby or :active.

OUT_T Temperature in ℃.

TOW Temperature data overwrite.

TDR Temperature new Data Available.

OUT_T_DELTA Temperature delta in ℃.

SRC_TCHG Delta T interrupt status.

TDEFE Data event flag enable on new Temperature data.

TDEFE Data event flag enable on new Temperature data.

SRC_TW Temperature alerter status bit near or equal to target temperature.

OFF_T Temperature Offset

OFF_T Temperature Offset

T_TGT Temperature target value input in °C.

T_TGT Temperature target value input in °C.

SRC_TTH Temperature threshold interrupt.

T_WND Temperature alarm window value in °C.

T_WND Temperature alarm window value in °C.

WHO_AM_I Verify the device's identity

Link to this section Types

Link to this type

acquire_option()

@type acquire_option() ::
  {:conn, Wafer.Conn.t()}
  | {:standby, boolean()}
  | {:oversample, oversample()}
  | {:mode, mode()}
  | {:event_on_new_temperature, boolean()}
  | {:event_on_new_pressue, boolean()}
  | {:data_ready_event_mode, boolean()}
Link to this type

acquire_options()

@type acquire_options() :: [acquire_option()]
@type altitude() :: float()
@type fifo_mode() :: :fifo_disabled | :circular_buffer | :halt_on_overflow
@type mode() :: :altimeter | :barometer
Link to this type

oversample()

@type oversample() :: 1 | 2 | 4 | 8 | 16 | 32 | 64
@type pressure() :: float()
@type t() :: %MPL3115A2{conn: Wafer.Conn.t()}
Link to this type

temperature()

@type temperature() :: float()

Link to this section Functions

Link to this function

acquire(options)

@spec acquire(acquire_options()) :: {:ok, t()} | {:error, reason :: any()}

Acquire a connection to the MPL3115A2 device using the passed in I2C connection.

Options:

  • conn an I2C connection, probably from ElixirALE.I2C or Circuits.I2C.
  • standby set to true to put the device in standby, otherwise defaults to false.
  • mode set to either :altimeter or :barometer. Defaults to :altimeter.
  • event_on_new_temperature set to false to disable. Defaults to true.
  • event_on_new_pressure set to false to disable. Defaults to true.
  • data_ready_event_mode set to false to disable. Defaults to true.
Link to this function

alarm_select(mpl3115_a2)

@spec alarm_select(t()) :: {:ok, 0 | 1} | {:error, reason :: any()}

ALARM_SEL The bit selects the Target value for SRC_PW/SRC_TW and SRC_PTH/SRC_TTH

Default value: 0 0: The values in P_TGT_MSB, P_TGT_LSB and T_TGT are used (Default) 1: The values in OUT_P/OUT_T are used for calculating the interrupts SRC_PW/SRC_TW and SRC_PTH/SRC_TTH.

Link to this function

alarm_select(dev, value)

@spec alarm_select(t(), 0 | 1) :: {:ok, t()} | {:error, reason :: any()}

ALARM_SEL The bit selects the Target value for SRC_PW/SRC_TW and SRC_PTH/SRC_TTH

Default value: 0 0: The values in P_TGT_MSB, P_TGT_LSB and T_TGT are used (Default) 1: The values in OUT_P/OUT_T are used for calculating the interrupts SRC_PW/SRC_TW and SRC_PTH/SRC_TTH.

Link to this function

altitude(mpl3115_a2)

@spec altitude(t()) :: {:ok, altitude()} | {:error, reason :: any()}

OUT_P Altitude in meters.

Link to this function

altitude_delta(mpl3115_a2)

@spec altitude_delta(t()) :: {:ok, altitude()} | {:error, reason :: any()}

OUT_P_DELTA Altitude delta in meters.

Link to this function

altitude_offset(mpl3115_a2)

@spec altitude_offset(t()) :: {:ok, -128..127} | {:error, reason :: any()}

OFF_H Altitude Offset

Altitude user accessible offset trim value.

Link to this function

altitude_offset(dev, value)

@spec altitude_offset(t(), non_neg_integer()) ::
  {:ok, t()} | {:error, reason :: any()}

OFF_H Altitude Offset

Altitude user accessible offset trim value.

Link to this function

altitude_pressure_delta_interrupt?(mpl3115_a2)

@spec altitude_pressure_delta_interrupt?(t()) :: boolean()

SRC_PCHG Delta P interrupt status.

Link to this function

altitude_pressure_interrupt?(mpl3115_a2)

@spec altitude_pressure_interrupt?(t()) :: boolean()

SRC_PW Altitude/Pressure alerter status near or equal to target Pressure/Altitude.

Near is within target value ± window value. Window value needs to be non zero for interrupt to trigger.

Link to this function

altitude_pressure_threshold_interrupt?(mpl3115_a2)

@spec altitude_pressure_threshold_interrupt?(t()) :: boolean()

SRC_PTH Altitude/Pressure threshold interrupt.

With the window set to a non zero value, the trigger will occur on crossing any of the thresholds: upper, center or lower. If the window is set to 0, it will only trigger on crossing the center threshold.

Link to this function

barometric_pressure_input(mpl3115_a2)

@spec barometric_pressure_input(t()) :: {:ok, pressure()} | {:error, reason :: any()}

BAR_IN Barometric input for altitude calculations.

Input is equivalent sea level pressure for measurement location.

Link to this function

barometric_pressure_input(dev, pascals)

@spec barometric_pressure_input(t(), pressure()) ::
  {:ok, pressure()} | {:error, reason :: any()}

BAR_IN Barometric input for altitude calculations.

Input is equivalent sea level pressure for measurement location in Pascals.

Link to this function

data_acquisition_time_step(mpl3115_a2)

@spec data_acquisition_time_step(t()) ::
  {:ok, non_neg_integer()} | {:error, reason :: any()}

ST Auto acquisition time step.

Link to this function

data_acquisition_time_step(dev, value)

@spec data_acquisition_time_step(t(), non_neg_integer()) ::
  {:ok, t()} | {:error, reason :: any()}

ST Auto acquisition time step.

Link to this function

data_ready_event_mode(dev, bool)

@spec data_ready_event_mode(t(), boolean()) :: {:ok, t()} | {:error, reason :: any()}

DREM Set data ready event mode.

If the DREM bit is set true and one or more of the data ready event flags (PDEFE, TDEFE) are enabled, then an event flag will be raised upon change in state of the data. If the DREM bit is false and one or more of the data ready event flags are enabled, then an event flag will be raised whenever the system acquires a new set of data.

Default value: false.

Link to this function

data_ready_event_mode?(mpl3115_a2)

@spec data_ready_event_mode?(t()) :: boolean()

DREM Get data ready event mode.

If the DREM bit is set true and one or more of the data ready event flags (PDEFE, TDEFE) are enabled, then an event flag will be raised upon change in state of the data. If the DREM bit is false and one or more of the data ready event flags are enabled, then an event flag will be raised whenever the system acquires a new set of data.

Default value: false.

Link to this function

data_ready_interrupt?(mpl3115_a2)

@spec data_ready_interrupt?(t()) :: boolean()

SRC_DRDY Data ready interrupt status.

true indicates that Pressure/Altitude or Temperature data ready interrupt is active indicating the presence of new data and/or a data overwrite, otherwise it is false.

Link to this function

fifo_event_sample_count_watermark(mpl3115_a2)

@spec fifo_event_sample_count_watermark(t()) ::
  {:ok, 0..31} | {:error, reason :: any()}

F_WMRK Get FIFO Event Sample Count Watermark.

Link to this function

fifo_event_sample_count_watermark(dev, count)

@spec fifo_event_sample_count_watermark(t(), 0..31) ::
  {:ok, t()} | {:error, reason :: any()}

F_WMRK Set FIFO Event Sample Count Watermark.

Link to this function

fifo_interrupt?(mpl3115_a2)

@spec fifo_interrupt?(t()) :: boolean()

SRC_FIFO FIFO interrupt status.

true indicates that a FIFO interrupt event such as an overflow event has occurred. false indicates that no FIFO interrupt event has occurred.

Link to this function

fifo_mode(mpl3115_a2)

@spec fifo_mode(t()) :: {:ok, fifo_mode()} | {:error, reason :: any()}

F_MODE get FIFO mode

Can be either :fifo_disabled, :circular_buffer, or :halt_on_overflow.

Link to this function

fifo_mode(dev, atom)

@spec fifo_mode(t(), fifo_mode()) :: {:ok, t()} | {:error, reason :: any()}

F_MODE set FIFO mode

Can be either :fifo_disabled, :circular_buffer, or :halt_on_overflow.

Link to this function

fifo_overflow?(mpl3115_a2)

@spec fifo_overflow?(t()) :: boolean()

F_OVF FIFO overflow events detected?

Link to this function

fifo_read_altitude(dev)

@spec fifo_read_altitude(t()) :: {:ok, [altitude()]} | {:error, reason :: any()}

F_DATA Read FIFO data in Altitude mode.

Link to this function

fifo_read_pressure(dev)

@spec fifo_read_pressure(t()) :: {:ok, [pressure()]} | {:error, reason :: any()}

F_DATA Read FIFO data in Barometer mode.

Link to this function

fifo_sample_count(mpl3115_a2)

@spec fifo_sample_count(t()) :: {:ok, non_neg_integer()} | {:error, reason :: any()}

F_CNT FIFO sample count

Link to this function

fifo_watermark?(mpl3115_a2)

@spec fifo_watermark?(t()) :: boolean()

F_WMRK_FLAG FIFO watermark events detected?

Link to this function

interrupt1_polarity(mpl3115_a2)

@spec interrupt1_polarity(t()) ::
  {:ok, :active_high | :active_low} | {:error, reason :: any()}

IPOL1 The IPOL bit selects the polarity of the interrupt signal.

Select whether the interrupt pin should be used in an active high or active low configuration. Defaults to active low.

Link to this function

interrupt1_polarity(dev, atom)

@spec interrupt1_polarity(t(), :active_high | :active_low) ::
  {:ok, t()} | {:error, reason :: any()}

IPOL1 The IPOL bit selects the polarity of the interrupt signal.

Select whether the interrupt pin should be used in an active high or active low configuration. Defaults to active low.

Link to this function

interrupt1_pull_mode(mpl3115_a2)

@spec interrupt1_pull_mode(t()) ::
  {:ok, :pull_up | :open_drain} | {:error, reason :: any()}

PP_OD1 This bit configures the interrupt pin to Push-Pull or in Open Drain mode.

The default value is 0 which corresponds to Push-Pull mode. The open drain configuration can be used for connecting multiple interrupt signals on the same interrupt line. Push-Pull/Open Drain selection on interrupt pad INT1.

Can be in either pull up or open drain mode. Defaults to pull up.

Link to this function

interrupt1_pull_mode(dev, atom)

@spec interrupt1_pull_mode(t(), :pull_up | :open_drain) ::
  {:ok, t()} | {:error, reason :: any()}

PP_OD1 This bit configures the interrupt pin to Push-Pull or in Open Drain mode.

The default value is 0 which corresponds to Push-Pull mode. The open drain configuration can be used for connecting multiple interrupt signals on the same interrupt line. Push-Pull/Open Drain selection on interrupt pad INT1.

Can be in either pull up or open drain mode. Defaults to pull up.

Link to this function

interrupt2_polarity(mpl3115_a2)

@spec interrupt2_polarity(t()) ::
  {:ok, :active_high | :active_low} | {:error, reason :: any()}

IPOL2 The IPOL bit selects the polarity of the interrupt signal.

Select whether the interrupt pin should be used in an active high or active low configuration. Defaults to active low.

Link to this function

interrupt2_polarity(dev, atom)

@spec interrupt2_polarity(t(), :active_high | :active_low) ::
  {:ok, t()} | {:error, reason :: any()}

IPOL2 The IPOL bit selects the polarity of the interrupt signal.

Select whether the interrupt pin should be used in an active high or active low configuration. Defaults to active low.

Link to this function

interrupt2_pull_mode(mpl3115_a2)

@spec interrupt2_pull_mode(t()) ::
  {:ok, :pull_up | :open_drain} | {:error, reason :: any()}

PP_OD2 This bit configures the interrupt pin to Push-Pull or in Open Drain mode.

The default value is 0 which corresponds to Push-Pull mode. The open drain configuration can be used for connecting multiple interrupt signals on the same interrupt line. Push-Pull/Open Drain selection on interrupt pad INT1.

Can be in either pull up or open drain mode. Defaults to pull up.

Link to this function

interrupt2_pull_mode(dev, atom)

@spec interrupt2_pull_mode(t(), :pull_up | :open_drain) ::
  {:ok, t()} | {:error, reason :: any()}

PP_OD2 This bit configures the interrupt pin to Push-Pull or in Open Drain mode.

The default value is 0 which corresponds to Push-Pull mode. The open drain configuration can be used for connecting multiple interrupt signals on the same interrupt line. Push-Pull/Open Drain selection on interrupt pad INT1.

Can be in either pull up or open drain mode. Defaults to pull up.

Link to this function

interrupt_data_ready_pin(dev, int)

@spec interrupt_data_ready_pin(t(), 1 | 2) :: {:ok, t()} | {:error, reason :: any()}

INT_CFG_DRDY Data Ready Interrupt Pin Select.

1 - Interrupt Pin 1 2 - Interrupt Pin 2

Link to this function

interrupt_enable_data_ready(dev, bool)

@spec interrupt_enable_data_ready(t(), boolean()) ::
  {:ok, t()} | {:error, reason :: any()}

INT_EN_DRDY Data Ready Interrupt Enable.

Defaults to false.

Link to this function

interrupt_enable_data_ready?(mpl3115_a2)

@spec interrupt_enable_data_ready?(t()) :: boolean()

INT_EN_DRDY Data Ready Interrupt Enable.

Defaults to false.

Link to this function

interrupt_enable_fifo(dev, bool)

@spec interrupt_enable_fifo(t(), boolean()) :: {:ok, t()} | {:error, reason :: any()}

INT_EN_FIFO FIFO Interrupt Enable.

Default value: false false: FIFO interrupt disabled true: FIFO interrupt enabled

Link to this function

interrupt_enable_fifo?(mpl3115_a2)

@spec interrupt_enable_fifo?(t()) :: boolean()

INT_EN_FIFO FIFO Interrupt Enable.

Default value: false false: FIFO interrupt disabled true: FIFO interrupt enabled

Link to this function

interrupt_enable_pressure_change(dev, bool)

@spec interrupt_enable_pressure_change(t(), boolean()) ::
  {:ok, t()} | {:error, reason :: any()}

INT_EN_PCHG Pressure Change Interrupt Enable.

Default value: false false: Pressure Change interrupt disabled true: Pressure Change interrupt enabled

Link to this function

interrupt_enable_pressure_change?(mpl3115_a2)

@spec interrupt_enable_pressure_change?(t()) :: boolean()

INT_EN_PCHG Pressure Change Interrupt Enable.

Default value: false false: Pressure Change interrupt disabled true: Pressure Change interrupt enabled

Link to this function

interrupt_enable_pressure_threshold(dev, bool)

@spec interrupt_enable_pressure_threshold(t(), boolean()) ::
  {:ok, t()} | {:error, reason :: any()}

INT_EN_PTH Pressure Threshold Interrupt Enable.

Default value: false false: Pressure Threshold interrupt disabled true: Pressure Threshold interrupt enabled

Link to this function

interrupt_enable_pressure_threshold?(mpl3115_a2)

@spec interrupt_enable_pressure_threshold?(t()) :: boolean()

INT_EN_PTH Pressure Threshold Interrupt Enable.

Default value: false false: Pressure Threshold interrupt disabled true: Pressure Threshold interrupt enabled

Link to this function

interrupt_enable_pressure_window(dev, bool)

@spec interrupt_enable_pressure_window(t(), boolean()) ::
  {:ok, t()} | {:error, reason :: any()}

INT_EN_PW Pressure Window Interrupt Enable.

Default value: false false: Pressure window interrupt disabled true: Pressure window interrupt enabled

Link to this function

interrupt_enable_pressure_window?(mpl3115_a2)

@spec interrupt_enable_pressure_window?(t()) :: boolean()

INT_EN_PW Pressure Window Interrupt Enable.

Default value: false false: Pressure window interrupt disabled true: Pressure window interrupt enabled

Link to this function

interrupt_enable_temperature_change(dev, bool)

@spec interrupt_enable_temperature_change(t(), boolean()) ::
  {:ok, t()} | {:error, reason :: any()}

INT_EN_TCHG Temperature Change Interrupt Enable.

Default value: false false: Temperature Change interrupt disabled true: Temperature Change interrupt enabled

Link to this function

interrupt_enable_temperature_change?(mpl3115_a2)

@spec interrupt_enable_temperature_change?(t()) :: boolean()

INT_EN_TCHG Temperature Change Interrupt Enable.

Default value: false false: Temperature Change interrupt disabled true: Temperature Change interrupt enabled

Link to this function

interrupt_enable_temperature_threshold(dev, bool)

@spec interrupt_enable_temperature_threshold(t(), boolean()) ::
  {:ok, t()} | {:error, reason :: any()}

INT_EN_TTH Temperature Threshold Interrupt Enable.

Default value: false false: Temperature Threshold interrupt disabled true: Temperature Threshold interrupt enabled

Link to this function

interrupt_enable_temperature_threshold?(mpl3115_a2)

@spec interrupt_enable_temperature_threshold?(t()) :: boolean()

INT_EN_TTH Temperature Threshold Interrupt Enable.

Default value: false false: Temperature Threshold interrupt disabled true: Temperature Threshold interrupt enabled

Link to this function

interrupt_enable_temperature_window(dev, bool)

@spec interrupt_enable_temperature_window(t(), boolean()) ::
  {:ok, t()} | {:error, reason :: any()}

INT_EN_TW Temperature Window Interrupt Enable.

Interrupt Enable. Default value: false false: Temperature window interrupt disabled true: Temperature window interrupt enabled

Link to this function

interrupt_enable_temperature_window?(mpl3115_a2)

@spec interrupt_enable_temperature_window?(t()) :: boolean()

INT_EN_TW Temperature Window Interrupt Enable.

Interrupt Enable. Default value: false false: Temperature window interrupt disabled true: Temperature window interrupt enabled

Link to this function

interrupt_fifo_pin(mpl3115_a2)

@spec interrupt_fifo_pin(t()) :: {:ok, 1 | 2} | {:error, reason :: any()}

INT_CFG_FIFO FIFO Interrupt Pin Select.

1 - Interrupt Pin 1 2 - Interrupt Pin 2

Link to this function

interrupt_fifo_pin(dev, int)

@spec interrupt_fifo_pin(t(), 1 | 2) :: {:ok, t()} | {:error, reason :: any()}

INT_CFG_FIFO FIFO Interrupt Pin Select.

1 - Interrupt Pin 1 2 - Interrupt Pin 2

Link to this function

interrupt_pressure_change_pin(mpl3115_a2)

@spec interrupt_pressure_change_pin(t()) :: {:ok, 1 | 2} | {:error, reason :: any()}

INT_CFG_PCHG - Pressure Change Interrupt Pin Select

1 - Interrupt Pin 1 2 - Interrupt Pin 2

Link to this function

interrupt_pressure_change_pin(dev, int)

@spec interrupt_pressure_change_pin(t(), 1 | 2) ::
  {:ok, t()} | {:error, reason :: any()}

INT_CFG_PCHG - Pressure Change Interrupt Pin Select

1 - Interrupt Pin 1 2 - Interrupt Pin 2

Link to this function

interrupt_pressure_threshold_pin(mpl3115_a2)

@spec interrupt_pressure_threshold_pin(t()) ::
  {:ok, 1 | 2} | {:error, reason :: any()}

INT_CFG_PTH Pressure Threshold Interrupt Pin Select

1 - Interrupt Pin 1 2 - Interrupt Pin 2

Link to this function

interrupt_pressure_threshold_pin(dev, int)

@spec interrupt_pressure_threshold_pin(t(), 1 | 2) ::
  {:ok, t()} | {:error, reason :: any()}

INT_CFG_PTH Pressure Threshold Interrupt Pin Select

1 - Interrupt Pin 1 2 - Interrupt Pin 2

Link to this function

interrupt_pressure_window_pin(mpl3115_a2)

@spec interrupt_pressure_window_pin(t()) :: {:ok, 1 | 2} | {:error, reason :: any()}

INT_CFG_PW Pressure Window Interrupt Pin Select

1 - Interrupt Pin 1 2 - Interrupt Pin 2

Link to this function

interrupt_pressure_window_pin(dev, int)

@spec interrupt_pressure_window_pin(t(), 1 | 2) ::
  {:ok, t()} | {:error, reason :: any()}

INT_CFG_PW Pressure Window Interrupt Pin Select

1 - Interrupt Pin 1 2 - Interrupt Pin 2

Link to this function

interrupt_temperature_change_pin(mpl3115_a2)

@spec interrupt_temperature_change_pin(t()) ::
  {:ok, 1 | 2} | {:error, reason :: any()}

INT_CFG_TCHG - Temperature Change Interrupt Pin Select

1 - Interrupt Pin 1 2 - Interrupt Pin 2

Link to this function

interrupt_temperature_change_pin(dev, int)

@spec interrupt_temperature_change_pin(t(), 1 | 2) ::
  {:ok, t()} | {:error, reason :: any()}

INT_CFG_TCHG - Temperature Change Interrupt Pin Select

1 - Interrupt Pin 1 2 - Interrupt Pin 2

Link to this function

interrupt_temperature_threshold_pin(mpl3115_a2)

@spec interrupt_temperature_threshold_pin(t()) ::
  {:ok, 1 | 2} | {:error, reason :: any()}

INT_CFG_TTH Temperature Threshold Interrupt Pin Select

1 - Interrupt Pin 1 2 - Interrupt Pin 2

Link to this function

interrupt_temperature_threshold_pin(dev, int)

@spec interrupt_temperature_threshold_pin(t(), 1 | 2) ::
  {:ok, t()} | {:error, reason :: any()}

INT_CFG_TTH Temperature Threshold Interrupt Pin Select

1 - Interrupt Pin 1 2 - Interrupt Pin 2

Link to this function

interrupt_temperature_window_pin(mpl3115_a2)

@spec interrupt_temperature_window_pin(t()) ::
  {:ok, 1 | 2} | {:error, reason :: any()}

INT_CFG_TW Temperature Window Interrupt Pin Select

1 - Interrupt Pin 1 2 - Interrupt Pin 2

Link to this function

interrupt_temperature_window_pin(dev, int)

@spec interrupt_temperature_window_pin(t(), 1 | 2) ::
  {:ok, t()} | {:error, reason :: any()}

INT_CFG_TW Temperature Window Interrupt Pin Select

1 - Interrupt Pin 1 2 - Interrupt Pin 2

Link to this function

interupt_data_ready_pin(mpl3115_a2)

@spec interupt_data_ready_pin(t()) :: {:ok, 1 | 2} | {:error, reason :: any()}

INT_CFG_DRDY Data Ready Interrupt Pin Select.

1 - Interrupt Pin 1 2 - Interrupt Pin 2

Link to this function

load_output(mpl3115_a2)

@spec load_output(t()) :: {:ok, 0 | 1} | {:error, reason :: any()}

LOAD_OUTPUT This is to load the target values for SRC_PW/SRC_TW and SRC_PTH/SRC_TTH.

Default value: 0 0: Do not load OUT_P/OUT_T as target values 1: The next values of OUT_P/OUT_T are used to set the target values for the interrupts. Note:

1. This bit must be set at least once if ALARM_SEL=1
2. To reload the next OUT_P/OUT_T as the target values clear and set again.
Link to this function

load_output(dev, value)

@spec load_output(t(), 0 | 1) :: {:ok, t()} | {:error, reason :: any()}

LOAD_OUTPUT This is to load the target values for SRC_PW/SRC_TW and SRC_PTH/SRC_TTH.

Default value: 0 0: Do not load OUT_P/OUT_T as target values 1: The next values of OUT_P/OUT_T are used to set the target values for the interrupts. Note:

1. This bit must be set at least once if ALARM_SEL=1
2. To reload the next OUT_P/OUT_T as the target values clear and set again.
Link to this function

maximum_altitude(mpl3115_a2)

@spec maximum_altitude(t()) :: {:ok, altitude()} | {:error, reason :: any()}

P_MAX Captured maximum Pressure/Altitude value.

Link to this function

maximum_pressure(mpl3115_a2)

@spec maximum_pressure(t()) :: {:ok, pressure()} | {:error, reason :: any()}

P_MAX Captured maximum Pressure/Altitude value.

Link to this function

maximum_temperature(mpl3115_a2)

@spec maximum_temperature(t()) :: {:ok, temperature()} | {:error, reason :: any()}

T_MAX Captured maximum temperature value.

Link to this function

minimum_altitude(mpl3115_a2)

@spec minimum_altitude(t()) :: {:ok, altitude()} | {:error, reason :: any()}

P_MIN Captured minimum Pressure/Altitude value.

Interpreted as a altitude in meters.

Link to this function

minimum_pressure(mpl3115_a2)

@spec minimum_pressure(t()) :: {:ok, pressure()} | {:error, reason :: any()}

P_MIN Captured minimum Pressure/Altitude value.

Interpreted as a pressure in Pascals.

Link to this function

minimum_temperature(mpl3115_a2)

@spec minimum_temperature(t()) :: {:ok, temperature()} | {:error, reason :: any()}

T_MIN Captured minimum temperature value.

Link to this function

oneshot_mode(dev, value)

@spec oneshot_mode(t(), boolean()) :: {:ok, t()} | {:error, reason :: any()}

OST One-shot measurement

OST bit will initiate a measurement immediately. If the SBYB bit is set to active, setting the OST bit will initiate an immediate measurement, the part will then return to acquiring data as per the setting of the ST bits in CTRL_REG2. In this mode, the OST bit does not clear itself and must be cleared and set again to initiate another immediate measurement.

One Shot: When SBYB is 0, the OST bit is an auto-clear bit. When OST is set, the device initiates a measurement by going into active mode. Once a Pressure/Altitude and Temperature measurement is completed, it clears the OST bit and comes back to STANDBY mode. User shall read the value of the OST bit before writing to this bit again.

Link to this function

oneshot_mode?(mpl3115_a2)

@spec oneshot_mode?(t()) :: boolean()

OST One-shot measurement

OST bit will initiate a measurement immediately. If the SBYB bit is set to active, setting the OST bit will initiate an immediate measurement, the part will then return to acquiring data as per the setting of the ST bits in CTRL_REG2. In this mode, the OST bit does not clear itself and must be cleared and set again to initiate another immediate measurement.

One Shot: When SBYB is 0, the OST bit is an auto-clear bit. When OST is set, the device initiates a measurement by going into active mode. Once a Pressure/Altitude and Temperature measurement is completed, it clears the OST bit and comes back to STANDBY mode. User shall read the value of the OST bit before writing to this bit again.

Link to this function

operating_mode(mpl3115_a2)

@spec operating_mode(t()) :: {:ok, mode()} | {:error, reason :: any()}

ALT Altimeter-Barometer mode.

Selects whether the device is in Altimeter or Barometer mode. Can be either :barometer or :altimeter.

Link to this function

operating_mode(dev, atom)

@spec operating_mode(t(), mode()) :: {:ok, t()} | {:error, reason :: any()}

ALT Altimeter-Barometer mode.

Selects whether the device is in Altimeter or Barometer mode. Can be either :barometer or :altimeter.

Link to this function

oversample_delay(conn)

@spec oversample_delay(t()) :: {:ok, non_neg_integer()} | {:error, reason :: any()}

Oversample delay in milliseconds.

Link to this function

oversample_ratio(mpl3115_a2)

@spec oversample_ratio(t()) :: {:ok, non_neg_integer()} | {:error, reason :: any()}

OS Oversample Ratio.

Link to this function

oversample_ratio(dev, value)

@spec oversample_ratio(t(), non_neg_integer()) ::
  {:ok, t()} | {:error, reason :: any()}

OS Oversample Ratio.

Link to this function

pressure(mpl3115_a2)

@spec pressure(t()) :: {:ok, pressure()} | {:error, reason :: any()}

OUT_P Pressure in Pascals.

Link to this function

pressure_altitude_event_flag_enable(dev, bool)

@spec pressure_altitude_event_flag_enable(t(), boolean()) ::
  {:ok, t()} | {:error, reason :: any()}

PDEFE Data event flag enable on new Pressure/Altitude data.

Default value: false.

Link to this function

pressure_altitude_event_flag_enable?(mpl3115_a2)

@spec pressure_altitude_event_flag_enable?(t()) :: boolean()

PDEFE Data event flag enable on new Pressure/Altitude data.

Default value: false.

Link to this function

pressure_altitude_window(mpl3115_a2)

@spec pressure_altitude_window(t()) ::
  {:ok, pressure() | altitude()} | {:error, reason :: any()}

P_WND Pressure/Altitude window value.

In Altitude mode the result is in meters. In Pressure mode the result is in Pascals.

Link to this function

pressure_altitude_window(dev, pressure_or_altitude)

@spec pressure_altitude_window(t(), pressure() | altitude()) ::
  {:ok, t()} | {:error, reason :: any()}

P_WND Pressure/Altitude window value.

In Altitude mode the result is in meters. In Pressure mode the result is in Pascals.

Link to this function

pressure_data_overwrite?(mpl3115_a2)

@spec pressure_data_overwrite?(t()) :: boolean()

POW Pressure/Altitude data overwrite.

Link to this function

pressure_data_ready?(mpl3115_a2)

@spec pressure_data_ready?(t()) :: boolean()

PDR Pressure/Altitude new data available.

Link to this function

pressure_delta(mpl3115_a2)

@spec pressure_delta(t()) :: {:ok, pressure()} | {:error, reason :: any()}

OUT_P_DELTA Pressure delta in Pascals.

Link to this function

pressure_offset(mpl3115_a2)

@spec pressure_offset(t()) :: {:ok, non_neg_integer()} | {:error, reason :: any()}

OFF_P Pressure Offset

Pressure user accessible offset trim value.

Link to this function

pressure_offset(dev, value)

@spec pressure_offset(t(), non_neg_integer()) ::
  {:ok, t()} | {:error, reason :: any()}

OFF_P Pressure Offset

Pressure user accessible offset trim value.

Link to this function

pressure_or_altitude_target(mpl3115_a2)

@spec pressure_or_altitude_target(t()) ::
  {:ok, pressure() | altitude()} | {:error, reason :: any()}

P_TGT Altitude/Pressure target value.

This value works in conjunction with the window value (P_WND).

In Altitude mode the result is in meters. In Pressure mode the result is in Pascals.

Link to this function

pressure_or_altitude_target(dev, pressure_or_altitude)

@spec pressure_or_altitude_target(t(), pressure() | altitude()) ::
  {:ok, t()} | {:error, reason :: any()}

P_TGT Altitude/Pressure target value.

This value works in conjunction with the window value (P_WND).

In Altitude mode the result is in meters. In Pressure mode the result is in Pascals.

Link to this function

pressure_or_temperature_data_overwrite?(mpl3115_a2)

@spec pressure_or_temperature_data_overwrite?(t()) :: boolean()

PTOW Pressure/Altitude OR Temperature data overwrite.

Link to this function

pressure_or_temperature_data_ready?(mpl3115_a2)

@spec pressure_or_temperature_data_ready?(t()) :: boolean()

PTDR Pressure/Altitude OR Temperature data ready.

Link to this function

raw_output(dev, bool)

@spec raw_output(t(), boolean()) :: {:ok, t()} | {:error, reason :: any()}

RAW Raw output mode.

RAW bit will output ADC data with no post processing, except for oversampling. No scaling or offsets will be applied in the digital domain. The FIFO must be disabled and all other functionality: Alarms, Deltas, and other interrupts are disabled.

Link to this function

raw_output?(mpl3115_a2)

@spec raw_output?(t()) :: boolean()

RAW Raw output mode.

RAW bit will output ADC data with no post processing, except for oversampling. No scaling or offsets will be applied in the digital domain. The FIFO must be disabled and all other functionality: Alarms, Deltas, and other interrupts are disabled.

@spec reset(t()) :: {:ok, t()} | {:error, reason :: any()}

RST Software Reset.

This bit is used to activate the software reset. The Boot mechanism can be enabled in STANDBY and ACTIVE mode.

When the Boot bit is enabled the boot mechanism resets all functional block registers and loads the respective internal registers with default values. If the system was already in STANDBY mode, the reboot process will immediately begin; else if the system was in ACTIVE mode, the boot mechanism will automatically transition the system from ACTIVE mode to STANDBY mode, only then can the reboot process begin.

The I2C communication system is reset to avoid accidental corrupted data access.

Link to this function

standby_mode(dev, value)

@spec standby_mode(t(), boolean()) :: {:ok, t()} | {:error, reason :: any()}

SBYB System Standby

Link to this function

standby_mode?(mpl3115_a2)

@spec standby_mode?(t()) :: boolean()

SBYB System Standby

Link to this function

system_mode(mpl3115_a2)

@spec system_mode(t()) :: {:ok, :standby | :active} | {:error, reason :: any()}

SYSMOD Get System Mode, either :standby or :active.

Link to this function

temperature(mpl3115_a2)

@spec temperature(t()) :: {:ok, temperature()} | {:error, reason :: any()}

OUT_T Temperature in ℃.

Link to this function

temperature_data_overwrite?(mpl3115_a2)

@spec temperature_data_overwrite?(t()) :: boolean()

TOW Temperature data overwrite.

Link to this function

temperature_data_ready?(mpl3115_a2)

@spec temperature_data_ready?(t()) :: boolean()

TDR Temperature new Data Available.

Link to this function

temperature_delta(mpl3115_a2)

@spec temperature_delta(t()) :: {:ok, temperature()} | {:error, reason :: any()}

OUT_T_DELTA Temperature delta in ℃.

Link to this function

temperature_delta_interrupt?(mpl3115_a2)

@spec temperature_delta_interrupt?(t()) :: boolean()

SRC_TCHG Delta T interrupt status.

Link to this function

temperature_event_flag_enable(dev, bool)

@spec temperature_event_flag_enable(t(), boolean()) ::
  {:ok, t()} | {:error, reason :: any()}

TDEFE Data event flag enable on new Temperature data.

Default value: false.

Link to this function

temperature_event_flag_enable?(mpl3115_a2)

@spec temperature_event_flag_enable?(t()) :: boolean()

TDEFE Data event flag enable on new Temperature data.

Default value: false.

Link to this function

temperature_interrupt?(mpl3115_a2)

@spec temperature_interrupt?(t()) :: boolean()

SRC_TW Temperature alerter status bit near or equal to target temperature.

Near is within target value ± window value. Window value needs to be non zero for interrupt to trigger.

Link to this function

temperature_offset(mpl3115_a2)

@spec temperature_offset(t()) :: {:ok, float()} | {:error, reason :: any()}

OFF_T Temperature Offset

Temperature user accessible offset trim value.

Link to this function

temperature_offset(dev, value)

@spec temperature_offset(t(), float()) :: {:ok, t()} | {:error, reason :: any()}

OFF_T Temperature Offset

Temperature user accessible offset trim value.

Link to this function

temperature_target(mpl3115_a2)

@spec temperature_target(t()) :: {:ok, temperature()} | {:error, reason :: any()}

T_TGT Temperature target value input in °C.

Link to this function

temperature_target(dev, temperature)

@spec temperature_target(t(), temperature()) :: {:ok, t()} | {:error, reason :: any()}

T_TGT Temperature target value input in °C.

Link to this function

temperature_threshold_interrupt?(mpl3115_a2)

@spec temperature_threshold_interrupt?(t()) :: boolean()

SRC_TTH Temperature threshold interrupt.

With the window set to a non zero value, the trigger will occur on crossing any of the thresholds: upper, center or lower. If the window is set to 0, it will only trigger on crossing the center threshold.

Link to this function

temperature_window(mpl3115_a2)

@spec temperature_window(t()) :: {:ok, temperature()} | {:error, reason :: any()}

T_WND Temperature alarm window value in °C.

Link to this function

temperature_window(dev, temperature)

@spec temperature_window(t(), temperature()) :: {:ok, t()} | {:error, reason :: any()}

T_WND Temperature alarm window value in °C.

Link to this function

time_delay(mpl3115_a2)

@spec time_delay(t()) :: {:ok, non_neg_integer()} | {:error, reason :: any()}

TIME_DLY

The time delay register contains the number of ticks of data sample time since the last byte of the FIFO was written. This register starts to increment on FIFO overflow or data wrap and clears when last byte of FIFO is read.

Link to this function

verify_identity(dev)

@spec verify_identity(t()) :: {:ok, t()} | {:error, reason :: any()}

WHO_AM_I Verify the device's identity

Read the contents of the WHO_AM_I register and make sure that it equals the value specified in the datasheet (0xC4).