dht22 2.0.0.0
DHT22 Click Driver

API for configuring and manipulating DHT22 Click driver. More...

Topics

 DHT22 MikroBUS Map
 MikroBUS pin mapping of DHT22 Click driver.
 
 DHT22 response status.
 Settings for response status of DHT22 Click driver.
 

Functions

void dht22_cfg_setup (dht22_cfg_t *cfg)
 DHT22 configuration object setup function.
 
err_t dht22_init (dht22_t *ctx, dht22_cfg_t *cfg)
 DHT22 initialization function.
 
err_t dht22_start_signal (dht22_t *ctx)
 DHT22 sends start signal to the sensor function.
 
err_t dht22_check_sensor_response (dht22_t *ctx)
 DHT22 release the bus to wait the sensor response signal function.
 
err_t dht22_get_sensor_data (dht22_t *ctx, uint16_t *hum_data, uint16_t *temp_data)
 DHT22 reading data from the sensor function.
 
err_t dht22_get_measurement_data (dht22_t *ctx, float *humidity, float *temperature)
 DHT22 get measurement data from the sensor function.
 
err_t dht22_init_sda_input (dht22_t *ctx)
 DHT22 init SDA data pin as input function.
 
err_t dht22_init_sda_output (dht22_t *ctx)
 DHT22 init SDA data pin as output function.
 

Detailed Description

API for configuring and manipulating DHT22 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ dht22_cfg_setup()

void dht22_cfg_setup ( dht22_cfg_t * cfg)

DHT22 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See dht22_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ dht22_check_sensor_response()

err_t dht22_check_sensor_response ( dht22_t * ctx)

DHT22 release the bus to wait the sensor response signal function.

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

Parameters
[in]ctx: Click context object. See dht22_t object definition for detailed explanation.
Returns
  • 0 - The sensor responded and is ready to read data,
  • -1 - ERROR, Sensor not responding.
Note
Before calling this function it is necessary to:
  • 1. : sends start signal to the sensor by calling dht22_start_signal function.
  • 2. : set the SDA pin as input.

◆ dht22_get_measurement_data()

err_t dht22_get_measurement_data ( dht22_t * ctx,
float * humidity,
float * temperature )

DHT22 get measurement data from the sensor function.

This function reading and calculate measurement data from the sensor AM2302 on the DHT22 Click.

Parameters
[in]ctx: Click context object. See dht22_t object definition for detailed explanation.
[out]humidityPercentage of relative humidity [% RH].
[out]temperatureTemperature value in degrees Celsius [degree Celsius].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dht22_get_sensor_data()

err_t dht22_get_sensor_data ( dht22_t * ctx,
uint16_t * hum_data,
uint16_t * temp_data )

DHT22 reading data from the sensor function.

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

Parameters
[in]ctx: Click context object. See dht22_t object definition for detailed explanation.
[out]hum_data16-bit read humidity data value from the sensor.
[out]temp_data16-bit read temperature data value from the sensor.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Before calling this function it is necessary to :
  • 1. : set the SDA pin as output.
  • 2. : sends start signal to the sensor by calling #dht22_start_ignal function.
  • 3. : set the SDA pin as input.
  • 4. : release the bus to wait the sensor response signal by calling dht22_check_sensor_response function.

◆ dht22_init()

err_t dht22_init ( dht22_t * ctx,
dht22_cfg_t * cfg )

DHT22 initialization function.

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

Parameters
[out]ctx: Click context object. See dht22_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See dht22_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dht22_init_sda_input()

err_t dht22_init_sda_input ( dht22_t * ctx)

DHT22 init SDA data pin as input function.

This functioninitializes SDA data pin as input of the sensor AM2302 on the DHT22 Click.

Parameters
[in]ctx: Click context object. See dht22_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dht22_init_sda_output()

err_t dht22_init_sda_output ( dht22_t * ctx)

DHT22 init SDA data pin as output function.

This functioninitializes SDA data pin as output of the sensor AM2302 on the DHT22 Click.

Parameters
[in]ctx: Click context object. See dht22_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dht22_start_signal()

err_t dht22_start_signal ( dht22_t * ctx)

DHT22 sends start signal to the sensor function.

This function sends the start signal to the tempemperature and humidity sensor AM2302 on DHT22 click board.

Parameters
[in]ctx: Click context object. See dht22_t object definition for detailed explanation.
Returns
Nothing.
Note
Before calling this function it is necessary to set the SDA pin as output.