Class daisy::Dps310¶
Device support for DPS310 Barometric Pressure and Altitude Sensor. More...
#include <dps310.h>
Classes¶
Type | Name |
---|---|
struct | Config |
Public Types¶
Type | Name |
---|---|
enum | Result |
enum | dps310_mode_t |
enum | dps310_oversample_t |
enum | dps310_rate_t |
Public Attributes¶
Type | Name |
---|---|
int32_t | oversample_scalefactor = {524288, 1572864, 3670016, 7864320, 253952, 516096, 1040384, 2088960} |
Public Functions¶
Type | Name |
---|---|
Dps310 () |
|
float | GetAltitude (float seaLevelhPa) |
float | GetPressure () |
float | GetTemperature () |
Result | GetTransportError () |
Result | Init (Config config) |
void | Process (void) |
uint16_t | Read16 (uint8_t reg) |
uint16_t | Read16_LE (uint8_t reg) |
uint32_t | Read24 (uint8_t reg) |
uint8_t | Read8 (uint8_t reg) |
uint8_t | ReadBits (uint8_t reg, uint8_t bits, uint8_t shift) |
void | ReadReg (uint8_t reg, uint8_t * buff, uint8_t size) |
int16_t | ReadS16 (uint8_t reg) |
int16_t | ReadS16_LE (uint8_t reg) |
void | Write8 (uint8_t reg, uint8_t value) |
void | WriteBits (uint8_t reg, uint8_t data, uint8_t bits, uint8_t shift) |
void | _readCalibration (void) |
void | configurePressure (dps310_rate_t rate, dps310_oversample_t os) |
void | configureTemperature (dps310_rate_t rate, dps310_oversample_t os) |
bool | pressureAvailable (void) |
void | reset (void) |
void | setMode (dps310_mode_t mode) |
bool | temperatureAvailable (void) |
~Dps310 () |
Public Static Functions¶
Type | Name |
---|---|
int32_t | twosComplement (int32_t val, uint8_t bits) |
Detailed Description¶
Author:
beserge
Date:
January 2022
Public Types Documentation¶
enum Result¶
enum dps310_mode_t¶
enum daisy::Dps310::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
};
The oversample rate ranges
enum dps310_oversample_t¶
enum daisy::Dps310::dps310_oversample_t {
DPS310_1SAMPLE,
DPS310_2SAMPLES,
DPS310_4SAMPLES,
DPS310_8SAMPLES,
DPS310_16SAMPLES,
DPS310_32SAMPLES,
DPS310_64SAMPLES,
DPS310_128SAMPLES
};
The oversample rate ranges
enum dps310_rate_t¶
enum daisy::Dps310::dps310_rate_t {
DPS310_1HZ,
DPS310_2HZ,
DPS310_4HZ,
DPS310_8HZ,
DPS310_16HZ,
DPS310_32HZ,
DPS310_64HZ,
DPS310_128HZ
};
The measurement rate ranges
Public Attributes Documentation¶
variable oversample_scalefactor¶
Public Functions Documentation¶
function Dps310¶
function GetAltitude¶
Calculates the approximate altitude using barometric pressure and the supplied sea level hPa as a reference.
Parameters:
seaLevelhPa
The current hPa at sea level.
Returns:
The approximate altitude above sea level in meters.
function GetPressure¶
Get the last pressure reading
Returns:
Pressure in hPa
function GetTemperature¶
Get last temperature reading
Returns:
temp in degrees Centigrade
function GetTransportError¶
Get and reset the transport error flag
Returns:
Whether the transport has errored since the last check
function Init¶
Initialize the Dps310 device
Parameters:
config
Configuration settings
function Process¶
Read the XYZ data from the sensor and store in the internal raw_pressure, raw_temperature, _pressure and _temperature variables.
function Read16¶
Reads a 16 bit value over I2C or SPI
Parameters:
reg
the register address to read from
Returns:
the 16 bit data value read from the device
function Read16_LE¶
Reads a signed 16 bit little endian value over I2C or SPI
Parameters:
reg
the register address to read from
Returns:
the 16 bit data value read from the device
function Read24¶
Reads a 24 bit value
Parameters:
reg
the register address to read from
Returns:
the 24 bit data value read from the device
function Read8¶
Reads an 8 bit value
Parameters:
reg
the register address to read from
Returns:
the data uint8_t read from the device
function ReadBits¶
function ReadReg¶
Read from a reg address a defined number of bytes
function ReadS16¶
Reads a signed 16 bit value over I2C or SPI
Parameters:
reg
the register address to read from
Returns:
the 16 bit data value read from the device
function ReadS16_LE¶
Reads a signed little endian 16 bit value over I2C or SPI
Parameters:
reg
the register address to read from
Returns:
the 16 bit data value read from the device
function Write8¶
Writes an 8 bit value
Parameters:
reg
the register address to write tovalue
the value to write to the register
function WriteBits¶
function _readCalibration¶
function configurePressure¶
Set the sample rate and oversampling averaging for pressure
Parameters:
rate
How many samples per second to takeos
How many oversamples to average
function configureTemperature¶
Set the sample rate and oversampling averaging for temperature
Parameters:
rate
How many samples per second to takeos
How many oversamples to average
function pressureAvailable¶
Whether new pressure data is available
Returns:
True if new data available to read
function reset¶
Performs a software reset
function setMode¶
Set the operational mode of the sensor (continuous or one-shot)
Parameters:
mode
can be DPS310_IDLE, one shot: DPS310_ONE_PRESSURE or DPS310_ONE_TEMPERATURE, continuous: DPS310_CONT_PRESSURE, DPS310_CONT_TEMP, DPS310_CONT_PRESTEMP
function temperatureAvailable¶
Whether new temperature data is available
Returns:
True if new data available to read
function ~Dps310¶
Public Static Functions Documentation¶
function twosComplement¶
The documentation for this class was generated from the following file external-docs/libDaisy/src/dev/dps310.h