Skip to content

Class hal::mpl::mpl3115a2

ClassList > hal > mpl > mpl3115a2

Classes

Type Name
struct altitude_read_t
struct pressure_read_t
struct temperature_read_t

Public Types

Type Name
enum mode

Public Static Attributes

Type Name
constexpr uint16_t default_max_polling_retries = = 10000

Public Functions

Type Name
hal::result< altitude_read_t > read_altitude ()
Read altitude data from out_p_msb_r, out_p_csb_r, and out_p_lsb_r and perform altitude conversion to meters.
hal::result< pressure_read_t > read_pressure ()
Read pressure data from out_p_msb_r, out_p_csb_r, and out_p_lsb_r and perform pressure conversion to kilopascals.
hal::result< temperature_read_t > read_temperature ()
Read pressure data from out_t_msb_r and out_t_lsb_r and perform temperature conversion to celsius.
hal::status set_altitude_offset (int8_t p_offset)
Set altitude offset in off_h_r.
hal::status set_sea_pressure (float p_sea_level_pressure)
Set sea level pressure (Barometric input for altitude calculations) in bar_in_msb_r and bar_in_lsb_r registers.

Public Static Functions

Type Name
result< mpl3115a2 > create (hal::i2c & p_i2c)
Initialization of MPLX device.

Public Types Documentation

enum mode

enum hal::mpl::mpl3115a2::mode {
    barometer = 0,
    altimeter = 1
};

Public Static Attributes Documentation

variable default_max_polling_retries

constexpr uint16_t hal::mpl::mpl3115a2::default_max_polling_retries;

Public Functions Documentation

function read_altitude

hal::result< altitude_read_t > hal::mpl::mpl3115a2::read_altitude () 

function read_pressure

hal::result< pressure_read_t > hal::mpl::mpl3115a2::read_pressure () 

function read_temperature

hal::result< temperature_read_t > hal::mpl::mpl3115a2::read_temperature () 

function set_altitude_offset

Set altitude offset in off_h_r.

hal::status hal::mpl::mpl3115a2::set_altitude_offset (
    int8_t p_offset
) 

Parameters:

  • p_offset Offset value in meters, from -127 to 128

function set_sea_pressure

Set sea level pressure (Barometric input for altitude calculations) in bar_in_msb_r and bar_in_lsb_r registers.

hal::status hal::mpl::mpl3115a2::set_sea_pressure (
    float p_sea_level_pressure
) 

Parameters:

  • p_sea_level_pressure Sea level pressure in Pascals. Default value on startup is 101,326 Pa.

Public Static Functions Documentation

function create

Initialization of MPLX device.

static result< mpl3115a2 > hal::mpl::mpl3115a2::create (
    hal::i2c & p_i2c
) 

This function performs the following steps during startup configuration: * Perform WHOAMI check * Trigger reset and wait for completion * Set altimeter mode * Set oversampling ratio to 2^128 (OS128) * Enable data ready events for pressure/altitude and temperature


The documentation for this class was generated from the following file libraries/include/libhal-mpl/mpl3115a2.hpp