environment3 2.0.0.0
environment3.h File Reference

This file contains API for Environment 3 Click Driver. More...

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

Go to the source code of this file.

Data Structures

struct  environment3_field_data_t
 Environment 3 field data structure. More...
 
struct  environment3_calibration_data_t
 Environment 3 calibration data structure. More...
 
struct  environment3_tph_settings_t
 Environment 3 TPH settings structure. More...
 
struct  environment3_gas_settings_t
 Environment 3 gas settings structure. More...
 
struct  environment3_s
 Environment 3 Click context object. More...
 
struct  environment3_cfg_t
 Environment 3 Click configuration object. More...
 

Macros

#define ENVIRONMENT3_REG_STATUS   0x73
 Environment 3 memory map summary.
 
#define ENVIRONMENT3_REG_VARIANT_ID   0xF0
 
#define ENVIRONMENT3_REG_RESET   0xE0
 
#define ENVIRONMENT3_REG_CHIP_ID   0xD0
 
#define ENVIRONMENT3_REG_CONFIG   0x75
 
#define ENVIRONMENT3_REG_CTRL_MEAS   0x74
 
#define ENVIRONMENT3_REG_CTRL_HUM   0x72
 
#define ENVIRONMENT3_REG_CTRL_GAS_1   0x71
 
#define ENVIRONMENT3_REG_CTRL_GAS_0   0x70
 
#define ENVIRONMENT3_REG_GAS_WAIT_SHARED   0x6E
 
#define ENVIRONMENT3_REG_GAS_WAIT_0   0x64
 
#define ENVIRONMENT3_REG_RES_HEAT_0   0x5A
 
#define ENVIRONMENT3_REG_IDAC_HEAT_0   0x50
 
#define ENVIRONMENT3_REG_GAS_R_LSB_FIELD_2   0x4F
 
#define ENVIRONMENT3_REG_GAS_R_MSB_FIELD_2   0x4E
 
#define ENVIRONMENT3_REG_HUM_LSB_FIELD_2   0x48
 
#define ENVIRONMENT3_REG_HUM_MSB_FIELD_2   0x47
 
#define ENVIRONMENT3_REG_TEMP_XLSB_FIELD_2   0x46
 
#define ENVIRONMENT3_REG_TEMP_LSB_FIELD_2   0x45
 
#define ENVIRONMENT3_REG_TEMP_MSB_FIELD_2   0x44
 
#define ENVIRONMENT3_REG_PRESS_XLSB_FIELD_2   0x43
 
#define ENVIRONMENT3_REG_PRESS_LSB_FIELD_2   0x42
 
#define ENVIRONMENT3_REG_PRESS_MSB_FIELD_2   0x41
 
#define ENVIRONMENT3_REG_SUB_MEAS_INDEX_FIELD_2   0x40
 
#define ENVIRONMENT3_REG_MEAS_STATUS_FIELD_2   0x3F
 
#define ENVIRONMENT3_REG_GAS_R_LSB_FIELD_1   0x3E
 
#define ENVIRONMENT3_REG_GAS_R_MSB_FIELD_1   0x3D
 
#define ENVIRONMENT3_REG_HUM_LSB_FIELD_1   0x37
 
#define ENVIRONMENT3_REG_HUM_MSB_FIELD_1   0x36
 
#define ENVIRONMENT3_REG_TEMP_XLSB_FIELD_1   0x35
 
#define ENVIRONMENT3_REG_TEMP_LSB_FIELD_1   0x34
 
#define ENVIRONMENT3_REG_TEMP_MSB_FIELD_1   0x33
 
#define ENVIRONMENT3_REG_PRESS_XLSB_FIELD_1   0x32
 
#define ENVIRONMENT3_REG_PRESS_LSB_FIELD_1   0x31
 
#define ENVIRONMENT3_REG_PRESS_MSB_FIELD_1   0x30
 
#define ENVIRONMENT3_REG_SUB_MEAS_INDEX_FIELD_1   0x2F
 
#define ENVIRONMENT3_REG_MEAS_STATUS_FIELD_1   0x2E
 
#define ENVIRONMENT3_REG_GAS_R_LSB_FIELD_0   0x2D
 
#define ENVIRONMENT3_REG_GAS_R_MSB_FIELD_0   0x2C
 
#define ENVIRONMENT3_REG_HUM_LSB_FIELD_0   0x26
 
#define ENVIRONMENT3_REG_HUM_MSB_FIELD_0   0x25
 
#define ENVIRONMENT3_REG_TEMP_XLSB_FIELD_0   0x24
 
#define ENVIRONMENT3_REG_TEMP_LSB_FIELD_0   0x23
 
#define ENVIRONMENT3_REG_TEMP_MSB_FIELD_0   0x22
 
