nrfcxx
0.1.0
C++-17 Framework for Nordic nRF5 Devices
|
Go to the documentation of this file. 7 #ifndef NRFCXX_SENSOR_SHT21_HPP 8 #define NRFCXX_SENSOR_SHT21_HPP 126 return iface_config_;
131 iface_config_type& ifc);
174 return ((0x00 == eic[0]) && (0x80 == eic[1]));
181 return ((
'H' == eic[0]) && (
'T' == eic[1]));
193 return trigger_(
false);
205 return trigger_(
true);
239 return observations_;
243 int lpsm_process_ (
int& delay,
244 process_flags_type& pf)
override;
246 int trigger_ (
bool humidity);
254 int fetch_ (
bool humidity);
256 iface_config_type& iface_config_;
257 observations_type observations_;
int trigger_temperature()
Initiate a temperature measurement.
Definition: sht21.hpp:191
static bool eic_is_sht21(const eic_type &eic)
Return true iff the eic indicates a Sensirion SHT21 device.
Definition: sht21.hpp:172
uint8_t[8] eic_type
Storage for the Electronic Identification Code.
Definition: sht21.hpp:35
int temperature_cK()
Retrieve the last measurement as a temperature measurement.
Definition: sht21.hpp:219
int fetch_(bool humidity)
Fetch the latest result as a raw value.
const iface_config_type & iface_config() const
Access the interface configuration for the sensor.
Definition: sht21.hpp:124
int16_t temperature_cK
A recently calculated valid temperature_cK() or INVALID_OBSERVATION.
Definition: sht21.hpp:95
Information required to communicate with a sensor instance.
Definition: sht21.hpp:106
constexpr static unsigned int ERR_ANACK
NRF_TWI_Type::ERRORSRC bit indicating NACK received during address transmission.
Definition: periph.hpp:1402
int trigger_humidity()
Initiate a temperature measurement.
Definition: sht21.hpp:203
constexpr static uint8_t CONFIG_RES_H10T13
Bits for parameter to configure() specifying 10-bit humidity and 13-bit temperature measurements.
Definition: sht21.hpp:63
Core clock-related functionality.
Material supporting low-power-mode operations.
Wrapper around the nRF51 TWI peripheral.
Definition: periph.hpp:1528
int read_eic(eic_type &eic)
Read the Electronic Identification Code from the device.
constexpr static unsigned int SAMPLE12_DELAY_ms
The maximum time required for a 12-bit measurement, in milliseconds.
Definition: sht21.hpp:51
constexpr static unsigned int SAMPLE14_DELAY_ms
The maximum time required for a 14-bit measurement, in milliseconds.
Definition: sht21.hpp:45
constexpr static uint8_t CONFIG_EOB
Bit set in configure() result indicating Vdd is below 2.25V.
Definition: sht21.hpp:82
int16_t humidity_pptt
A recently calculated valid humidity_pptt() or INVALID_OBSERVATION.
Definition: sht21.hpp:99
int configure(int config)
Configure resolution and heater.
constexpr static uint8_t CONFIG_RES_H11T11
Bits for parameter to configure() specifying for 11-bit humidity and 11-bit temperature measurements.
Definition: sht21.hpp:67
constexpr static unsigned int RESET_DELAY_ms
The maximum time required by the sensor to stabilize after reset(), in milliseconds.
Definition: sht21.hpp:39
int reset()
Send a soft-reset command to the SHT21.
constexpr static int NOT_READY
The error code returned from temperature_cK() and humidity_pptt() when the device is still processing...
Definition: sht21.hpp:211
sht21(notifier_type setter, iface_config_type &ifc)
Construct a sensor interface around a TWI device and events.
std::function< void()> notifier_type
Type used to hold a notifier.
Definition: core.hpp:514
constexpr static ssize_type error_encoded(error_type ec)
Pack an error value into a negative return value.
Definition: periph.hpp:1449
static bool eic_is_htu21d(const eic_type &eic)
Return true iff the eic indicates a Measurement Specialties HTU21D device.
Definition: sht21.hpp:179
Base (or mixin) class for anything that supports a state_machine.
Definition: lpm.hpp:426
constexpr static uint8_t CONFIG_RES_Msk
Mask to isolate the bits of the SHT21 user register that identify sampling resolution.
Definition: sht21.hpp:71
int humidity_pptt()
Retrieve the last measurement as a humidity measurement.
Definition: sht21.hpp:230
constexpr static uint8_t CONFIG_OTPRn
Bit set in configure() parameter/result to disable configuration reset on each measurement.
Definition: sht21.hpp:75
constexpr static int INVALID_OBSERVATION
Value for observations that are known to be invalid.
Definition: sht21.hpp:88
constexpr static uint8_t CONFIG_RES_H8T12
Bits for parameter to configure() specifying 8-bit humidity and 12-bit temperature measurements.
Definition: sht21.hpp:59
uint8_t address
The I2C address used to communicate with the device.
Definition: sht21.hpp:115
periph::TWI & twi
Reference to TWI device used to communicate with sensor.
Definition: sht21.hpp:109
constexpr static uint8_t CONFIG_RES_H12T14
Bits for parameter to configure() specifying 12-bit humidity and 14-bit temperature measurements.
Definition: sht21.hpp:55
Storage for cached results.
Definition: sht21.hpp:91
constexpr static uint8_t CONFIG_HEATER
Bit set in configure() parameter/result to enable the on-chip heater.
Definition: sht21.hpp:79
Abstraction of Nordic device peripherals.
Primary namespace for nrfcxx functionality.
Definition: clock.hpp:17
const observations_type & observations() const
Retrieve the most recent observations calculated through the LPM infrastructure.
Definition: sht21.hpp:237
Abstraction around SHT21/HTU21D temperature/humidity sensor.
Definition: sht21.hpp:30