I2C driver and definition of HTS221 humidity and temperature sensor.
See HTS221 datasheet.
HTS221 supports autonomous sampling with user defined output data rate, as well as one-shot data acquisition (see hts221_odr_t
data type).
New data from HTS221 can be obtained in two modes:
Note: The user is responsible for initialization and configuration of I2C bus.
After calling hts221_create()
and hts221_init()
the user is responsible for reading out new samples from HTS221.
If autonomous sampling was configured, it is enough to call hts221_get_temperature()
and/or hts221_get_humidity()
periodically.
If one-shot sampling was configured, the sampling must be first triggered by hts221_start_oneshot()
.
In this mode HTS221 asserts DRDY pin when new data of either temperature or humidity is available. The data is read out in a separate FreeRTOS task.
Note: This mode is only available if the DRDY pin of HTS221 is connected to MCU.
After calling hts221_create()
and hts221_init()
, the DRDY mode is enabled by calling hts221_drdy_enable()
which registers a user's new data function callback.
Copy to Clipboard
idf.py add-dependency "espressif/hts221^1.1.4"
Copy to Clipboard
Copy to Clipboard