htu21d 2.0.0.0
Public function

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

Function Documentation

◆ htu21d_cfg_setup()

void htu21d_cfg_setup ( htu21d_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ htu21d_generic_read()

void htu21d_generic_read ( htu21d_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic read function.

Data read function.

Parameters
ctxClick object.
regRegister address.
data_bufOutput data buf
lenNumber of the bytes to be read

@description This function reads data from the desired register.

◆ htu21d_generic_write()

void htu21d_generic_write ( htu21d_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_bufData buf to be written.
lenNumber of the bytes in data buf.

@description This function writes data to the desired register.

◆ htu21d_get_humidity()

float htu21d_get_humidity ( htu21d_t * ctx)

Get humidity value function.

Parameters
ctxClick object.
Returns
float humidity data percentage.

@description Function read and calculate humidity percentage from the HTU21D sensor.

◆ htu21d_get_temperature()

float htu21d_get_temperature ( htu21d_t * ctx)

Get temperature value function.

Parameters
ctxClick object.
Returns
float temperature data degrees Celsius.

@description Function read and calculate temperature in degrees Celsius from the HTU21D sensor.

◆ htu21d_init()

HTU21D_RETVAL htu21d_init ( htu21d_t * ctx,
htu21d_cfg_t * cfg )

Initialization function.

Parameters
htu21dClick object.
cfgClick configuration structure.

@description This function initializes all necessary pins and peripherals used for this click.

◆ htu21d_read_data()

uint32_t htu21d_read_data ( htu21d_t * ctx,
uint8_t reg_adr )

Generic read 24-bit data function.

Parameters
ctxClick object.
reg_adrRegister address.
Returns
24-bit data from addressed register from HTU21D.

@description Function read 24-bit data from register address of HTU21D.

◆ htu21d_send_cmd()

void htu21d_send_cmd ( htu21d_t * ctx,
uint8_t cmd_byte )

Send command function.

Parameters
ctxClick object.
cmd_byteCommand byte.

@description Function sends command to HTU21D.

Note
It takes ~ 15 ms delay to reset.