dht222  2.0.0.0
Functions
Public function

Functions

void dht222_cfg_setup (dht222_cfg_t *cfg)
 Config Object Initialization function. More...
 
DHT222_RETVAL dht222_init (dht222_t *ctx, dht222_cfg_t *cfg)
 Initialization function. More...
 
void dht222_generic_write (dht222_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function. More...
 
void dht222_generic_read (dht222_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function. More...
 
uint8_t dht222_read_byte (dht222_t *ctx, uint8_t address)
 Generic read 8-bit data function. More...
 
uint16_t dht222_read_data (dht222_t *ctx, uint8_t address)
 Generic read 16-bit data function. More...
 
uint32_t dht222_read_all_data (dht222_t *ctx, uint8_t address)
 Reads 32-bit value from given address. More...
 
uint16_t dht222_get_temperature (dht222_t *ctx)
 Reads temperature from AM2322 sensor. More...
 
uint16_t dht222_get_humidity (dht222_t *ctx)
 Reads humidity from AM2322 sensor. More...
 
uint16_t dht222_get_model (dht222_t *ctx)
 Get model of AM2322 sensor. More...
 
uint16_t dht222_get_users_reg1 (dht222_t *ctx)
 Get users register 1 of AM2322 sensor. More...
 
uint16_t dht222_get_users_reg2 (dht222_t *ctx)
 Get users register 2 of AM2322 sensor. More...
 
uint8_t dht222_get_version (dht222_t *ctx)
 Get version of AM2322 sensor. More...
 
uint32_t dht222_get_id (dht222_t *ctx)
 Get ID of AM2322 sensor. More...
 

Detailed Description

Function Documentation

◆ dht222_cfg_setup()

void dht222_cfg_setup ( dht222_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.

◆ dht222_generic_read()

void dht222_generic_read ( dht222_t ctx,
uint8_t  reg,
uint8_t *  data_buf,
uint8_t  len 
)

Generic 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.

◆ dht222_generic_write()

void dht222_generic_write ( dht222_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.

◆ dht222_get_humidity()

uint16_t dht222_get_humidity ( dht222_t ctx)

Reads humidity from AM2322 sensor.

Parameters
ctxClick object
Returns
humidity 16-bit humidity data

@description The function calculate the humidity data from sensor data reading from the sensor AM2322 on the DHT22 2 Click.

Note
The 16-bit humidity data should be divided by 10 to obtain the exact percentage of humidity [ % RH ].

◆ dht222_get_id()

uint32_t dht222_get_id ( dht222_t ctx)

Get ID of AM2322 sensor.

Parameters
ctxClick object
Returns
ID 16-bit version data

@description Function read from the ID register of AM2322 sensor and return 16-bit ID data.

◆ dht222_get_model()

uint16_t dht222_get_model ( dht222_t ctx)

Get model of AM2322 sensor.

Returns
model 16-bit model data

@description Function read from the model register of AM2322 sensor and return 16-bit model data.

◆ dht222_get_temperature()

uint16_t dht222_get_temperature ( dht222_t ctx)

Reads temperature from AM2322 sensor.

Parameters
ctxClick object
Returns
temperature 16-bit temperature data

@description The function calculate the temperature data from sensor data reading from the sensor AM2322 on the DHT22 2 Click.

Note
The 16-bit temperature data should be divided by 10 to obtain the exact temperature value in degrees Celsius [ �C ].

◆ dht222_get_users_reg1()

uint16_t dht222_get_users_reg1 ( dht222_t ctx)

Get users register 1 of AM2322 sensor.

Parameters
ctxClick object
Returns
users_register 16-bit users register data

@description Function read from the users register 1 of AM2322 sensor and return 16-bit users register 1 data.

◆ dht222_get_users_reg2()

uint16_t dht222_get_users_reg2 ( dht222_t ctx)

Get users register 2 of AM2322 sensor.

Parameters
ctxClick object
Returns
users_register 16-bit users register data

@description Function read from the users register 2 of AM2322 sensor and return 16-bit users register 2 data.

◆ dht222_get_version()

uint8_t dht222_get_version ( dht222_t ctx)

Get version of AM2322 sensor.

Parameters
ctxClick object
Returns
version 16-bit version data

@description Function read from the version register of AM2322 sensor and return 16-bit version data.

◆ dht222_init()

DHT222_RETVAL dht222_init ( dht222_t ctx,
dht222_cfg_t cfg 
)

Initialization function.

Parameters
ctxClick object
dht222Click object.
cfgClick configuration structure.

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

◆ dht222_read_all_data()

uint32_t dht222_read_all_data ( dht222_t ctx,
uint8_t  address 
)

Reads 32-bit value from given address.

Parameters
ctxClick object
address8-bit address of data that has to be read
Returns
result 32-bit data from given address

@description Function read 32-bit data from 8-bit register address.

◆ dht222_read_byte()

uint8_t dht222_read_byte ( dht222_t ctx,
uint8_t  address 
)

Generic read 8-bit data function.

Parameters
ctxClick object
address8-bit address of data that has to be read
Returns
response 8-bit data from given address

@description Function read 8-bit data from 8-bit register address.

◆ dht222_read_data()

uint16_t dht222_read_data ( dht222_t ctx,
uint8_t  address 
)

Generic read 16-bit data function.

Parameters
ctxClick object
address8-bit address of data that has to be read
Returns
result 16-bit data from given address

@description Function read 16-bit data from 8-bit register address.