dht22  2.0.0.0
Functions
Public function

Functions

void dht22_cfg_setup (dht22_cfg_t *cfg)
 Config Object Initialization function. More...
 
DHT22_RETVAL dht22_init (dht22_t *ctx, dht22_cfg_t *cfg)
 Initialization function. More...
 
void dht22_start_signal (dht22_t *ctx)
 Sends start signal to the sensor function. More...
 
uint8_t dht22_check_sensor_response (dht22_t *ctx)
 Release the bus to wait the sensor response signal function. More...
 
uint32_t dht22_get_sensor_data (dht22_t *ctx)
 Reading data from the sensor function. More...
 
uint16_t dht22_calculate_temperature (dht22_t *ctx, uint32_t sensor_data)
 Calculate the temperature data function. More...
 
float dht22_calc_temp_c (dht22_t *ctx, uint32_t sensor_data)
 Calculate the temperature in degrees Celsius function. More...
 
uint16_t dht22_calculate_humidity (dht22_t *ctx, uint32_t sensor_data)
 Calculate the humidity data function. More...
 
float dht22_calc_humidity (dht22_t *ctx, uint32_t sensor_data)
 Calculate the humidity in percentage function. More...
 
void cs_input (dht22_t *ctx, dht22_cfg_t *cfg)
 Cs input. More...
 
void cs_output (dht22_t *ctx, dht22_cfg_t *cfg)
 Cs output. More...
 

Detailed Description

Function Documentation

◆ cs_input()

void cs_input ( dht22_t ctx,
dht22_cfg_t cfg 
)

Cs input.

Parameters
ctxClick object.
cfgClick configuration structure.

This function initializes cs on input.

◆ cs_output()

void cs_output ( dht22_t ctx,
dht22_cfg_t cfg 
)

Cs output.

Parameters
ctxClick object.
cfgClick configuration structure.

This function initializes cs on output.

◆ dht22_calc_humidity()

float dht22_calc_humidity ( dht22_t ctx,
uint32_t  sensor_data 
)

Calculate the humidity in percentage function.

Parameters
ctxClick object.
sensor_data32-bit read value from the sensor ( temperature and humidity data )
Returns
result float percentage of humidity [ % RH ]

The function calculate the percentage of humidity [ % RH ] from sensor data reading from the sensor AM2302 on the DHT22 Click.

◆ dht22_calc_temp_c()

float dht22_calc_temp_c ( dht22_t ctx,
uint32_t  sensor_data 
)

Calculate the temperature in degrees Celsius function.

Parameters
ctxClick object.
sensor_data32-bit read value from the sensor ( temperature and humidity data )
Returns
result float temperature in degrees Celsius [ C ]

The function calculate the temperature in degrees Celsius [ C ] from sensor data reading from the sensor AM2302 on the DHT22 Click.

◆ dht22_calculate_humidity()

uint16_t dht22_calculate_humidity ( dht22_t ctx,
uint32_t  sensor_data 
)

Calculate the humidity data function.

Parameters
ctxClick object.
sensor_data32-bit read value from the sensor ( temperature and humidity data )
Returns
result 16-bit humidity data

The function calculate the humidity data from sensor data reading from the sensor AM2302 on the DHT22 Click.

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

◆ dht22_calculate_temperature()

uint16_t dht22_calculate_temperature ( dht22_t ctx,
uint32_t  sensor_data 
)

Calculate the temperature data function.

Parameters
ctxClick object.
sensor_data32-bit read value from the sensor ( temperature and humidity data )
Returns
result 16-bit temperature data

The function calculate the temperature data from sensor data reading from the sensor AM2302 on the DHT22 Click.

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

◆ dht22_cfg_setup()

void dht22_cfg_setup ( dht22_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.

◆ dht22_check_sensor_response()

uint8_t dht22_check_sensor_response ( dht22_t ctx)

Release the bus to wait the sensor response signal function.

Parameters
ctxClick object.
Returns
result
  • 0 : ERROR, Sensor not responding.
  • 1 : The sensor responded and is ready to read data.

The function release the bus to wait the sensor response signal from the sensor AM2302 on the DHT22 Click.

Note
Before calling this function it is necessary to :
  • 1. : sends start signal to the sensor by calling dht22_startSignal() function.
  • 2. : set the CS pin as input.

◆ dht22_get_sensor_data()

uint32_t dht22_get_sensor_data ( dht22_t ctx)

Reading data from the sensor function.

Parameters
ctxClick object.
Returns
result 32-bit read value from the sensor ( temperature and humidity data )

The function reading data from the sensor AM2302 on the DHT22 Click.

Note
Before calling this function it is necessary to :
  • 1. : set the CS pin as output.
  • 2. : sends start signal to the sensor by calling dht22_startSignal() function.
  • 3. : set the CS pin as input.
  • 4. : release the bus to wait the sensor response signal by calling dht22_checkSensorResponse() function.

◆ dht22_init()

DHT22_RETVAL dht22_init ( dht22_t ctx,
dht22_cfg_t cfg 
)

Initialization function.

Parameters
dht22Click object.
cfgClick configuration structure.

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

◆ dht22_start_signal()

void dht22_start_signal ( dht22_t ctx)

Sends start signal to the sensor function.

Parameters
ctxClick object.

The function sends the start signal to the tempemperature and humidity sensor AM2302 on the DHT22 Click.

Note
Before calling this function it is necessary to set the CS pin as output.