temphum21 2.0.0.0
temphum21.h File Reference

This file contains API for TempHum 21 Click Driver. More...

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

Go to the source code of this file.

Data Structures

struct  temphum21_t
 TempHum 21 Click context object. More...
 
struct  temphum21_cfg_t
 TempHum 21 Click configuration object. More...
 

Macros

#define TEMPHUM21_REG_ALARM_HIGH_ON   0x18
 TempHum 21 register list.
 
#define TEMPHUM21_REG_ALARM_HIGH_OFF   0x19
 
#define TEMPHUM21_REG_ALARM_LOW_ON   0x1A
 
#define TEMPHUM21_REG_ALARM_LOW_OFF   0x1B
 
#define TEMPHUM21_REG_CUST_CONFIG   0x1C
 
#define TEMPHUM21_REG_CUST_ID2   0x1E
 
#define TEMPHUM21_REG_CUST_ID3   0x1F
 
#define TEMPHUM21_CMD_WRITE_EEPROM   0x40
 
#define TEMPHUM21_CMD_START_NOM   0x80
 
#define TEMPHUM21_CMD_START_CM   0xA0
 
#define TEMPHUM21_STATUS_NORMAL_OP   0x00
 TempHum 21 status/diagnostic/response bits.
 
#define TEMPHUM21_STATUS_STALE_DATA   0x40
 
#define TEMPHUM21_STATUS_COMMAND_MODE   0x80
 
#define TEMPHUM21_STATUS_BIT_MASK   0xC0
 
#define TEMPHUM21_DIAGNOSTIC_CORR_EP_ERR   0x04
 
#define TEMPHUM21_DIAGNOSTIC_UNCORR_EP_ERR   0x08
 
#define TEMPHUM21_DIAGNOSTIC_RAM_PAR_ERR   0x10
 
#define TEMPHUM21_DIAGNOSTIC_CONFIG_ERR   0x20
 
#define TEMPHUM21_DIAGNOSTIC_BIT_MASK   0x3C
 
#define TEMPHUM21_RESPONSE_BUSY   0x00
 
#define TEMPHUM21_RESPONSE_ACK   0x01
 
#define TEMPHUM21_RESPONSE_NACK   0x02
 
#define TEMPHUM21_RESPONSE_BIT_MASK   0x03
 
#define TEMPHUM21_DATA_RES   0x3FFF
 TempHum 21 measurement calculation values.
 
#define TEMPHUM21_TEMP_RES   165.0
 
#define TEMPHUM21_TEMP_OFFSET   40.0
 
#define TEMPHUM21_HUM_RES   100.0
 
#define TEMPHUM21_ALARM_HIGH_ON_80PCT   0x3333
 TempHum 21 alarm configuration values.
 
#define TEMPHUM21_ALARM_HIGH_OFF_75PCT   0x3000
 
#define TEMPHUM21_ALARM_LOW_ON_20PCT   0x0CCD
 
#define TEMPHUM21_ALARM_LOW_OFF_25PCT   0x1000
 
#define TEMPHUM21_SET_DEV_ADDR   0x27
 TempHum 21 device address setting.
 
#define TEMPHUM21_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  temphum21_return_value_t { TEMPHUM21_OK = 0 , TEMPHUM21_ERROR = -1 }
 TempHum 21 Click return value data. More...
 

Functions

void temphum21_cfg_setup (temphum21_cfg_t *cfg)
 TempHum 21 configuration object setup function.
 
err_t temphum21_init (temphum21_t *ctx, temphum21_cfg_t *cfg)
 TempHum 21 initialization function.
 
err_t temphum21_default_cfg (temphum21_t *ctx)
 TempHum 21 default configuration function.
 
err_t temphum21_request_measurement (temphum21_t *ctx)
 TempHum 21 request measurement function.
 
err_t temphum21_read_measurement (temphum21_t *ctx, float *temperature, float *humidity)
 TempHum 21 read measurement function.
 
uint8_t temphum21_get_all_pin (temphum21_t *ctx)
 TempHum 21 get all pin function.
 
uint8_t temphum21_get_alh_pin (temphum21_t *ctx)
 TempHum 21 get alh pin function.
 
void temphum21_enable_device (temphum21_t *ctx)
 TempHum 21 enable device function.
 
void temphum21_disable_device (temphum21_t *ctx)
 TempHum 21 disable device function.
 
err_t temphum21_enter_command_mode (temphum21_t *ctx)
 TempHum 21 enter command mode function.
 
err_t temphum21_exit_command_mode (temphum21_t *ctx)
 TempHum 21 exit command mode function.
 
err_t temphum21_eeprom_read (temphum21_t *ctx, uint8_t address, uint8_t *status, uint16_t *data_out)
 TempHum 21 eeprom read function.
 
err_t temphum21_eeprom_write (temphum21_t *ctx, uint8_t address, uint16_t data_in)
 TempHum 21 eeprom write function.
 

Detailed Description

This file contains API for TempHum 21 Click Driver.

Enumeration Type Documentation

◆ temphum21_return_value_t

TempHum 21 Click return value data.

Predefined enum values for driver return values.

Enumerator
TEMPHUM21_OK 
TEMPHUM21_ERROR