Device support for DPS310 Barometric Pressure and Altitude Sensor. More...
Device support for DPS310 Barometric Pressure and Altitude Sensor.
#include <dps310.h>
Classes | |
struct | Config |
Public Types | |
enum | dps310_rate_t { DPS310_1HZ , DPS310_2HZ , DPS310_4HZ , DPS310_8HZ , DPS310_16HZ , DPS310_32HZ , DPS310_64HZ , DPS310_128HZ } |
enum | dps310_oversample_t { DPS310_1SAMPLE , DPS310_2SAMPLES , DPS310_4SAMPLES , DPS310_8SAMPLES , DPS310_16SAMPLES , DPS310_32SAMPLES , DPS310_64SAMPLES , DPS310_128SAMPLES } |
enum | dps310_mode_t { DPS310_IDLE = 0b000 , DPS310_ONE_PRESSURE = 0b001 , DPS310_ONE_TEMPERATURE = 0b010 , DPS310_CONT_PRESSURE = 0b101 , DPS310_CONT_TEMP = 0b110 , DPS310_CONT_PRESTEMP = 0b111 } |
enum | Result { OK = 0 , ERR } |
Public Member Functions | |
Dps310 () | |
~Dps310 () | |
Result | Init (Config config) |
void | reset (void) |
void | _readCalibration (void) |
bool | temperatureAvailable (void) |
bool | pressureAvailable (void) |
float | GetAltitude (float seaLevelhPa) |
void | setMode (dps310_mode_t mode) |
void | configurePressure (dps310_rate_t rate, dps310_oversample_t os) |
void | configureTemperature (dps310_rate_t rate, dps310_oversample_t os) |
void | Process (void) |
float | GetTemperature () |
float | GetPressure () |
void | Write8 (uint8_t reg, uint8_t value) |
void | ReadReg (uint8_t reg, uint8_t *buff, uint8_t size) |
uint8_t | Read8 (uint8_t reg) |
uint16_t | Read16 (uint8_t reg) |
uint32_t | Read24 (uint8_t reg) |
uint16_t | Read16_LE (uint8_t reg) |
int16_t | ReadS16 (uint8_t reg) |
int16_t | ReadS16_LE (uint8_t reg) |
uint8_t | ReadBits (uint8_t reg, uint8_t bits, uint8_t shift) |
void | WriteBits (uint8_t reg, uint8_t data, uint8_t bits, uint8_t shift) |
Result | GetTransportError () |
Static Public Member Functions | |
static int32_t | twosComplement (int32_t val, uint8_t bits) |
Public Attributes | |
int32_t | oversample_scalefactor [8] = {524288, 1572864, 3670016, 7864320, 253952, 516096, 1040384, 2088960} |
The oversample rate ranges
|
inline |
|
inline |
|
inline |
Set the sample rate and oversampling averaging for pressure
rate | How many samples per second to take |
os | How many oversamples to average |
|
inline |
Set the sample rate and oversampling averaging for temperature
rate | How many samples per second to take |
os | How many oversamples to average |
|
inline |
Calculates the approximate altitude using barometric pressure and the supplied sea level hPa as a reference.
seaLevelhPa | The current hPa at sea level. |
|
inline |
Get the last pressure reading
|
inline |
Get last temperature reading
|
inline |
Get and reset the transport error flag
Initialize the Dps310 device
config | Configuration settings |
Whether new pressure data is available
Read the XYZ data from the sensor and store in the internal raw_pressure, raw_temperature, _pressure and _temperature variables.
Reads a 16 bit value over I2C or SPI
reg | the register address to read from |
Reads a signed 16 bit little endian value over I2C or SPI
reg | the register address to read from |
Reads a 24 bit value
reg | the register address to read from |
Reads an 8 bit value
reg | the register address to read from |
Read from a reg address a defined number of bytes
Reads a signed 16 bit value over I2C or SPI
reg | the register address to read from |
Reads a signed little endian 16 bit value over I2C or SPI
reg | the register address to read from |
Performs a software reset
|
inline |
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 |
Whether new temperature data is available
|
inlinestatic |
|
inline |
Writes an 8 bit value
reg | the register address to write to |
value | the value to write to the register |
|
inline |
int32_t daisy::Dps310< Transport >::oversample_scalefactor[8] = {524288, 1572864, 3670016, 7864320, 253952, 516096, 1040384, 2088960} |