Adafruit DPS310 Arduino Library
|
#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... | |
Class for hardware interfacing with a DPS310
bool Adafruit_DPS310::begin_I2C | ( | uint8_t | i2c_address = DPS310_I2CADDR_DEFAULT , |
TwoWire * | wire = &Wire |
||
) |
Sets up the hardware and initializes I2C.
i2c_address | The I2C address to be used. |
wire | The Wire object to be used for I2C connections. |
boolean Adafruit_DPS310::begin_SPI | ( | uint8_t | cs_pin, |
SPIClass * | theSPI = &SPI |
||
) |
Sets up the hardware and initializes hardware SPI.
cs_pin | The arduino pin # connected to chip select |
theSPI | The SPI object to be used for SPI connections. |
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.
cs_pin | The arduino pin # connected to chip select |
sck_pin | The arduino pin # connected to SPI clock |
miso_pin | The arduino pin # connected to SPI MISO |
mosi_pin | The arduino pin # connected to SPI MOSI |
void Adafruit_DPS310::setMode | ( | dps310_mode_t | mode | ) |
Set the operational mode of the sensor (continuous or one-shot)
mode | can be DPS310_IDLE, one shot: DPS310_ONE_PRESSURE or DPS310_ONE_TEMPERATURE, continuous: DPS310_CONT_PRESSURE, DPS310_CONT_TEMP, DPS310_CONT_PRESTEMP |
void Adafruit_DPS310::configurePressure | ( | dps310_rate_t | rate, |
dps310_oversample_t | os | ||
) |
Set the sample rate and oversampling averaging for pressure.
rate | How many samples per second to take |
os | How many oversamples to average |
void Adafruit_DPS310::configureTemperature | ( | dps310_rate_t | rate, |
dps310_oversample_t | os | ||
) |
Set the sample rate and oversampling averaging for temperature.
rate | How many samples per second to take |
os | How many oversamples to average |
bool Adafruit_DPS310::pressureAvailable | ( | void | ) |
Whether new pressure data is available.
bool Adafruit_DPS310::temperatureAvailable | ( | void | ) |
Whether new temperature data is available.
float Adafruit_DPS310::readAltitude | ( | float | seaLevelhPa = 1013.25 | ) |
Calculates the approximate altitude using barometric pressure and the supplied sea level hPa as a reference.
seaLevelhPa | The current hPa at sea level. |
Adafruit_Sensor * Adafruit_DPS310::getTemperatureSensor | ( | void | ) |
Gets an Adafruit Unified Sensor object for the temp sensor component.
Adafruit_Sensor * Adafruit_DPS310::getPressureSensor | ( | void | ) |
Gets an Adafruit Unified Sensor object for the pressure sensor component.
bool Adafruit_DPS310::getEvents | ( | sensors_event_t * | temp_event, |
sensors_event_t * | pressure_event | ||
) |
Gets the most recent sensor event, Adafruit Unified Sensor format.
temp_event | Pointer to an Adafruit Unified sensor_event_t object that we'll fill in with temperature data |
pressure_event | Pointer to an Adafruit Unified sensor_event_t object that we'll fill in with pressure data |