dht222 2.0.0.0
dht222.h File Reference

This file contains API for DHT22 2 Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"

Go to the source code of this file.

Data Structures

struct  dht222_t
 Click ctx object definition. More...
 
struct  dht222_cfg_t
 Click configuration structure definition. More...
 

Macros

#define DHT222_MAP_MIKROBUS(cfg, mikrobus)
 
#define DHT222_OK   0
 
#define DHT222_ERROR   -1
 
#define DHT222_I2C_ADDRESS_WRITE   0xB8
 
#define DHT222_I2C_ADDRESS_READ   0xB9
 
#define DHT222_REG_HUMIDITY_MSB   0x00
 
#define DHT222_REG_HUMIDITY_LSB   0x01
 
#define DHT222_REG_TEMPERATURE_MSB   0x02
 
#define DHT222_REG_TEMPERATURE_LSB   0x03
 
#define DHT222_REG_MODEL_MSB   0x08
 
#define DHT222_REG_MODEL_LSB   0x09
 
#define DHT222_REG_VERSION   0x0A
 
#define DHT222_REG_DEVICE_ID_3   0x0B
 
#define DHT222_REG_DEVICE_ID_2   0x0C
 
#define DHT222_REG_DEVICE_ID_1   0x0D
 
#define DHT222_REG_DEVICE_ID_0   0x0E
 
#define DHT222_REG_STATE   0x0F
 
#define DHT222_REG_USER_REG_1_MSB   0x10
 
#define DHT222_REG_USER_REG_1_LSB   0x11
 
#define DHT222_REG_USER_REG_2_MSB   0x12
 
#define DHT222_REG_USER_REG_2_LSB   0x13
 
#define DHT222_CMD_READ   0x03
 
#define DHT222_CMD_WRITE   0x10
 
#define DHT222_TIMEOUT   100000ul
 

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

This file contains API for DHT22 2 Click driver.