Beta

Dependencies:   ST_INTERFACES X_NUCLEO_COMMON

Fork of X_NUCLEO_IKS01A2 by ST

Embed: (wiki syntax)

« Back to documentation index

HTS221Sensor Class Reference

HTS221Sensor Class Reference

Abstract class of an HTS221 Humidity and Temperature sensor. More...

#include <HTS221Sensor.h>

Public Member Functions

 HTS221Sensor (DevI2C &i2c)
 Constructor.
 HTS221Sensor (DevI2C &i2c, uint8_t address)
 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 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 58 of file HTS221Sensor.h.


Constructor & Destructor Documentation

HTS221Sensor ( DevI2C &  i2c )

Constructor.

Parameters:
i2cobject of an helper class which handles the I2C peripheral
addressthe address of the component's instance

Definition at line 53 of file HTS221Sensor.cpp.

HTS221Sensor ( DevI2C &  i2c,
uint8_t  address 
)

Constructor.

Parameters:
i2cobject of an helper class which handles the I2C peripheral
addressthe address of the component's instance

Definition at line 63 of file HTS221Sensor.cpp.


Member Function Documentation

int disable ( void   )

Disable HTS221.

Return values:
0in case of success, an error code otherwise

Definition at line 114 of file HTS221Sensor.cpp.

int enable ( void   )

Enable HTS221.

Return values:
0in case of success, an error code otherwise

Definition at line 99 of file HTS221Sensor.cpp.

int get_humidity ( float *  pfData ) [virtual]

Read HTS221 output register, and calculate the humidity.

Parameters:
pfDatathe pointer to data output
Return values:
0in case of success, an error code otherwise

Definition at line 178 of file HTS221Sensor.cpp.

int get_odr ( float *  odr )

Read HTS221 output register, and calculate the humidity.

Parameters:
odrthe pointer to the output data rate
Return values:
0in case of success, an error code otherwise

Definition at line 218 of file HTS221Sensor.cpp.

int get_temperature ( float *  pfData ) [virtual]

Read HTS221 output register, and calculate the temperature.

Parameters:
pfDatathe pointer to data output
Return values:
0in case of success, an error code otherwise

Definition at line 198 of file HTS221Sensor.cpp.

int init ( void *  init ) [virtual]

Initializing the component.

Parameters:
[in]initpointer to device specific initalization structure.
Return values:
0in case of success, an error code otherwise.

Definition at line 73 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:
0if ok, an error code otherwise.

Definition at line 82 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:
0if ok, an error code otherwise.

Definition at line 94 of file HTS221Sensor.h.

int read_id ( uint8_t *  id ) [virtual]

Read ID address of HTS221.

Parameters:
idthe pointer where the ID of the device is stored
Return values:
0in case of success, an error code otherwise

Definition at line 130 of file HTS221Sensor.cpp.

int read_reg ( uint8_t  reg,
uint8_t *  data 
)

Read the data from register.

Parameters:
regregister address
dataregister data
Return values:
0in case of success
1in case of failure

Definition at line 278 of file HTS221Sensor.cpp.

int reset ( void   )

Reboot memory content of HTS221.

Parameters:
None
Return values:
0in case of success, an error code otherwise

Definition at line 151 of file HTS221Sensor.cpp.

int set_odr ( float  odr )

Set ODR.

Parameters:
odrthe output data rate to be set
Return values:
0in case of success, an error code otherwise

Definition at line 254 of file HTS221Sensor.cpp.

int write_reg ( uint8_t  reg,
uint8_t  data 
)

Write the data to register.

Parameters:
regregister address
dataregister data
Return values:
0in case of success
1in case of failure

Definition at line 296 of file HTS221Sensor.cpp.