htu21d 2.0.0.0
htu21d.h File Reference

This file contains API for HTU21D Click driver. More...

#include "drv_digital_out.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  htu21d_t
 Click ctx object definition. More...
 
struct  htu21d_cfg_t
 Click configuration structure definition. More...
 

Macros

#define HTU21D_MAP_MIKROBUS(cfg, mikrobus)
 
#define HTU21D_RETVAL   uint8_t
 
#define HTU21D_OK   0x00
 
#define HTU21D_INIT_ERROR   0xFF
 
#define HTU21D_I2C_ADDRESS   0x40
 
#define HTU21D_USER_REG_WRITE   0xE6
 
#define HTU21D_USER_REG_READ   0xE7
 
#define HTU21D_HEATER_REG_WRITE   0x51
 
#define HTU21D_HEATER_REG_READ   0x11
 
#define HTU21D_SOFT_RESET   0xFE
 
#define HTU21D_SERIAL1_READ1   0xFA
 
#define HTU21D_SERIAL1_READ2   0x0F
 
#define HTU21D_SERIAL2_READ1   0xFC
 
#define HTU21D_SERIAL2_READ2   0xC9
 
#define HTU21D_SI7013_CHIPID   0x0D
 
#define HTU21D_SI7020_CHIPID   0x14
 
#define HTU21D_SI7021_CHIPID   0x15
 
#define HTU21D_CHIPID   0x32
 
#define HTU21D_FIRMWARE_READ1   0x84
 
#define HTU21D_FIRMWARE_READ2   0xB8
 
#define HTU21D_FIRMWARE_V1   0xFF
 
#define HTU21D_FIRMWARE_V2   0x20
 
#define HTU21D_FORCE_READ_TEMP   0xFE
 
#define HTU21D_ERROR   0xFF
 
#define HTU21D_RES_RH12_TEMP14   0x00
 
#define HTU21D_RES_RH8_TEMP12   0x01
 
#define HTU21D_RES_RH10_TEMP13   0x80
 
#define HTU21D_RES_RH11_TEMP11   0x81
 
#define HTU21D_TRIG_HUMD_MEASURE_HOLD   0xE5
 
#define HTU21D_TRIG_HUMD_MEASURE_NOHOLD   0xF5
 
#define HTU21D_TRIG_TEMP_MEASURE_HOLD   0xE3
 
#define HTU21D_TRIG_TEMP_MEASURE_NOHOLD   0xF3
 
#define HTU21D_ON   0x04
 
#define HTU21D_OFF   0xFB
 
#define HTU21D_CRC8_POLYNOMINAL   0x1310
 
#define HTU21D_DATA_FILTER   0xFFFC
 
#define HTU21D_DATA_RESOLUTION   65536.0
 
#define HTU21D_TEMP_CALC_COEF   175.72
 
#define HTU21D_TEMP_STB_COEF   -46.85
 
#define HTU21D_HUMI_CALC_COEF   125.0
 
#define HTU21D_HUMI_STB_COEF   6.0
 

Functions

void htu21d_cfg_setup (htu21d_cfg_t *cfg)
 Config Object Initialization function.
 
HTU21D_RETVAL htu21d_init (htu21d_t *ctx, htu21d_cfg_t *cfg)
 Initialization function.
 
void htu21d_generic_write (htu21d_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void htu21d_generic_read (htu21d_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
uint32_t htu21d_read_data (htu21d_t *ctx, uint8_t reg_adr)
 Generic read 24-bit data function.
 
void htu21d_send_cmd (htu21d_t *ctx, uint8_t cmd_byte)
 Send command function.
 
float htu21d_get_temperature (htu21d_t *ctx)
 Get temperature value function.
 
float htu21d_get_humidity (htu21d_t *ctx)
 Get humidity value function.
 

Detailed Description

This file contains API for HTU21D Click driver.