Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: X_NUCLEO_COMMON ST_INTERFACES
HTS221Sensor Class Reference
Abstract class of an HTS221 Humidity and Temperature sensor. More...
#include <HTS221Sensor.h>
Public Member Functions | |
HTS221Sensor (DevI2C *i2c, uint8_t address=HTS221_I2C_ADDRESS, PinName drdy_pin=NC) | |
Constructor. | |
virtual int | init (void *init) |
Initializing the component. | |
virtual int | read_id (uint8_t *id) |
Read ID address of HTS221. | |
virtual int | get_humidity (float *pfData) |
Read HTS221 output register, and calculate the humidity. | |
virtual int | get_temperature (float *pfData) |
Read HTS221 output register, and calculate the temperature. | |
int | enable (void) |
Enable HTS221. | |
int | disable (void) |
Disable HTS221. | |
int | reset (void) |
Reboot memory content of HTS221. | |
int | get_odr (float *odr) |
Read HTS221 output register, and calculate the humidity. | |
int | set_odr (float odr) |
Set ODR. | |
int | get_heater (uint8_t *heater) |
Get HTS221 heater configuration. | |
int | set_heater (uint8_t heater) |
Set HTS221 heater configuration. | |
int | get_avg (float *avgh, float *avgt) |
Get HTS221 averaging configuration. | |
int | set_avg (float avgh, float avgt) |
Set HTS221 averaging configuration. | |
int | read_reg (uint8_t reg, uint8_t *data) |
Read the data from register. | |
int | write_reg (uint8_t reg, uint8_t data) |
Write the data to register. | |
uint8_t | io_read (uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumByteToRead) |
Utility function to read data. | |
uint8_t | io_write (uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumByteToWrite) |
Utility function to write data. |
Detailed Description
Abstract class of an HTS221 Humidity and Temperature sensor.
Definition at line 59 of file HTS221Sensor.h.
Constructor & Destructor Documentation
HTS221Sensor | ( | DevI2C * | i2c, |
uint8_t | address = HTS221_I2C_ADDRESS , |
||
PinName | drdy_pin = NC |
||
) |
Constructor.
- Parameters:
-
i2c object of an helper class which handles the I2C peripheral address the address of the component's instance
Definition at line 58 of file HTS221Sensor.cpp.
Member Function Documentation
int disable | ( | void | ) |
Disable HTS221.
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 107 of file HTS221Sensor.cpp.
int enable | ( | void | ) |
Enable HTS221.
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 93 of file HTS221Sensor.cpp.
int get_avg | ( | float * | avgh, |
float * | avgt | ||
) |
Get HTS221 averaging configuration.
- Parameters:
-
avgh the pointer to the averaging for humidity, avgt the pointer to the averaging for temperature
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 304 of file HTS221Sensor.cpp.
int get_heater | ( | uint8_t * | heater ) |
Get HTS221 heater configuration.
- Parameters:
-
heater the pointer to the heater configuration
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 258 of file HTS221Sensor.cpp.
int get_humidity | ( | float * | pfData ) | [virtual] |
Read HTS221 output register, and calculate the humidity.
- Parameters:
-
pfData the pointer to data output
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 166 of file HTS221Sensor.cpp.
int get_odr | ( | float * | odr ) |
Read HTS221 output register, and calculate the humidity.
- Parameters:
-
odr the pointer to the output data rate
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 204 of file HTS221Sensor.cpp.
int get_temperature | ( | float * | pfData ) | [virtual] |
Read HTS221 output register, and calculate the temperature.
- Parameters:
-
pfData the pointer to data output
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 185 of file HTS221Sensor.cpp.
int init | ( | void * | init ) | [virtual] |
Initializing the component.
- Parameters:
-
[in] init pointer to device specific initalization structure.
- Return values:
-
0 in case of success, an error code otherwise.
Definition at line 70 of file HTS221Sensor.cpp.
uint8_t io_read | ( | uint8_t * | pBuffer, |
uint8_t | RegisterAddr, | ||
uint16_t | NumByteToRead | ||
) |
Utility function to read data.
- Parameters:
-
pBuffer,: pointer to data to be read. RegisterAddr,: specifies internal address register to be read. NumByteToRead,: number of bytes to be read.
- Return values:
-
0 if ok, an error code otherwise.
Definition at line 85 of file HTS221Sensor.h.
uint8_t io_write | ( | uint8_t * | pBuffer, |
uint8_t | RegisterAddr, | ||
uint16_t | NumByteToWrite | ||
) |
Utility function to write data.
- Parameters:
-
pBuffer,: pointer to data to be written. RegisterAddr,: specifies internal address register to be written. NumByteToWrite,: number of bytes to write.
- Return values:
-
0 if ok, an error code otherwise.
Definition at line 111 of file HTS221Sensor.h.
int read_id | ( | uint8_t * | id ) | [virtual] |
Read ID address of HTS221.
- Parameters:
-
id the pointer where the ID of the device is stored
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 122 of file HTS221Sensor.cpp.
int read_reg | ( | uint8_t | reg, |
uint8_t * | data | ||
) |
Read the data from register.
- Parameters:
-
reg register address data register data
- Return values:
-
0 in case of success 1 in case of failure
Definition at line 418 of file HTS221Sensor.cpp.
int reset | ( | void | ) |
Reboot memory content of HTS221.
- Parameters:
-
None
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 141 of file HTS221Sensor.cpp.
int set_avg | ( | float | avgh, |
float | avgt | ||
) |
Set HTS221 averaging configuration.
- Parameters:
-
avgh the averagingfor humidity to be set, avgt the averaging for temperature to be set
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 379 of file HTS221Sensor.cpp.
int set_heater | ( | uint8_t | heater ) |
Set HTS221 heater configuration.
- Parameters:
-
heater the heater configuration to be set
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 285 of file HTS221Sensor.cpp.
int set_odr | ( | float | odr ) |
Set ODR.
- Parameters:
-
odr the output data rate to be set
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 238 of file HTS221Sensor.cpp.
int write_reg | ( | uint8_t | reg, |
uint8_t | data | ||
) |
Write the data to register.
- Parameters:
-
reg register address data register data
- Return values:
-
0 in case of success 1 in case of failure
Definition at line 435 of file HTS221Sensor.cpp.
Generated on Thu Jul 14 2022 22:19:05 by
