Adafruit LPS35HW Library
Public Member Functions | Public Attributes | List of all members
Adafruit_LPS35HW Class Reference

Class that stores state and functions for interacting with LPS35HW Current and Power Sensor. More...

#include <Adafruit_LPS35HW.h>

Public Member Functions

 Adafruit_LPS35HW ()
 Instantiates a new LPS35HW class.
 
boolean begin_I2C (uint8_t i2c_addr=LPS35HW_I2CADDR_DEFAULT, TwoWire *wire=&Wire)
 Sets up the hardware and initializes I2C. More...
 
boolean begin_SPI (uint8_t cs_pin, SPIClass *theSPI=&SPI)
 Sets up the hardware and initializes hardware SPI. More...
 
boolean begin_SPI (int8_t cs_pin, int8_t sck_pin, int8_t miso_pin, int8_t mosi_pin)
 Sets up the hardware and initializes software SPI. More...
 
void reset (void)
 Resets the hardware. All configuration registers are set to default values, the same as a power-on reset.
 
float readTemperature (void)
 Reads and scales the current value of the temperature register. More...
 
float readPressure (void)
 Reads and scales the value of the pressure register. More...
 
void setDataRate (LPS35HW_DataRate new_rate)
 Sets a new measurement rate. More...
 
void takeMeasurement (void)
 Takes a new measurement while in one shot mode.
 
void zeroPressure (void)
 Sets the reference temperature to the current temperature. Future pressure readings will be relative to it until resetPressure is called.
 
void resetPressure (void)
 Resets the reference pressure to zero so calls to getPressure are reported as the absolute value.
 
void setThresholdPressure (float threshold_pressure)
 Sets the pressure threshold used by the high and low pressure thresholds. More...
 
void enableHighThreshold (void)
 Enables high pressure threshold interrupts.
 
void enableLowThreshold (void)
 Disables low pressure threshold interrupts.
 
bool highThresholdExceeded (void)
 Returns the current state of the high pressure threshold interrupt. More...
 
bool lowThresholdExceeded (void)
 Returns the current state of the low pressure threshold interrupt. More...
 
void enableInterrupts (bool active_low=false, bool open_drain=false)
 Enables pressure threshold interrupts. High and low thresholds need to be enabled individually with enableLowThreshold and enableHighThreshold. More...
 
void disableInterrupts (void)
 Disables pressure threshold interrupts.
 
void enableLowPass (bool extra_low_bandwidth=false)
 Enables the low pass filter with ODR/9 bandwidth. More...
 

Public Attributes

Adafruit_BusIO_Register * Config1
 BusIO Register for CONFIG_1.
 
Adafruit_BusIO_Register * Config2
 BusIO Register for CONFIG_2.
 
Adafruit_BusIO_Register * Config3
 BusIO Register for CONFIG_3.
 
Adafruit_BusIO_Register * InterruptCfg
 BusIO Register for INTERRUPT_CFG.
 
Adafruit_BusIO_Register * InterruptStatus
 BusIO Register for INTERRUPT_STATUS.
 

Detailed Description

Class that stores state and functions for interacting with LPS35HW Current and Power Sensor.

Member Function Documentation

◆ begin_I2C()

boolean Adafruit_LPS35HW::begin_I2C ( uint8_t  i2c_address = LPS35HW_I2CADDR_DEFAULT,
TwoWire *  wire = &Wire 
)

Sets up the hardware and initializes I2C.

Parameters
i2c_addressThe I2C address to be used.
wireThe Wire object to be used for I2C connections.
Returns
True if initialization was successful, otherwise false.

◆ begin_SPI() [1/2]

boolean Adafruit_LPS35HW::begin_SPI ( uint8_t  cs_pin,
SPIClass *  theSPI = &SPI 
)

Sets up the hardware and initializes hardware SPI.

Parameters
cs_pinThe arduino pin # connected to chip select
theSPIThe SPI object to be used for SPI connections.
Returns
True if initialization was successful, otherwise false.

◆ begin_SPI() [2/2]

boolean Adafruit_LPS35HW::begin_SPI ( int8_t  cs_pin,
int8_t  sck_pin,
int8_t  miso_pin,
int8_t  mosi_pin 
)

Sets up the hardware and initializes software SPI.

Parameters
cs_pinThe arduino pin # connected to chip select
sck_pinThe arduino pin # connected to SPI clock
miso_pinThe arduino pin # connected to SPI MISO
mosi_pinThe arduino pin # connected to SPI MOSI
Returns
True if initialization was successful, otherwise false.

◆ readTemperature()

float Adafruit_LPS35HW::readTemperature ( void  )

Reads and scales the current value of the temperature register.

Returns
The current temperature in degrees C

◆ readPressure()

float Adafruit_LPS35HW::readPressure ( void  )

Reads and scales the value of the pressure register.

Returns
The current pressure in hPa, relative to the reference temperature

◆ setDataRate()

void Adafruit_LPS35HW::setDataRate ( LPS35HW_DataRate  new_rate)

Sets a new measurement rate.

Parameters
new_rateThe new output data rate to be set (ODR)

◆ setThresholdPressure()

void Adafruit_LPS35HW::setThresholdPressure ( float  threshold_pressure)

Sets the pressure threshold used by the high and low pressure thresholds.

Parameters
threshold_pressureThe threshold pressure in hPa, measured from zero

◆ highThresholdExceeded()

bool Adafruit_LPS35HW::highThresholdExceeded ( void  )

Returns the current state of the high pressure threshold interrupt.

Returns
true if the high pressure threshold has been triggered since last checked.

◆ lowThresholdExceeded()

bool Adafruit_LPS35HW::lowThresholdExceeded ( void  )

Returns the current state of the low pressure threshold interrupt.

Returns
true if the low pressure threshold has been triggered since last checked.

◆ enableInterrupts()

void Adafruit_LPS35HW::enableInterrupts ( bool  active_low = false,
bool  open_drain = false 
)

Enables pressure threshold interrupts. High and low thresholds need to be enabled individually with enableLowThreshold and enableHighThreshold.

Parameters
active_lowPolarity of interrupt pin, true for active low.
open_drainSet to true to have the INT pin be open drain when active.

◆ enableLowPass()

void Adafruit_LPS35HW::enableLowPass ( bool  extra_low_bandwidth = false)

Enables the low pass filter with ODR/9 bandwidth.

Parameters
extra_low_bandwidthSet to true to scale the bandwidth to ODR/20

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