temphum20 2.0.0.0
temphum20.h File Reference

This file contains API for TempHum 20 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  temphum20_t
 TempHum 20 Click context object. More...
 
struct  temphum20_cfg_t
 TempHum 20 Click configuration object. More...
 

Macros

#define TEMPHUM20_REG_PDM_CLIP_HIGH   0x16
 TempHum 20 EEPROM Word Assignments.
 
#define TEMPHUM20_REG_PDM_CLIP_LOW   0x17
 
#define TEMPHUM20_REG_ALARM_HIGH_ON   0x18
 
#define TEMPHUM20_REG_ALARM_HIGH_OFF   0x19
 
#define TEMPHUM20_REG_ALARM_LOW_ON   0x1A
 
#define TEMPHUM20_REG_ALARM_LOW_OFF   0x1B
 
#define TEMPHUM20_REG_CUST_CONFIG   0x1C
 
#define TEMPHUM20_REG_RESERVED   0x1D
 
#define TEMPHUM20_REG_CUST_ID2   0x1E
 
#define TEMPHUM20_REG_CUST_ID3   0x1F
 
#define TEMPHUM20_CMD_START_NOM   0x80
 
#define TEMPHUM20_CMD_START_CM   0xA0
 
#define TEMPHUM20_DATA_RESOLUTION   0x4000
 TempHum 20 Temperature and Humidity calculation values.
 
#define TEMPHUM20_TEMP_MULTIPLIER   165.0
 
#define TEMPHUM20_HUM_MULTIPLIER   100.0
 
#define TEMPHUM20_TEMP_OFFSET   40.0
 
#define TEMPHUM20_STATUS_BITS_MASK   0xC0
 TempHum 20 Status bits values.
 
#define TEMPHUM20_STATUS_VALID_DATA   0x00
 
#define TEMPHUM20_STATUS_STALE_DATA   0x40
 
#define TEMPHUM20_STATUS_COMMAND_MODE   0x80
 
#define TEMPHUM20_OPMODE_COMMAND   0x00
 TempHum 20 operating mode values.
 
#define TEMPHUM20_OPMODE_NORMAL   0x01
 
#define TEMPHUM20_DUMMY   0x0000
 TempHum 20 dummy value.
 
#define TEMPHUM20_SET_DEV_ADDR   0x28
 TempHum 20 device address setting.
 
#define TEMPHUM20_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  temphum20_return_value_t { TEMPHUM20_OK = 0 , TEMPHUM20_ERROR = -1 }
 TempHum 20 Click return value data. More...
 

Functions

void temphum20_cfg_setup (temphum20_cfg_t *cfg)
 TempHum 20 configuration object setup function.
 
err_t temphum20_init (temphum20_t *ctx, temphum20_cfg_t *cfg)
 TempHum 20 initialization function.
 
err_t temphum20_default_cfg (temphum20_t *ctx)
 TempHum 20 default configuration function.
 
err_t temphum20_write_data (temphum20_t *ctx, uint8_t *tx_buf, uint8_t tx_len)
 TempHum 20 I2C writing function.
 
err_t temphum20_read_data (temphum20_t *ctx, uint8_t *rx_buf, uint8_t rx_len)
 TempHum 20 I2C reading function.
 
void temphum20_set_en_pin (temphum20_t *ctx, uint8_t state)
 TempHum 20 set EN pin function.
 
uint8_t temphum20_get_int_pin (temphum20_t *ctx)
 TempHum 20 get INT pin function.
 
uint8_t temphum20_get_alarm_high_pin (temphum20_t *ctx)
 TempHum 20 get alarm high pin function.
 
uint8_t temphum20_get_alarm_low_pin (temphum20_t *ctx)
 TempHum 20 get alarm low pin function.
 
void temphum20_reset_device (temphum20_t *ctx)
 TempHum 20 reset device function.
 
err_t temphum20_write_command (temphum20_t *ctx, uint8_t cmd_byte, uint16_t cmd_data)
 TempHum 20 write command function.
 
err_t temphum20_get_measurement (temphum20_t *ctx, float *temp, float *hum)
 TempHum 20 get measurement function.
 
err_t temphum20_set_operating_mode (temphum20_t *ctx, uint8_t op_mode)
 TempHum 20 set operating mode function.
 

Detailed Description

This file contains API for TempHum 20 Click Driver.

Enumeration Type Documentation

◆ temphum20_return_value_t

TempHum 20 Click return value data.

Predefined enum values for driver return values.

Enumerator
TEMPHUM20_OK 
TEMPHUM20_ERROR