Class that stores state and functions for interacting with the HTS221 I2C Digital Potentiometer.
More...
#include <Adafruit_HTS221.h>
|
| Adafruit_HTS221 () |
| Instantiates a new HTS221 class.
|
|
bool | begin_I2C (uint8_t i2c_addr=HTS221_I2CADDR_DEFAULT, TwoWire *wire=&Wire, int32_t sensor_id=0) |
| Sets up the hardware and initializes I2C. More...
|
|
bool | begin_SPI (uint8_t cs_pin, SPIClass *theSPI=&SPI, int32_t sensor_id=0) |
| Sets up the hardware and initializes hardware SPI. More...
|
|
bool | begin_SPI (int8_t cs_pin, int8_t sck_pin, int8_t miso_pin, int8_t mosi_pin, int32_t sensor_id=0) |
| Sets up the hardware and initializes software SPI. More...
|
|
void | boot (void) |
| Restores the trimming function values into registers from flash.
|
|
void | setActive (bool active) |
| Sets the sensor to active or inactive. More...
|
|
hts221_rate_t | getDataRate (void) |
| Returns the current measurement rate. More...
|
|
void | setDataRate (hts221_rate_t data_rate) |
| Sets the rate at which measurements are taken. More...
|
|
void | drdyActiveLow (bool active_low) |
| Sets the polarity of the DRDY pin when active. More...
|
|
void | drdyIntEnabled (bool drdy_int_enabled) |
| Enables or disables the Data Ready (DRDY) interrupt on the DRDY pin. More...
|
|
bool | getEvent (sensors_event_t *humidity, sensors_event_t *temp) |
| Gets the humidity sensor and temperature values as sensor events. More...
|
|
Adafruit_Sensor * | getTemperatureSensor (void) |
| Gets the Adafruit_Sensor object for the HTS221's humidity sensor. More...
|
|
Adafruit_Sensor * | getHumiditySensor (void) |
| Gets the Adafruit_Sensor object for the HTS221's humidity sensor. More...
|
|
|
bool | _read (void) |
| Updates the measurement data for all sensors simultaneously. More...
|
|
virtual bool | _init (int32_t sensor_id) |
| Initializer for post i2c/spi init. More...
|
|
Class that stores state and functions for interacting with the HTS221 I2C Digital Potentiometer.
◆ begin_I2C()
bool Adafruit_HTS221::begin_I2C |
( |
uint8_t |
i2c_address = HTS221_I2CADDR_DEFAULT , |
|
|
TwoWire * |
wire = &Wire , |
|
|
int32_t |
sensor_id = 0 |
|
) |
| |
Sets up the hardware and initializes I2C.
- Parameters
-
i2c_address | The I2C address to be used. |
wire | The Wire object to be used for I2C connections. |
sensor_id | The unique ID to differentiate the sensors from others |
- Returns
- True if initialization was successful, otherwise false.
◆ begin_SPI() [1/2]
bool Adafruit_HTS221::begin_SPI |
( |
uint8_t |
cs_pin, |
|
|
SPIClass * |
theSPI = &SPI , |
|
|
int32_t |
sensor_id = 0 |
|
) |
| |
Sets up the hardware and initializes hardware SPI.
- Parameters
-
cs_pin | The arduino pin # connected to chip select |
theSPI | The SPI object to be used for SPI connections. |
sensor_id | The user-defined ID to differentiate different sensors |
- Returns
- True if initialization was successful, otherwise false.
◆ begin_SPI() [2/2]
bool Adafruit_HTS221::begin_SPI |
( |
int8_t |
cs_pin, |
|
|
int8_t |
sck_pin, |
|
|
int8_t |
miso_pin, |
|
|
int8_t |
mosi_pin, |
|
|
int32_t |
sensor_id = 0 |
|
) |
| |
Sets up the hardware and initializes software SPI.
- Parameters
-
cs_pin | The arduino pin # connected to chip select |
sck_pin | The arduino pin # connected to SPI clock |
miso_pin | The arduino pin # connected to SPI MISO |
mosi_pin | The arduino pin # connected to SPI MOSI |
sensor_id | The user-defined ID to differentiate different sensors |
- Returns
- True if initialization was successful, otherwise false.
◆ setActive()
void Adafruit_HTS221::setActive |
( |
bool |
active | ) |
|
Sets the sensor to active or inactive.
- Parameters
-
active | Set to true to enable the sensor, false to disable |
◆ getDataRate()
Returns the current measurement rate.
- Returns
- hts221_rate_t the current measurement rate
◆ setDataRate()
Sets the rate at which measurements are taken.
- Parameters
-
data_rate | The new measurement rate. Must be a hts221_rate_t |
◆ drdyActiveLow()
void Adafruit_HTS221::drdyActiveLow |
( |
bool |
active_low | ) |
|
Sets the polarity of the DRDY pin when active.
- Parameters
-
active_low | Set to true to make the DRDY pin active low, false for active low |
◆ drdyIntEnabled()
void Adafruit_HTS221::drdyIntEnabled |
( |
bool |
drdy_int_enabled | ) |
|
Enables or disables the Data Ready (DRDY) interrupt on the DRDY pin.
- Parameters
-
drdy_int_enabled | Set to true to enable the DRDY interrupt, false to disable |
◆ getEvent()
bool Adafruit_HTS221::getEvent |
( |
sensors_event_t * |
humidity, |
|
|
sensors_event_t * |
temp |
|
) |
| |
Gets the humidity sensor and temperature values as sensor events.
- Parameters
-
humidity | Sensor event object that will be populated with humidity data |
temp | Sensor event object that will be populated with temp data |
- Returns
- true if the event data was read successfully
◆ getTemperatureSensor()
Adafruit_Sensor * Adafruit_HTS221::getTemperatureSensor |
( |
void |
| ) |
|
Gets the Adafruit_Sensor object for the HTS221's humidity sensor.
- Returns
- Adafruit_Sensor*
◆ getHumiditySensor()
Adafruit_Sensor * Adafruit_HTS221::getHumiditySensor |
( |
void |
| ) |
|
Gets the Adafruit_Sensor object for the HTS221's humidity sensor.
- Returns
- Adafruit_Sensor*
◆ _read()
bool Adafruit_HTS221::_read |
( |
void |
| ) |
|
|
protected |
Updates the measurement data for all sensors simultaneously.
- Returns
- true if the event data was read successfully
◆ _init()
bool Adafruit_HTS221::_init |
( |
int32_t |
sensor_id | ) |
|
|
protectedvirtual |
Initializer for post i2c/spi init.
- Parameters
-
sensor_id | Optional unique ID for the sensor set |
- Returns
- True if chip identified and initialized
◆ Adafruit_HTS221_Temp
Gives access to private members to Temp data object
◆ Adafruit_HTS221_Humidity
Gives access to private members to Humidity data object
◆ humidity_sensor
Initial value:
Humidity sensor data object.
The documentation for this class was generated from the following files: