Adafruit MPRLS Arduino Library
Public Member Functions | List of all members
Adafruit_MPRLS Class Reference

Class that stores state and functions for interacting with MPRLS sensor IC. More...

#include <Adafruit_MPRLS.h>

Public Member Functions

 Adafruit_MPRLS (int8_t reset_pin=-1, int8_t EOC_pin=-1, uint8_t PSI_min=0, uint8_t PSI_max=25)
 constructor initializes default configuration value More...
 
boolean begin (uint8_t i2c_addr=MPRLS_DEFAULT_ADDR, TwoWire *twoWire=&Wire)
 setup and initialize communication with the hardware More...
 
uint8_t readStatus (void)
 Read just the status byte, see datasheet for bit definitions. More...
 
float readPressure (void)
 Read and calculate the pressure. More...
 

Detailed Description

Class that stores state and functions for interacting with MPRLS sensor IC.

Constructor & Destructor Documentation

◆ Adafruit_MPRLS()

Adafruit_MPRLS::Adafruit_MPRLS ( int8_t  reset_pin = -1,
int8_t  EOC_pin = -1,
uint8_t  PSI_min = 0,
uint8_t  PSI_max = 25 
)

constructor initializes default configuration value

Parameters
reset_pinOptional hardware reset pin, default set to -1 to skip
EOC_pinOptional End-of-Convert indication pin, default set to -1 to skip
PSI_minThe minimum PSI measurement range of the sensor, default 0
PSI_maxThe maximum PSI measurement range of the sensor, default 25

Member Function Documentation

◆ begin()

boolean Adafruit_MPRLS::begin ( uint8_t  i2c_addr = MPRLS_DEFAULT_ADDR,
TwoWire *  twoWire = &Wire 
)

setup and initialize communication with the hardware

Parameters
i2c_addrThe I2C address for the sensor (default is 0x18)
twoWireOptional pointer to the desired TwoWire I2C object. Defaults to &Wire
Returns
True on success, False if sensor not found

◆ readStatus()

uint8_t Adafruit_MPRLS::readStatus ( void  )

Read just the status byte, see datasheet for bit definitions.

Returns
8 bits of status data

◆ readPressure()

float Adafruit_MPRLS::readPressure ( void  )

Read and calculate the pressure.

Returns
The measured pressure, in hPa on success, NAN on failure

The documentation for this class was generated from the following files: