| Nordic Thingy:52 v2.0.0

Data Structures | Macros | Functions
HTS221 humidity sensor
Drivers » Humidity sensor

HTS221 humidity sensor API. More...

## Data Structures

struct | drv_hts221_calib_t
| Calibration struct. More...
struct | drv_hts221_cfg_t
| Configuration struct for HTS221 humidity sensor. More...
struct | drv_hts221_twi_cfg_t
| Initialization struct for the humidity driver. More...

## Macros

#define | AV_CONF_REG 0x10
| Humidity and temperature resolution/average mode register.
#define | AV_CONF_REG_AVGH_Pos 0
| Bitmasks for AVGH.
#define | AV_CONF_REG_AVGT_Pos 3
| Bitmasks for AVGT.
#define | CTRL_REG1 0x20
| Control register 1.
#define | CTRL_REG1_BDU_Pos 2
| Bitmasks for BDU.
#define | CTRL_REG1_ODR_Pos 0
| Bitmasks for ODR.
#define | CTRL_REG1_PD_Pos 7
| Bitmasks for PD.
#define | CTRL_REG2 0x21
| Control register 2.
#define | CTRL_REG2_BOOT_Pos 7
| Bitmasks for BOOT.
#define | CTRL_REG2_HEATER_Pos 1
| Bitmasks for HEATER.
#define | CTRL_REG2_ONE_SHOT_Pos 0
| Bitmasks for ONE_SHOT.
#define | CTRL_REG3 0x22
| Control register 3.
#define | CTRL_REG3_DRDY_H_L_Pos 7
| Bitmasks for DRDY_H_L.
#define | CTRL_REG3_DRDY_Pos 2
| Bitmasks for DRDY.
#define | CTRL_REG3_PP_OD_Pos 6
| Bitmasks for PP_OD.
#define | HUMIDITY_OUT_H_REG 0x29
| Relative humidity data (MSB).
#define | HUMIDITY_OUT_L_REG 0x28
| Relative humidity data (LSB).
#define | STATUS_REG 0x27
| Status register.
#define | STATUS_REG_H_DA_Pos 1
| Bitmasks for H_DA.
#define | STATUS_REG_T_DA_Pos 0
| Bitmasks for T_DA.
#define | TEMP_OUT_H_REG 0x2B
| Temperature data (MSB).
#define | TEMP_OUT_L_REG 0x2A
| Temperature data (LSB).
#define | WHO_AM_I_REG 0x0F
| Device identification register.

## Functions

uint32_t | drv_hts221_calib_get (drv_hts221_calib_t *p_calib)
| Function for getting the sensor calibration data. More...
uint32_t | drv_hts221_cfg_get (drv_hts221_cfg_t *p_cfg)
| Function for reading the configuration of the HTS221 sensor. More...
uint32_t | drv_hts221_cfg_set (drv_hts221_cfg_t const *const p_cfg)
| Function for configuring the HTS221 sensor according to the specified configuration. More...
uint32_t | drv_hts221_close (void)
| Function for closing the HTS221 driver. More...
uint32_t | drv_hts221_humidity_get (int16_t *p_humidity)
| Function for getting the humidity data. More...
uint32_t | drv_hts221_init (void)
| Function for initializing the HTS221 driver. More...
uint32_t | drv_hts221_one_shot (void)
| Function for starting one shot conversion. More...
uint32_t | drv_hts221_open (drv_hts221_twi_cfg_t const *const p_cfg)
| Function for opening the HTS221 driver according to the specified configuration. More...
uint32_t | drv_hts221_reboot (void)
| Function for rebooting the HTS221 memory content. More...
uint32_t | drv_hts221_status_get (uint8_t *p_status)
| Function for getting the status. More...
uint32_t | drv_hts221_temperature_get (int16_t *p_temperature)
| Function for getting the temperature data. More...
uint32_t | drv_hts221_verify (void)
| Function for verifying the HTS221 WHO_AM_I register. More...

## Detailed Description

HTS221 humidity sensor API.

## Function Documentation

## ◆ drv_hts221_calib_get()

uint32_t drv_hts221_calib_get | ( | drv_hts221_calib_t * | p_calib | ) |

Function for getting the sensor calibration data.

Parameters

  [out] | p_calib | Calibration values.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_hts221_cfg_get()

uint32_t drv_hts221_cfg_get | ( | drv_hts221_cfg_t * | p_cfg | ) |

Function for reading the configuration of the HTS221 sensor.

Parameters

  [in] | p_cfg | Pointer to the driver configuration for the session to be opened.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_hts221_cfg_set()

uint32_t drv_hts221_cfg_set | ( | drv_hts221_cfg_t const *const | p_cfg | ) |

Function for configuring the HTS221 sensor according to the specified configuration.

Parameters

  [in] | p_cfg | Pointer to the sensor configuration.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_hts221_close()

uint32_t drv_hts221_close | ( | void |  | ) |

Function for closing the HTS221 driver.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_hts221_humidity_get()

uint32_t drv_hts221_humidity_get | ( | int16_t * | p_humidity | ) |

Function for getting the humidity data.

Parameters

  [out] | p_humidity | Fetched from humidity registers.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_hts221_init()

uint32_t drv_hts221_init | ( | void |  | ) |

Function for initializing the HTS221 driver.

Returns
  NRF_SUCCESS Success. Only possible return value.

## ◆ drv_hts221_one_shot()

uint32_t drv_hts221_one_shot | ( | void |  | ) |

Function for starting one shot conversion.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_hts221_open()

uint32_t drv_hts221_open | ( | drv_hts221_twi_cfg_t const *const | p_cfg | ) |

Function for opening the HTS221 driver according to the specified configuration.

Parameters

  [in] | p_cfg | Pointer to the driver configuration for the session to be opened.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_hts221_reboot()

uint32_t drv_hts221_reboot | ( | void |  | ) |

Function for rebooting the HTS221 memory content.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_hts221_status_get()

uint32_t drv_hts221_status_get | ( | uint8_t * | p_status | ) |

Function for getting the status.

Parameters

  [out] | p_status | Contents of the status register.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_hts221_temperature_get()

uint32_t drv_hts221_temperature_get | ( | int16_t * | p_temperature | ) |

Function for getting the temperature data.

Parameters

  [out] | p_temperature | Fetched from temperature registers.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_hts221_verify()

uint32_t drv_hts221_verify | ( | void |  | ) |

Function for verifying the HTS221 WHO_AM_I register.

Returns
  NRF_SUCCESS If the call was successful.