#define ENVIRONMENT3_REG_PRESS_XLSB_FIELD_0   0x21
 
#define ENVIRONMENT3_REG_PRESS_LSB_FIELD_0   0x20
 
#define ENVIRONMENT3_REG_PRESS_MSB_FIELD_0   0x1F
 
#define ENVIRONMENT3_REG_SUB_MEAS_INDEX_FIELD_0   0x1E
 
#define ENVIRONMENT3_REG_MEAS_STATUS_FIELD_0   0x1D
 
#define ENVIRONMENT3_REG_MEM_PAGE   0xF3
 
#define ENVIRONMENT3_REG_UNIQUE_ID   0x83
 
#define ENVIRONMENT3_REG_COEFF_1   0x8A
 
#define ENVIRONMENT3_REG_COEFF_2   0xE1
 
#define ENVIRONMENT3_REG_COEFF_3   0x00
 
#define ENVIRONMENT3_CHIP_ID   0x61
 Environment 3 chip ID.
 
#define ENVIRONMENT3_SOFT_RESET   0xB6
 Environment 3 reset settings.
 
#define ENVIRONMENT3_E_NULL_PTR   -2
 Environment 3 errors summary.
 
#define ENVIRONMENT3_E_COM_FAIL   -3
 
#define ENVIRONMENT3_E_INVALID_LENGTH   -4
 
#define ENVIRONMENT3_W_DEFINE_OP_MODE   1
 
#define ENVIRONMENT3_W_NO_NEW_DATA   2
 
#define ENVIRONMENT3_NBCONV_MASK   0x0F
 Environment 3 register mask summary.
 
#define ENVIRONMENT3_FILTER_MASK   0x1C
 
#define ENVIRONMENT3_ODR3_MASK   0x80
 
#define ENVIRONMENT3_ODR20_MASK   0xE0
 
#define ENVIRONMENT3_OST_MASK   0xE0
 
#define ENVIRONMENT3_OSP_MASK   0x1C
 
#define ENVIRONMENT3_OSH_MASK   0x07
 
#define ENVIRONMENT3_HCTRL_MASK   0x08
 
#define ENVIRONMENT3_RUN_GAS_MASK   0x30
 
#define ENVIRONMENT3_MODE_MASK   0x03
 
#define ENVIRONMENT3_RHRANGE_MASK   0x30
 
#define ENVIRONMENT3_RSERROR_MASK   0xF0
 
#define ENVIRONMENT3_NEW_DATA_MASK   0x80
 
#define ENVIRONMENT3_GAS_INDEX_MASK   0x0F
 
#define ENVIRONMENT3_GAS_RANGE_MASK   0x0F
 
#define ENVIRONMENT3_GASM_VALID_MASK   0x20
 
#define ENVIRONMENT3_HEAT_STAB_MASK   0x10
 
#define ENVIRONMENT3_MEM_PAGE_MASK   0x10
 
#define ENVIRONMENT3_BIT_H1_DATA_MASK   0x0F
 
#define ENVIRONMENT3_HUM_REG_SHIFT_VAL_MASK   0x04
 
#define ENVIRONMENT3_SPI_READ_MASK   0x80
 
#define ENVIRONMENT3_SPI_WRITE_MASK   0x7F
 
#define ENVIRONMENT3_FILTER_POS   2
 Environment 3 register bit position summary.
 
#define ENVIRONMENT3_OST_POS   5
 
#define ENVIRONMENT3_OSP_POS   2
 
#define ENVIRONMENT3_ODR3_POS   7
 
#define ENVIRONMENT3_ODR20_POS   5
 
#define ENVIRONMENT3_RUN_GAS_POS   4
 
#define ENVIRONMENT3_HCTRL_POS   3
 
#define ENVIRONMENT3_ENABLE   0x01
 Environment 3 enable/disable macros.
 
#define ENVIRONMENT3_DISABLE   0x00
 
#define ENVIRONMENT3_ENABLE_HEATER   0x00
 
#define ENVIRONMENT3_DISABLE_HEATER   0x01
 
#define ENVIRONMENT3_ENABLE_GAS_MEAS_H   0x02
 
#define ENVIRONMENT3_ENABLE_GAS_MEAS_L   0x01
 
#define ENVIRONMENT3_DISABLE_GAS_MEAS   0x00
 
#define ENVIRONMENT3_VARIANT_GAS_LOW   0x00
 Environment 3 variant ID macros.
 
#define ENVIRONMENT3_VARIANT_GAS_HIGH   0x01
 
#define ENVIRONMENT3_OS_NONE   0
 Environment 3 oversampling setting macros.
 
#define ENVIRONMENT3_OS_1X   1
 
#define ENVIRONMENT3_OS_2X   2
 
#define ENVIRONMENT3_OS_4X   3
 
#define ENVIRONMENT3_OS_8X   4
 
#define ENVIRONMENT3_OS_16X   5
 
#define ENVIRONMENT3_FILTER_OFF   0
 Environment 3 IIR Filter settings.
 
#define ENVIRONMENT3_FILTER_SIZE_1   1
 
#define ENVIRONMENT3_FILTER_SIZE_3   2
 
#define ENVIRONMENT3_FILTER_SIZE_7   3
 
#define ENVIRONMENT3_FILTER_SIZE_15   4
 
#define ENVIRONMENT3_FILTER_SIZE_31   5
 
#define ENVIRONMENT3_FILTER_SIZE_63   6
 
#define ENVIRONMENT3_FILTER_SIZE_127   7
 
#define ENVIRONMENT3_ODR_0_59_MS   0
 Environment 3 ODR/Standby time macros.
 
#define ENVIRONMENT3_ODR_62_5_MS   1
 
#define ENVIRONMENT3_ODR_125_MS   2
 
#define ENVIRONMENT3_ODR_250_MS   3
 
#define ENVIRONMENT3_ODR_500_MS   4
 
#define ENVIRONMENT3_ODR_1000_MS   5
 
#define ENVIRONMENT3_ODR_10_MS   6
 
#define ENVIRONMENT3_ODR_20_MS   7
 
#define ENVIRONMENT3_ODR_NONE   8
 
#define ENVIRONMENT3_MODE_SLEEP   0
 Environment 3 operating mode selection settings.
 
#define ENVIRONMENT3_MODE_FORCED   1
 
#define ENVIRONMENT3_MEM_PAGE_0   0x10
 Environment 3 SPI page settings.
 
#define ENVIRONMENT3_MEM_PAGE_1   0x00
 
#define ENVIRONMENT3_LEN_COEFF_ALL   42
 Environment 3 buffer length macros.
 
#define ENVIRONMENT3_LEN_COEFF_1   23
 
#define ENVIRONMENT3_LEN_COEFF_2   14
 
#define ENVIRONMENT3_LEN_COEFF_3   5
 
#define ENVIRONMENT3_LEN_FIELD   17
 
#define ENVIRONMENT3_LEN_CONFIG   5
 
#define ENVIRONMENT3_LEN_INTERLEAVE_BUFF   20
 
#define ENVIRONMENT3_IDX_T2_LSB   0
 Environment 3 coefficient index macros.
 
#define ENVIRONMENT3_IDX_T2_MSB   1
 
#define ENVIRONMENT3_IDX_T3   2
 
#define ENVIRONMENT3_IDX_P1_LSB   4
 
#define ENVIRONMENT3_IDX_P1_MSB   5
 
#define ENVIRONMENT3_IDX_P2_LSB   6
 
#define ENVIRONMENT3_IDX_P2_MSB   7
 
#define ENVIRONMENT3_IDX_P3   8
 
#define ENVIRONMENT3_IDX_P4_LSB   10
 
#define ENVIRONMENT3_IDX_P4_MSB   11
 
#define ENVIRONMENT3_IDX_P5_LSB   12
 
#define ENVIRONMENT3_IDX_P5_MSB   13
 
#define ENVIRONMENT3_IDX_P7   14
 
#define ENVIRONMENT3_IDX_P6   15
 
#define ENVIRONMENT3_IDX_P8_LSB   18
 
#define ENVIRONMENT3_IDX_P8_MSB   19
 
#define ENVIRONMENT3_IDX_P9_LSB   20
 
#define ENVIRONMENT3_IDX_P9_MSB   21
 
#define ENVIRONMENT3_IDX_P10   22
 
#define ENVIRONMENT3_IDX_H2_MSB   23
 
#define ENVIRONMENT3_IDX_H2_LSB   24
 
#define ENVIRONMENT3_IDX_H1_LSB   24
 
#define ENVIRONMENT3_IDX_H1_MSB   25
 
#define ENVIRONMENT3_IDX_H3   26
 
#define ENVIRONMENT3_IDX_H4   27
 
#define ENVIRONMENT3_IDX_H5   28
 
#define ENVIRONMENT3_IDX_H6   29
 
#define ENVIRONMENT3_IDX_H7   30
 
#define ENVIRONMENT3_IDX_T1_LSB   31
 
#define ENVIRONMENT3_IDX_T1_MSB   32
 
#define ENVIRONMENT3_IDX_GH2_LSB   33
 
#define ENVIRONMENT3_IDX_GH2_MSB   34
 
#define ENVIRONMENT3_IDX_GH1   35
 
#define ENVIRONMENT3_IDX_GH3   36
 
#define ENVIRONMENT3_IDX_RES_HEAT_VAL   37
 
#define ENVIRONMENT3_IDX_RES_HEAT_RANGE   39
 
