|
HTS221
Arduino library for the HTS221 humidity and temperature sensor
|
#include <HTS221Sensor.h>
Public Member Functions | |
| HTS221Sensor (TwoWire *i2c) | |
| Construct an HTS221 sensor driver. | |
| HTS221StatusTypeDef | begin (void) |
| Configure the sensor in order to be used. | |
| HTS221StatusTypeDef | end (void) |
| Disable the sensor and relative resources. | |
| HTS221StatusTypeDef | Enable (void) |
| Enable HTS221. | |
| HTS221StatusTypeDef | Disable (void) |
| Disable HTS221. | |
| HTS221StatusTypeDef | ReadID (uint8_t *ht_id) |
| Read ID address of HTS221. | |
| HTS221StatusTypeDef | Reset (void) |
| Reboot memory content of HTS221. | |
| HTS221StatusTypeDef | GetHumidity (float *pfData) |
| Read humidity and convert the result to percent. | |
| HTS221StatusTypeDef | GetTemperature (float *pfData) |
| Read temperature and convert the result to degrees Celsius. | |
| HTS221StatusTypeDef | GetODR (float *odr) |
| Get the configured output data rate. | |
| HTS221StatusTypeDef | SetODR (float odr) |
| Set the output data rate. | |
| HTS221StatusTypeDef | ReadReg (uint8_t reg, uint8_t *data) |
| Read the data from register. | |
| HTS221StatusTypeDef | WriteReg (uint8_t reg, uint8_t data) |
| Write the data to register. | |
| uint8_t | IO_Read (uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumByteToRead) |
| Read bytes from the sensor over I2C. | |
| uint8_t | IO_Write (uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumByteToWrite) |
| Write bytes to the sensor over I2C. | |
Controls an HTS221 humidity and temperature sensor over I2C.
| HTS221Sensor::HTS221Sensor | ( | TwoWire * | i2c | ) |
Construct an HTS221 sensor driver.
Construct the sensor interface using the supplied I2C bus.
| i2c | I2C interface used to communicate with the sensor. |
| HTS221StatusTypeDef HTS221Sensor::begin | ( | void | ) |
Configure the sensor in order to be used.
Initialize the sensor and its communication interface.
| 0 | in case of success, an error code otherwise |
| HTS221StatusTypeDef HTS221Sensor::Disable | ( | void | ) |
Disable HTS221.
Disable sensor measurements.
| HTS221_STATUS_OK | in case of success, an error code otherwise |
| HTS221StatusTypeDef HTS221Sensor::Enable | ( | void | ) |
Enable HTS221.
Enable sensor measurements.
| HTS221_STATUS_OK | in case of success, an error code otherwise |
| HTS221StatusTypeDef HTS221Sensor::end | ( | void | ) |
Disable the sensor and relative resources.
Shut down the sensor interface.
| 0 | in case of success, an error code otherwise |
| HTS221StatusTypeDef HTS221Sensor::GetHumidity | ( | float * | pfData | ) |
Read humidity and convert the result to percent.
Read relative humidity into pfData.
| pfData | pointer receiving humidity in percent |
| HTS221_STATUS_OK | in case of success, an error code otherwise |
| HTS221StatusTypeDef HTS221Sensor::GetODR | ( | float * | odr | ) |
Get the configured output data rate.
Get the output data rate and store it in odr.
| odr | pointer receiving the rate in hertz (0.0 for one-shot mode) |
| HTS221_STATUS_OK | in case of success, an error code otherwise |
| HTS221StatusTypeDef HTS221Sensor::GetTemperature | ( | float * | pfData | ) |
Read temperature and convert the result to degrees Celsius.
Read temperature into pfData.
| pfData | pointer receiving temperature in degrees Celsius |
| HTS221_STATUS_OK | in case of success, an error code otherwise |
|
inline |
Read bytes from the sensor over I2C.
| pBuffer | Destination buffer for the bytes read. |
| RegisterAddr | Internal register address to read from. |
| NumByteToRead | Number of bytes to read. |
|
inline |
Write bytes to the sensor over I2C.
| pBuffer | Source buffer containing the bytes to write. |
| RegisterAddr | Internal register address to write to. |
| NumByteToWrite | Number of bytes to write. |
| HTS221StatusTypeDef HTS221Sensor::ReadID | ( | uint8_t * | ht_id | ) |
Read ID address of HTS221.
Read the sensor identifier into ht_id.
| ht_id | the pointer where the ID of the device is stored |
| HTS221_STATUS_OK | in case of success, an error code otherwise |
| HTS221StatusTypeDef HTS221Sensor::ReadReg | ( | uint8_t | reg, |
| uint8_t * | data | ||
| ) |
Read the data from register.
Read register reg into data.
| reg | register address |
| data | register data |
| HTS221_STATUS_OK | in case of success |
| HTS221_STATUS_ERROR | in case of failure |
| HTS221StatusTypeDef HTS221Sensor::Reset | ( | void | ) |
Reboot memory content of HTS221.
Reset the sensor.
| HTS221_STATUS_OK | in case of success, an error code otherwise |
| HTS221StatusTypeDef HTS221Sensor::SetODR | ( | float | odr | ) |
Set the output data rate.
Set the output data rate to odr.
| odr | requested rate in hertz; the closest supported rate not below the request is selected (1, 7, or 12.5 Hz) |
| HTS221_STATUS_OK | in case of success, an error code otherwise |
| HTS221StatusTypeDef HTS221Sensor::WriteReg | ( | uint8_t | reg, |
| uint8_t | data | ||
| ) |
Write the data to register.
Write data to register reg.
| reg | register address |
| data | register data |
| HTS221_STATUS_OK | in case of success |
| HTS221_STATUS_ERROR | in case of failure |