co2 2.0.0.0
co2.h File Reference

This file contains API for CO2 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  co2_t
 CO2 Click context object. More...
 
struct  co2_cfg_t
 CO2 Click configuration object. More...
 

Macros

#define CO2_REG_DISABLE_CRC   0x3768
 CO2 description register.
 
#define CO2_REG_SET_BINARY_GAS   0x3615
 
#define CO2_REG_SET_RELATIVE_HUMIDITY   0x3624
 
#define CO2_REG_SET_TEMPERATURE   0x361E
 
#define CO2_REG_SET_PRESSURE   0x362F
 
#define CO2_REG_MEASURE_GAS_CONCENTRATION   0x3639
 
#define CO2_REG_FORCED_RECALIBRATION   0x3661
 
#define CO2_REG_ENABLE_AUTO_SELF_CALIB   0x3FEF
 
#define CO2_REG_DISABLE_AUTO_SELF_CALIB   0x3F6E
 
#define CO2_REG_PREPARE_READ_STATE   0x3752
 
#define CO2_REG_READ_STATE   0xE133
 
#define CO2_REG_WRITE_STATE   0xE133
 
#define CO2_REG_APPLY_STATE   0x3650
 
#define CO2_REG_SELF_TEST   0x365B
 
#define CO2_REG_RESET   0x0006
 
#define CO2_REG_ENTER_SLEEP_MODE   0x3677
 
#define CO2_SET_BINARY_GAS_IN_N2_100PCT   0x0000
 CO2 description setting.
 
#define CO2_SET_BINARY_GAS_IN_AIR_100PCT   0x0001
 
#define CO2_SET_BINARY_GAS_IN_N2_25PCT   0x0002
 
#define CO2_SET_BINARY_GAS_IN_AIR_25PCT   0x0003
 
#define CO2_DEVICE_ID   0x08010301
 
#define CO2_SET_DEV_ADDR_GND   0x29
 CO2 device address setting.
 
#define CO2_SET_DEV_ADDR_1KOHMS   0x2C
 
#define CO2_SET_DEV_ADDR_3p3KOHMS   0x2B
 
#define CO2_SET_DEV_ADDR_10KOHMS   0x2A
 
#define CO2_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  co2_return_value_t { CO2_OK = 0 , CO2_ERROR = -1 , CO2_ERROR_SELF_TEST = -2 , CO2_ERROR_CRC = -3 }
 CO2 Click return value data. More...
 

Functions

void co2_cfg_setup (co2_cfg_t *cfg)
 CO2 configuration object setup function.
 
err_t co2_init (co2_t *ctx, co2_cfg_t *cfg)
 CO2 initialization function.
 
err_t co2_default_cfg (co2_t *ctx)
 CO2 default configuration function.
 
err_t co2_generic_write (co2_t *ctx, uint16_t reg, uint16_t *tx_buf, uint8_t tx_len)
 CO2 I2C writing function.
 
err_t co2_generic_read (co2_t *ctx, uint16_t reg, uint16_t *rx_buf, uint8_t rx_len)
 CO2 I2C reading function.
 
err_t co2_reset (co2_t *ctx)
 Reset device.
 
err_t co2_get_id (co2_t *ctx)
 Read device and serial ID's.
 
err_t co2_set_reference (co2_t *ctx, uint16_t humidity, uint16_t pressure)
 Set device refrence values for gas calculation.
 
err_t co2_read_gas (co2_t *ctx, float *gas_concentration, float *temperature)
 Read CO2 concentration and temperature value.
 
err_t co2_disable_crc (co2_t *ctx)
 Disable use of CRC.
 

Detailed Description

This file contains API for CO2 Click Driver.

Enumeration Type Documentation

◆ co2_return_value_t

CO2 Click return value data.

Predefined enum values for driver return values.

Enumerator
CO2_OK 
CO2_ERROR 
CO2_ERROR_SELF_TEST 
CO2_ERROR_CRC