co23 2.1.0.0
co23.h File Reference

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

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

Go to the source code of this file.

Data Structures

struct  co23_s
 CO2 3 Click context object. More...
 
struct  co23_cfg_t
 CO2 3 Click configuration object. More...
 
struct  co23_sens_status_t
 CO2 3 Click sens status object. More...
 
struct  co23_meas_cfg_t
 CO2 3 Click measurement configuration object. More...
 
struct  co23_meas_status_t
 CO2 3 Click measurement status object. More...
 
struct  co23_int_cfg_t
 CO2 3 Click interrupt configuration object. More...
 

Macros

#define CO23_REG_PROD_ID   0x00
 CO2 3 description register.
 
#define CO23_REG_SENS_STS   0x01
 
#define CO23_REG_MEAS_RATE_H   0x02
 
#define CO23_REG_MEAS_RATE_L   0x03
 
#define CO23_REG_MEAS_CFG   0x04
 
#define CO23_REG_CO2PPM_H   0x05
 
#define CO23_REG_CO2PPM_L   0x06
 
#define CO23_REG_MEAS_STS   0x07
 
#define CO23_REG_INT_CFG   0x08
 
#define CO23_REG_ALARM_TH_H   0x09
 
#define CO23_REG_ALARM_TH_L   0x0A
 
#define CO23_REG_PRESS_REF_H   0x0B
 
#define CO23_REG_PRESS_REF_L   0x0C
 
#define CO23_REG_CALIB_REF_H   0x0D
 
#define CO23_REG_CALIB_REF_L   0x0E
 
#define CO23_REG_SCRATCH_PAD   0x0F
 
#define CO23_REG_SENS_RST   0x10
 
#define CO23_OP_MODE_IDLE   0x00
 CO2 3 description setting.
 
#define CO23_OP_MODE_SINGLE   0x01
 
#define CO23_OP_MODE_CONTINUOUS   0x02
 
#define CO23_OP_BOC_CFG_DISABLE   0x00
 
#define CO23_OP_BOC_CFG_AUTOMATIC   0x01
 
#define CO23_OP_BOC_CFG_FORCED   0x02
 
#define CO23_PWM_MODE_SINGLE_PULSE   0x00
 
#define CO23_PWM_MODE_TRAIN_PULSE   0x01
 
#define CO23_TX_DRV_BUFFER_SIZE   100
 CO2 3 driver buffer size.
 
#define CO23_RX_DRV_BUFFER_SIZE   300
 
#define CO23_DEVICE_ADDRESS   0x28
 CO2 3 device address setting.
 
#define CO23_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* co23_master_io_t) (struct co23_s *, uint8_t, uint8_t *, uint8_t)
 CO2 3 Click driver interface.
 
typedef struct co23_s co23_t
 CO2 3 Click context object.
 

Enumerations

enum  co23_drv_t { CO23_DRV_SEL_I2C , CO23_DRV_SEL_UART }
 CO2 3 Click driver selector. More...
 
enum  co23_soft_reset_value_t {
  CO23_CMD_SOFT_RESET = 0xA3 , CO23_CMD_RESET_ABOC = 0xBC , CO23_CMD_STEPWISE_FILTER_DIS = 0xDF , CO23_CMD_SAVE_FCS_CALIB_OFFSET = 0xCF ,
  CO23_CMD_RESET_FCS = 0xFC , CO23_CMD_STEPWISE_FILTER_EN = 0xFE
}
 CO2 3 Click soft reset command value data. More...
 
enum  co23_return_value_t { CO23_OK = 0 , CO23_ERROR = -1 }
 CO2 3 Click return value data. More...
 

Functions

void co23_cfg_setup (co23_cfg_t *cfg)
 CO2 3 configuration object setup function.
 
void co23_drv_interface_selection (co23_cfg_t *cfg, co23_drv_t drv_sel)
 CO2 3 driver interface setup function.
 
