Adafruit DPS310 Arduino Library
Public Member Functions | List of all members
Adafruit_DPS310 Class Reference

#include <Adafruit_DPS310.h>

Public Member Functions

 Adafruit_DPS310 (void)
 Instantiates a new DPS310 class.
 
 ~Adafruit_DPS310 (void)
 Cleans up any allocations in our object.
 
bool begin_I2C (uint8_t i2c_addr=DPS310_I2CADDR_DEFAULT, TwoWire *wire=&Wire)
 Sets up the hardware and initializes I2C. More...
 
bool begin_SPI (uint8_t cs_pin, SPIClass *theSPI=&SPI)
 Sets up the hardware and initializes hardware SPI. More...
 
bool 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)
 Performs a software reset.
 
void setMode (dps310_mode_t mode)
 Set the operational mode of the sensor (continuous or one-shot) More...
 
void configurePressure (dps310_rate_t rate, dps310_oversample_t os)
 Set the sample rate and oversampling averaging for pressure. More...
 
void configureTemperature (dps310_rate_t rate, dps310_oversample_t os)
 Set the sample rate and oversampling averaging for temperature. More...
 
bool pressureAvailable (void)
 Whether new pressure data is available. More...
 
bool temperatureAvailable (void)
 Whether new temperature data is available. More...
 
float readAltitude (float seaLevelhPa=1013.25)
 Calculates the approximate altitude using barometric pressure and the supplied sea level hPa as a reference. More...
 
Adafruit_Sensor * getTemperatureSensor (void)
 Gets an Adafruit Unified Sensor object for the temp sensor component. More...
 
Adafruit_Sensor * getPressureSensor (void)
 Gets an Adafruit Unified Sensor object for the pressure sensor component. More...
 
bool getEvents (sensors_event_t *temp_event, sensors_event_t *pressure_event)
 Gets the most recent sensor event, Adafruit Unified Sensor format. More...
 

Detailed Description

Class for hardware interfacing with a DPS310

Member Function Documentation

◆ begin_I2C()

bool Adafruit_DPS310::begin_I2C ( uint8_t  i2c_address = DPS310_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_DPS310::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]

bool Adafruit_DPS310::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.

◆ setMode()

void Adafruit_DPS310::setMode ( dps310_mode_t  mode)

Set the operational mode of the sensor (continuous or one-shot)

Parameters
modecan be DPS310_IDLE, one shot: DPS310_ONE_PRESSURE or DPS310_ONE_TEMPERATURE, continuous: DPS310_CONT_PRESSURE, DPS310_CONT_TEMP, DPS310_CONT_PRESTEMP

◆ configurePressure()

void Adafruit_DPS310::configurePressure ( dps310_rate_t  rate,
dps310_oversample_t  os 
)

Set the sample rate and oversampling averaging for pressure.

Parameters
rateHow many samples per second to take
osHow many oversamples to average

◆ configureTemperature()

void Adafruit_DPS310::configureTemperature ( dps310_rate_t  rate,
dps310_oversample_t  os 
)

Set the sample rate and oversampling averaging for temperature.

Parameters
rateHow many samples per second to take
osHow many oversamples to average

◆ pressureAvailable()

bool Adafruit_DPS310::pressureAvailable ( void  )

Whether new pressure data is available.

Returns
True if new data available to read

◆ temperatureAvailable()

bool Adafruit_DPS310::temperatureAvailable ( void  )

Whether new temperature data is available.

Returns
True if new data available to read

◆ readAltitude()

float Adafruit_DPS310::readAltitude ( float  seaLevelhPa = 1013.25)

Calculates the approximate altitude using barometric pressure and the supplied sea level hPa as a reference.

Parameters
seaLevelhPaThe current hPa at sea level.
Returns
The approximate altitude above sea level in meters.

◆ getTemperatureSensor()

Adafruit_Sensor * Adafruit_DPS310::getTemperatureSensor ( void  )

Gets an Adafruit Unified Sensor object for the temp sensor component.

Returns
Adafruit_Sensor pointer to temperature sensor

◆ getPressureSensor()

Adafruit_Sensor * Adafruit_DPS310::getPressureSensor ( void  )

Gets an Adafruit Unified Sensor object for the pressure sensor component.

Returns
Adafruit_Sensor pointer to pressure sensor

◆ getEvents()

bool Adafruit_DPS310::getEvents ( sensors_event_t *  temp_event,
sensors_event_t *  pressure_event 
)

Gets the most recent sensor event, Adafruit Unified Sensor format.

Parameters
temp_eventPointer to an Adafruit Unified sensor_event_t object that we'll fill in with temperature data
pressure_eventPointer to an Adafruit Unified sensor_event_t object that we'll fill in with pressure data
Returns
True on successful read

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