Adafruit MPRLS Arduino Library
Public Member Functions | Public Attributes | 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, uint16_t PSI_min=0, uint16_t PSI_max=25, float OUTPUT_min=10, float OUTPUT_max=90, float K=PSI_to_HPA)
 constructor initializes default configuration value More...
 
bool 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...
 

Public Attributes

uint8_t lastStatus
 

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,
uint16_t  PSI_min = 0,
uint16_t  PSI_max = 25,
float  OUTPUT_min = 10,
float  OUTPUT_max = 90,
float  K = PSI_to_HPA 
)

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
OUTPUT_minThe minimum transfer function curve value in %, default 10%
OUTPUT_maxThe maximum transfer function curve value in %, default 90%
KConversion Factor to desired units, default is PSI to HPA

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

Member Data Documentation

◆ lastStatus

uint8_t Adafruit_MPRLS::lastStatus

status byte after last operation


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