|
nrfcxx
0.1.0
C++-17 Framework for Nordic nRF5 Devices
|
Interface to the ST HTS221 capacitive digital sensor for relative humidity and temperature. More...
#include <nrfcxx/sensor/hts221.hpp>
Data Structures | |
| struct | calibration_type |
| Structure for calibration information. More... | |
| 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_T_DA = 0x01, SR_H_DA = 0x02, SR_READY = (SR_T_DA | SR_H_DA) } |
Bit fields in the HTS221 STATUS_REG register. More... | |
| enum | ODR_e : uint8_t { ODR_OneShot = 0x00, ODR_1_Hz = 0x01, ODR_7_Hz = 0x02, ODR_12p5_Hz = 0x03 } |
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. | |
| const calibration_type & | calibration () const |
| Access the calibration constants. More... | |
| 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... | |
| hts221 (notifier_type notify, iface_config_type &ifc) | |
| 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_OBSERVATION = 30000 |
| Value used to indicate that observations are not valid. | |
| 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 HTS221 capacitive digital sensor for relative humidity and temperature.
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::hts221::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_7_Hz | Observations generated at 7 Hz. |
| ODR_12p5_Hz | Observations generated at 12.5 Hz. |
| enum nrfcxx::sensor::hts221::STATUS_REG_e : uint8_t |
| nrfcxx::sensor::hts221::hts221 | ( | notifier_type | notify, |
| iface_config_type & | ifc | ||
| ) |
Instantiate the device.
| ifc | reference to an externally owned struct providing the resources required to communicate with the device. |
| notify | the mechanism by which the instance notifies the application that lpsm_process() should be invoked. |
|
inline |
Access the calibration constants.
This is useful for diagnostics.
|
inline |
| int nrfcxx::sensor::hts221::odr | ( | uint8_t | dr | ) |
Set the output data rate.
1.8.16