#define ENVIRONMENT3_IDX_RANGE_SW_ERR   41
 
#define ENVIRONMENT3_DEVICE_SLAVE_ADDR_0   0x76
 Environment 3 device address setting.
 
#define ENVIRONMENT3_DEVICE_SLAVE_ADDR_1   0x77
 
#define ENVIRONMENT3_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* environment3_master_io_t) (struct environment3_s *, uint8_t, uint8_t *, uint8_t)
 Environment 3 Click driver interface.
 
typedef struct environment3_s environment3_t
 Environment 3 Click context object.
 

Enumerations

enum  environment3_drv_t { ENVIRONMENT3_DRV_SEL_SPI , ENVIRONMENT3_DRV_SEL_I2C }
 Environment 3 Click driver selector. More...
 
enum  environment3_return_value_t { ENVIRONMENT3_OK = 0 , ENVIRONMENT3_ERROR = -1 }
 Environment 3 Click return value data. More...
 

Functions

void environment3_cfg_setup (environment3_cfg_t *cfg)
 Environment 3 configuration object setup function.
 
void environment3_drv_interface_selection (environment3_cfg_t *cfg, environment3_drv_t drv_sel)
 Environment 3 driver interface setup function.
 
err_t environment3_init (environment3_t *ctx, environment3_cfg_t *cfg)
 Environment 3 initialization function.
 
err_t environment3_default_cfg (environment3_t *ctx)
 Environment 3 default configuration function.
 
err_t environment3_generic_write (environment3_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Environment 3 data writing function.
 
err_t environment3_generic_read (environment3_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Environment 3 data reading function.
 
err_t environment3_write_byte (environment3_t *ctx, uint8_t reg, uint8_t data_in)
 Environment 3 single data writing function.
 
uint8_t environment3_read_byte (environment3_t *ctx, uint8_t reg)
 Environment 3 single data reading function.
 
int8_t environment3_check_id (environment3_t *ctx)
 Environment 3 check device ID function.
 
uint8_t environment3_get_device_id (environment3_t *ctx)
 Environment 3 get device ID function.
 
int8_t environment3_soft_reset (environment3_t *ctx)
 Environment 3 soft reset function.
 
int8_t environment3_get_all_data (environment3_t *ctx, float *temp, float *hum, float *pres, uint32_t *gas)
 Environment 3 get all data function.
 
float environment3_get_temperature (environment3_t *ctx)
 Environment 3 get temperature data function.
 
float environment3_get_humidity (environment3_t *ctx)
 Environment 3 get humidity data function.
 
float environment3_get_pressure (environment3_t *ctx)
 Environment 3 get pressure data function.
 
float environment3_get_gas_resistance (environment3_t *ctx)
 Environment 3 get gas resistance data function.
 
int8_t environment3_get_regs (environment3_t *ctx, uint8_t reg, uint8_t *data_out, uint16_t len)
 Environment 3 read data from register address function.
 
int8_t environment3_set_regs (environment3_t *ctx, uint8_t *reg, uint8_t *data_in, uint8_t len)
 Environment 3 write data to registers function.
 
int8_t environment3_enable_heater (environment3_t *ctx, uint8_t state)
 Environment 3 enable heater function.
 
int8_t environment3_set_heater_conf (environment3_t *ctx, environment3_gas_settings_t *conf)
 Environment 3 set heater configuration function.
 
int8_t environment3_set_sensor_conf (environment3_t *ctx, environment3_tph_settings_t *conf)
 Environment 3 set sensor configuration function.
 
int8_t environment3_set_operating_mode (environment3_t *ctx, uint8_t op_mode)
 Environment 3 set operating mode function.
 
int8_t environment3_get_operating_mode (environment3_t *ctx)
 Environment 3 get operating mode function.
 

Detailed Description

This file contains API for Environment 3 Click Driver.

Typedef Documentation

◆ environment3_master_io_t

typedef err_t(* environment3_master_io_t) (struct environment3_s *, uint8_t, uint8_t *, uint8_t)

Environment 3 Click driver interface.

Definition of driver interface of Environment 3 Click driver. Driver serial interface.

◆ environment3_t

Environment 3 Click context object.

Context object definition of Environment 3 Click driver.

Enumeration Type Documentation

◆ environment3_drv_t

Environment 3 Click driver selector.

Selects target driver interface of Environment 3 Click driver.

Enumerator
ENVIRONMENT3_DRV_SEL_SPI 

SPI driver descriptor.

ENVIRONMENT3_DRV_SEL_I2C 

I2C driver descriptor.

◆ environment3_return_value_t

Environment 3 Click return value data.

Predefined enum values for driver return values.

Enumerator
ENVIRONMENT3_OK 
ENVIRONMENT3_ERROR