nrfcxx
0.1.0
C++-17 Framework for Nordic nRF5 Devices
|
Interface to the ST LPS22HB piezzoresistave absolute pressure sensor. More...
#include <nrfcxx/sensor/lps22hb.hpp>
Data Structures | |
struct | iface_config_type |
Information required to communicate with a sensor instance. More... | |
struct | observations_type |
Structure used to return sampled values. More... | |
Public Types | |
enum | STATUS_REG_e : uint8_t { SR_P_DA = 0x01, SR_T_DA = 0x02, SR_READY = (SR_P_DA | SR_T_DA) } |
Bit fields in the LPS22HB STATUS_REG register. More... | |
enum | ODR_e : uint8_t { ODR_OneShot = 0x00, ODR_1_Hz = 0x01, ODR_10_Hz = 0x02, ODR_25_Hz = 0x03, ODR_50_Hz = 0x04, ODR_75_Hz = 0x05 } |
Bit field values in CTRL_REG1 for observation data rate. More... | |
Public Member Functions | |
const iface_config_type & | iface_config () const |
Access the interface configuration for the sensor. | |
int | status () const |
Return the value of the STATUS register. | |
const observations_type & | observations () const |
Access the most recent completed observation. | |
uint8_t | odr () const |
Retrieve the configured output data rate. More... | |
int | odr (uint8_t dr) |
Set the output data rate. More... | |
lps22hb (notifier_type notify, iface_config_type &ifc, unsigned int addr=0) | |
Instantiate the device. More... | |
bool | drdy_asserted () const |
Programmatic test for whether DRDY is asserted. | |
int | lpsm_sample () override |
Post-extend to signal machine if start failed due to undetected drdy. | |
uint16_t | lost_drdy () const |
Count of the number of times a DRDY signal was detected to be lost. | |
Public Member Functions inherited from nrfcxx::lpm::lpsm_capable | |
virtual int | lpsm_start () |
Validate and prepare to initiate an LPM collection. 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_machine & | machine () const |
Gain read-only access to the LPM machine state. | |
Static Public Attributes | |
static constexpr uint16_t | INVALID_TEMPHUMID = 30000 |
Value used for invalid temperature and humidity observations. | |
static constexpr unsigned int | INVALID_PRESSURE = 0x00C00000 |
Value used for invalid pressure observations. More... | |
static constexpr auto | ODR_DEFAULT = ODR_1_Hz |
The default output data rate. | |
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_ |
Interface to the ST LPS22HB piezzoresistave absolute pressure sensor.
NVIC_EnableIRQ(GPIOTE_IRQn); periph::GPIOTE::enable_sense();
lpm::lpsm_capable::lpsm_process() for this sensor returns the following flags in addition to the diagnostic flags:
enum nrfcxx::sensor::lps22hb::ODR_e : uint8_t |
Bit field values in CTRL_REG1
for observation data rate.
These may be configured using odr() when the LPM machine is off.
Enumerator | |
---|---|
ODR_OneShot | On-demand observations. Invoke lpsm_start() to initiate an observation. |
ODR_1_Hz | Observations generated at 1 Hz. |
ODR_10_Hz | Observations generated at 10 Hz. |
ODR_25_Hz | Observations generated at 25 Hz. |
ODR_50_Hz | Observations generated at 50 Hz. |
ODR_75_Hz | Observations generated at 75 Hz. |
enum nrfcxx::sensor::lps22hb::STATUS_REG_e : uint8_t |
nrfcxx::sensor::lps22hb::lps22hb | ( | notifier_type | notify, |
iface_config_type & | ifc, | ||
unsigned int | addr = 0 |
||
) |
Instantiate the device.
notify | the mechanism by which the instance notifies the application that lpsm_process() should be invoked. |
ifc | reference to an externally owned struct providing the resources required to communicate with the device. |
addr | the device address as controlled by the SA0 signal, value in the range 0 through 1. |
|
inline |
int nrfcxx::sensor::lps22hb::odr | ( | uint8_t | dr | ) |
Set the output data rate.
|
staticconstexpr |
Value used for invalid pressure observations.
This is sized to fit in a 24-bit unsigned integer, with a maximum representable value of 1258.2911 hPa.