nrfcxx  0.1.0
C++-17 Framework for Nordic nRF5 Devices
Data Structures | Public Member Functions | Static Public Attributes
nrfcxx::sensor::sdp8xx Class Reference

Abstraction around SDP8xx differential pressure sensor. More...

#include <nrfcxx/sensor/sdp8xx.hpp>

Inheritance diagram for nrfcxx::sensor::sdp8xx:
nrfcxx::lpm::lpsm_capable

Data Structures

struct  iface_config_type
 Information required to communicate with a sensor instance. More...
 
struct  observations_type
 Storage for cached results. More...
 

Public Member Functions

const iface_config_typeiface_config () const
 Access the interface configuration for the sensor.
 
 sdp8xx (notifier_type notify, iface_config_type &ifc)
 Construct a sensor interface around a TWI device and events.
 
 sdp8xx (const sdp8xx &)=delete
 
sdp8xxoperator= (const sdp8xx &)=delete
 
 sdp8xx (sdp8xx &&)=delete
 
sdp8xxoperator= (sdp8xx &)=delete
 
int reset ()
 Send a soft-reset command to the SDP8xx. More...
 
int read_device_info (uint32_t &product, uint64_t &serial)
 Read the device information. More...
 
const observations_typeobservations () const
 Retrieve the most recent observations calculated through the LPM infrastructure.
 
- Public Member Functions inherited from nrfcxx::lpm::lpsm_capable
virtual int lpsm_start ()
 Validate and prepare to initiate an LPM collection. More...
 
virtual int lpsm_sample ()
 Ask the LPM infrastructure to initiate a new sample. More...
 
lpm::state_machine::process_flags_type lpsm_process ()
 Make progress on an LPM collection. More...
 
int lpsm_stop ()
 
int lpsm_reset ()
 
int lpsm_process_rc () const
 Get the internal result code from the last invocation of lpsm_process_(). More...
 
const lpm::state_machinemachine () const
 Gain read-only access to the LPM machine state.
 

Static Public Attributes

constexpr static unsigned int RESET_DELAY_ms = 2
 The maximum time required by the sensor to stabilize after reset(), in milliseconds.
 
constexpr static unsigned int SAMPLE_DELAY_ms = 50
 The maximum time required for a one-shot measurement, in milliseconds.
 
constexpr static uint8_t CONFIG_OTPRn = 0x02
 Bit set in configure() parameter/result to disable configuration reset on each measurement.
 
constexpr static uint8_t CONFIG_HEATER = 0x04
 Bit set in configure() parameter/result to enable the on-chip heater.
 
constexpr static uint8_t CONFIG_EOB = 0x40
 Bit set in configure() result indicating Vdd is below 2.25V.
 
constexpr static int INVALID_OBSERVATION = -30000
 Value for observations that are known to be invalid. More...
 
static constexpr uint32_t SDP800_500Pa_PN = 0x03020100
 Product number matcher for 500 Pa range manifold-connection device.
 
static constexpr uint32_t SDP810_500Pa_PN = 0x03020A00
 Product number matcher for 500 Pa range tube-connection device.
 
static constexpr uint32_t SDP800_125Pa_PN = 0x03020200
 Product number matcher for 125 Pa range manifold-connection device.
 
static constexpr uint32_t SDP810_125Pa_PN = 0x03020B00
 Product number matcher for 125 Pa range tube-connection device.
 

Additional Inherited Members

- Protected Types inherited from nrfcxx::lpm::lpsm_capable
using state_type = state_machine::state_type
 
using process_flags_type = state_machine::process_flags_type
 
- Protected Member Functions inherited from nrfcxx::lpm::lpsm_capable
 lpsm_capable (notifier_type notify)
 Create a state machine that records state and supports delayed transitions. More...
 
virtual int lpsm_process_ (int &delay, process_flags_type &pf)
 Override to implement machine-specific operations of lpsm_process(). More...
 
virtual void lpsm_reset_ ()
 Override to reset state that is held outside the machine.
 
- Protected Attributes inherited from nrfcxx::lpm::lpsm_capable
state_machine machine_
 

Detailed Description

Abstraction around SDP8xx differential pressure sensor.

Interface to the SDP8xx digital differential pressure sensor.

The device supports either polled reading at a maximum rate of about 200 Hz, or continuous measurement at up to 2 kHz. The interface currently only supports polled reading, using an LPM state machine.

lpm::lpsm_capable::lpsm_process() for this sensor returns the following flags in addition to the diagnostic flags:

Member Function Documentation

◆ read_device_info()

int nrfcxx::sensor::sdp8xx::read_device_info ( uint32_t &  product,
uint64_t &  serial 
)

Read the device information.

Parameters
[out]producta 32-bit product identifier. The upper 24 bits match one of the product numbers (e.g. SDP810_125Pa_PN) while the low 8 bits are a revision number.
[out]seriala 64-bit unique serial number for the device.

◆ reset()

int nrfcxx::sensor::sdp8xx::reset ( )

Send a soft-reset command to the SDP8xx.

Warning
The SDP8xx is reset using the I2C bus standard broadcast hardware reset-and-write command. If other devices are on the bus they may be affected.
Returns
a non-negative value on success, or an encoded error.

Field Documentation

◆ INVALID_OBSERVATION

constexpr static int nrfcxx::sensor::sdp8xx::INVALID_OBSERVATION = -30000
staticconstexpr

Value for observations that are known to be invalid.

This fits in a 16-bit signed value and is outside the valid range for both temperature_cCel() and diffpres_cPa().


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