err_t co23_init (co23_t *ctx, co23_cfg_t *cfg)
 CO2 3 initialization function.
 
err_t co23_default_cfg (co23_t *ctx)
 CO2 3 default configuration function.
 
err_t co23_generic_write (co23_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 CO2 3 I2C writing function.
 
err_t co23_generic_read (co23_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 CO2 3 I2C reading function.
 
err_t co23_get_device_id (co23_t *ctx, uint8_t *prod, uint8_t *rev)
 CO2 3 get device ID function.
 
err_t co23_get_sens_status (co23_t *ctx, co23_sens_status_t *sens_status)
 CO2 3 get sensor status function.
 
err_t co23_set_meas_rate (co23_t *ctx, uint16_t meas_rate_sec)
 CO2 3 set measurement rate function.
 
err_t co23_get_meas_cfg (co23_t *ctx, co23_meas_cfg_t *meas_cfg)
 CO2 3 get measurement configuration function.
 
err_t co23_set_meas_cfg (co23_t *ctx, co23_meas_cfg_t meas_cfg)
 CO2 3 set measurement configuration function.
 
err_t co23_get_co2_ppm (co23_t *ctx, uint16_t *co2_ppm)
 CO2 3 get CO2 concentration function.
 
err_t co23_get_meas_status (co23_t *ctx, co23_meas_status_t *meas_status)
 CO2 3 get measurement status function.
 
err_t co23_get_int_cfg (co23_t *ctx, co23_int_cfg_t *int_cfg)
 CO2 3 get interrupt pin configuration function.
 
err_t co23_set_int_cfg (co23_t *ctx, co23_int_cfg_t int_cfg)
 CO2 3 set interrupt pin configuration function.
 
err_t co23_set_alarm_threshold (co23_t *ctx, uint16_t alarm_th_ppm)
 CO2 3 set alarm threshold function.
 
err_t co23_set_pressure_ref (co23_t *ctx, uint16_t pressure_mbar)
 CO2 3 set alarm threshold function.
 
err_t co23_set_calib_ref (co23_t *ctx, uint16_t calib_ppm)
 CO2 3 set calibration function.
 
err_t co23_soft_reset_trigger (co23_t *ctx, co23_soft_reset_value_t reset_cmd)
 CO2 3 soft reset trigger function.
 
uint8_t co23_get_pwo_pin (co23_t *ctx)
 CO2 3 get PWM output function.
 
uint8_t co23_get_int_pin (co23_t *ctx)
 CO2 3 get interrupt function.
 

Detailed Description

This file contains API for CO2 3 Click Driver.

Typedef Documentation

◆ co23_master_io_t

typedef err_t(* co23_master_io_t) (struct co23_s *, uint8_t, uint8_t *, uint8_t)

CO2 3 Click driver interface.

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

◆ co23_t

typedef struct co23_s co23_t

CO2 3 Click context object.

Context object definition of CO2 3 Click driver.

Enumeration Type Documentation

◆ co23_drv_t

enum co23_drv_t

CO2 3 Click driver selector.

Selects target driver interface of CO2 3 Click driver.

Enumerator
CO23_DRV_SEL_I2C 

I2C driver descriptor.

CO23_DRV_SEL_UART 

UART driver descriptor.

◆ co23_return_value_t

CO2 3 Click return value data.

Predefined enum values for driver return values.

Enumerator
CO23_OK 
CO23_ERROR 

◆ co23_soft_reset_value_t

CO2 3 Click soft reset command value data.

Predefined enum values for driver soft reset command values.

Enumerator
CO23_CMD_SOFT_RESET 
CO23_CMD_RESET_ABOC 
CO23_CMD_STEPWISE_FILTER_DIS 
CO23_CMD_SAVE_FCS_CALIB_OFFSET 
CO23_CMD_RESET_FCS 
CO23_CMD_STEPWISE_FILTER_EN