ST HTS221 digital Humidity Sensor

Driver for the ST HTS221 digital Humidity Sensor. More...

Detailed Description

Driver for the ST HTS221 digital Humidity Sensor.

Files

file  hts221_regs.h
 Register definitions for ST HTS221 devices.
 
file  hts221.h
 Interface definition for the ST HTS221 driver.
 

Data Structures

struct  hts221_params_t
 Parameters needed for device initialization. More...
 
struct  hts221_t
 Device descriptor for HTS221 sensors. More...
 

Macros

#define HTS221_I2C_ADDRESS   (0x5F)
 Default I2C bus address (7 Bit) of HTS221 devices.
 

Enumerations

enum  { HTS221_OK = 0, HTS221_ERROR, HTS221_NOBUS, HTS221_NODEV }
 Return values and error codes.
 

Functions

int hts221_init (hts221_t *dev, const hts221_params_t *params)
 Initialize the given HTS221 device. More...
 
int hts221_reboot (const hts221_t *dev)
 Reboot device and reload base configuration. More...
 
int hts221_one_shot (const hts221_t *dev)
 Set device to continues measurements. More...
 
int hts221_set_rate (const hts221_t *dev, const uint8_t rate)
 Set device to continues measurements. More...
 
int hts221_power_on (const hts221_t *dev)
 Set device to active. More...
 
int hts221_power_off (const hts221_t *dev)
 Set device to power down. More...
 
int hts221_get_state (const hts221_t *dev)
 Set device to power down. More...
 
int hts221_read_humidity (const hts221_t *dev, uint16_t *val)
 Reading humidity and temperature. More...
 
int hts221_read_temperature (const hts221_t *dev, int16_t *val)
 Reading humidity and temperature. More...
 

Function Documentation

◆ hts221_get_state()

int hts221_get_state ( const hts221_t dev)

Set device to power down.

Parameters
[in]devdevice descriptor of sensor
Returns
>=0 on success
-HTS221_NOBUS on error

◆ hts221_init()

int hts221_init ( hts221_t dev,
const hts221_params_t params 
)

Initialize the given HTS221 device.

Parameters
[out]devdevice descriptor of sensor to initialize
[in]paramsconfiguration parameters
Returns
HTS221_OK on success
HTS221_NOBUS if initialization of I2C bus fails
HTS221_NODEV if no HTS221 device found on bus

◆ hts221_one_shot()

int hts221_one_shot ( const hts221_t dev)

Set device to continues measurements.

Parameters
[in]devdevice descriptor of sensor
Returns
0 on success, or error otherwise

◆ hts221_power_off()

int hts221_power_off ( const hts221_t dev)

Set device to power down.

Parameters
[in]devdevice descriptor of sensor
Returns
0 on success, or error otherwise

◆ hts221_power_on()

int hts221_power_on ( const hts221_t dev)

Set device to active.

Parameters
[in]devdevice descriptor of sensor
Returns
0 on success, or error otherwise

◆ hts221_read_humidity()

int hts221_read_humidity ( const hts221_t dev,
uint16_t *  val 
)

Reading humidity and temperature.

Parameters
[in]devdevice descriptor of sensor
[out]valhumidity [in 10 * percent relative]
Returns
0 on success, or error otherwise

◆ hts221_read_temperature()

int hts221_read_temperature ( const hts221_t dev,
int16_t *  val 
)

Reading humidity and temperature.

Parameters
[in]devdevice descriptor of sensor
[out]valtemperature [in 100 * degree centigrade]
Returns
0 on success, or error otherwise

◆ hts221_reboot()

int hts221_reboot ( const hts221_t dev)

Reboot device and reload base configuration.

Parameters
[in]devdevice descriptor of sensor
Returns
0 on success, or error otherwise

◆ hts221_set_rate()

int hts221_set_rate ( const hts221_t dev,
const uint8_t  rate 
)

Set device to continues measurements.

Parameters
[in]devdevice descriptor of sensor
[in]rateconversion rate for continues mode
Returns
0 on success, or error otherwise