18 #ifndef _ADAFRUIT_HTS221_H 19 #define _ADAFRUIT_HTS221_H 22 #include <Adafruit_BusIO_Register.h> 23 #include <Adafruit_I2CDevice.h> 24 #include <Adafruit_SPIDevice.h> 25 #include <Adafruit_Sensor.h> 28 #define HTS221_I2CADDR_DEFAULT 0x5F 29 #define HTS221_CHIP_ID 0xBC 30 #define HTS221_CTRL_REG_1 0x20 31 #define HTS221_CTRL_REG_2 \ 33 #define HTS221_CTRL_REG_3 0x22 34 #define HTS221_HUMIDITY_OUT 0x28 35 #define HTS221_TEMP_OUT_L 0x2A 36 #define HTS221_H0_RH_X2 0x30 37 #define HTS221_H1_RH_X2 0x31 38 #define HTS221_T0_DEGC_X8 0x32 39 #define HTS221_T1_T0_MSB 0x35 40 #define HTS221_H0_T0 0x36 41 #define HTS221_H0_T1 0x3A 42 #define HTS221_T0_OUT 0x3C 43 #define HTS221_T1_OUT 0x3E 45 #define HTS221_WHOAMI 0x0F 74 int _sensorID = 0x221;
93 int _sensorID = 0x222;
107 TwoWire *wire = &Wire, int32_t sensor_id = 0);
109 bool begin_SPI(uint8_t cs_pin, SPIClass *theSPI = &SPI,
110 int32_t sensor_id = 0);
111 bool begin_SPI(int8_t cs_pin, int8_t sck_pin, int8_t miso_pin,
112 int8_t mosi_pin, int32_t sensor_id = 0);
116 void setActive(
bool active);
120 void drdyActiveLow(
bool active_low);
121 void drdyIntEnabled(
bool drdy_int_enabled);
123 bool getEvent(sensors_event_t *humidity, sensors_event_t *temp);
124 Adafruit_Sensor *getTemperatureSensor(
void);
125 Adafruit_Sensor *getHumiditySensor(
void);
129 virtual bool _init(int32_t sensor_id);
137 Adafruit_I2CDevice *i2c_dev = NULL;
138 Adafruit_SPIDevice *spi_dev = NULL;
145 void _fetchTempCalibrationValues(
void);
146 void _fetchHumidityCalibrationValues(
void);
152 void fillTempEvent(sensors_event_t *temp, uint32_t timestamp);
153 void fillHumidityEvent(sensors_event_t *humidity, uint32_t timestamp);
155 void _applyTemperatureCorrection(
void);
156 void _applyHumidityCorrection(
void);
157 uint16_t T0, T1, T0_OUT, T1_OUT;
159 uint16_t H0_T0_OUT, H1_T0_OUT;
160 uint16_t raw_temperature;
161 uint16_t raw_humidity;
163 uint8_t multi_byte_address_mask = 0x80;
float corrected_temp
Last reading's temperature (C) before scaling.
Definition: Adafruit_HTS221.h:131
Class that stores state and functions for interacting with the HTS221 I2C Digital Potentiometer...
Definition: Adafruit_HTS221.h:101
uint16_t _sensorid_temp
ID number for temperature.
Definition: Adafruit_HTS221.h:135
hts221_rate_t
Allowed values for setDataRate.
Definition: Adafruit_HTS221.h:51
Adafruit_HTS221_Temp(Adafruit_HTS221 *parent)
Create an Adafruit_Sensor compatible object for the temp sensor.
Definition: Adafruit_HTS221.h:87
uint16_t _sensorid_humidity
ID number for humidity.
Definition: Adafruit_HTS221.h:134
Adafruit_HTS221_Humidity(Adafruit_HTS221 *parent)
Create an Adafruit_Sensor compatible object for the humidity sensor.
Definition: Adafruit_HTS221.h:69
Adafruit Unified Sensor interface for the temperature sensor component of HTS221. ...
Definition: Adafruit_HTS221.h:83
bool getEvent(sensors_event_t *)
Gets the humidity as a standard sensor event.
Definition: Adafruit_HTS221.cpp:479
#define HTS221_I2CADDR_DEFAULT
HTS221 default i2c address.
Definition: Adafruit_HTS221.h:28
Adafruit Unified Sensor interface for the humidity sensor component of HTS221.
Definition: Adafruit_HTS221.h:65
void getSensor(sensor_t *)
Gets the sensor_t object describing the HTS221's humidity sensor.
Definition: Adafruit_HTS221.cpp:459