dht222 2.0.0.0
Public function

Functions

void dht222_cfg_setup (dht222_cfg_t *cfg)
 Config Object Initialization function.
 
err_t dht222_init (dht222_t *ctx, dht222_cfg_t *cfg)
 Initialization function.
 
err_t dht222_read_reg (dht222_t *ctx, uint8_t address, uint8_t *data_out, uint8_t len)
 Generic read function.
 
err_t dht222_write_reg (dht222_t *ctx, uint8_t address, uint8_t *data_in, uint8_t len)
 Generic write function.
 
err_t dht222_get_temperature (dht222_t *ctx, uint16_t *temperature)
 Reads temperature from AM2322 sensor.
 
err_t dht222_get_humidity (dht222_t *ctx, uint16_t *humidity)
 Reads humidity from AM2322 sensor.
 
err_t dht222_get_temp_hum (dht222_t *ctx, uint16_t *temperature, uint16_t *humidity)
 Reads temperature and humidity from AM2322 sensor.
 

Detailed Description

Function Documentation

◆ dht222_cfg_setup()

void dht222_cfg_setup ( dht222_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ dht222_get_humidity()

err_t dht222_get_humidity ( dht222_t * ctx,
uint16_t * humidity )

Reads humidity from AM2322 sensor.

Parameters
ctxClick object
humidity16-bit humidity data

The function reads the humidity data from the sensor AM2322 on the DHT22 2 Click.

Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The 16-bit humidity data should be divided by 10 to obtain the exact humidity value in percentage [ % ].

◆ dht222_get_temp_hum()

err_t dht222_get_temp_hum ( dht222_t * ctx,
uint16_t * temperature,
uint16_t * humidity )

Reads temperature and humidity from AM2322 sensor.

Parameters
ctxClick object
temperature16-bit temperature data
humidity16-bit humidity data

The function reads the temperature and humidity data from the sensor AM2322 on the DHT22 2 Click.

Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The 16-bit temperature and humidity data should be divided by 10 to obtain the exact values in degrees Celsius [ C ] and percentage [ % ].

◆ dht222_get_temperature()

err_t dht222_get_temperature ( dht222_t * ctx,
uint16_t * temperature )

Reads temperature from AM2322 sensor.

Parameters
ctxClick object
temperature16-bit temperature data

The function reads the temperature data from the sensor AM2322 on the DHT22 2 Click.

Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The 16-bit temperature data should be divided by 10 to obtain the exact temperature value in degrees Celsius [ C ].

◆ dht222_init()

err_t dht222_init ( dht222_t * ctx,
dht222_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object
cfgClick configuration structure.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
This function initializes all necessary pins and peripherals used for this click.

◆ dht222_read_reg()

err_t dht222_read_reg ( dht222_t * ctx,
uint8_t address,
uint8_t * data_out,
uint8_t len )

Generic read function.

Parameters
ctxClick object.
regRegister address.
data_outOutput data buf
lenNumber of the bytes to be read
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
This function reads data from the desired register.

◆ dht222_write_reg()

err_t dht222_write_reg ( dht222_t * ctx,
uint8_t address,
uint8_t * data_in,
uint8_t len )

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_inData buf to be written.
lenNumber of the bytes in data buf.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
This function writes data to the desired register.