sensor-xensiv-pasco2
XENSIV™ PAS CO2 sensor

General Description

Library which provides a platform-independent driver for the XENSIV™ PAS CO2 sensor.

It provides full access to all features of the sensor.

The library depends on the target platform-specific implementation of the following functions:

See the implementation example of these functions in xensiv_pasco2_mtb.c

Macros

#define XENSIV_PASCO2_OK   (0)
 Result code indicating a successful operation.
 
#define XENSIV_PASCO2_ERR_COMM   (1)
 Result code indicating a communication error.
 
#define XENSIV_PASCO2_ERR_WRITE_TOO_LARGE   (2)
 Result code indicating that an unexpectedly large I2C write was requested which is not supported.
 
#define XENSIV_PASCO2_ERR_NOT_READY   (3)
 Result code indicating that the sensor is not yet ready after reset.
 
#define XENSIV_PASCO2_ICCERR   (4)
 Result code indicating whether a non-valid command has been received by the serial communication interface.
 
#define XENSIV_PASCO2_ORVS   (5)
 Result code indicating whether a condition where VDD12V has been outside the specified valid range has been detected.
 
#define XENSIV_PASCO2_ORTMP   (6)
 Result code indicating whether a condition where the temperature has been outside the specified valid range has been detected.
 
#define XENSIV_PASCO2_READ_NRDY   (7)
 Result code indicating that a new CO2 value is not yet ready.
 
#define XENSIV_PASCO2_MEAS_RATE_MIN   (5U)
 Minimum allowed measurement rate.
 
#define XENSIV_PASCO2_MEAS_RATE_MAX   (4095U)
 Maximum allowed measurement rate.
 
#define XENSIV_PASCO2_I2C_ADDR   (0x28U)
 I2C address of the XENSIV™ PASCO2 sensor.
 
#define XENSIV_PASCO2_REG_PROD_ID   (0x00U)
 
#define XENSIV_PASCO2_REG_SENS_STS   (0x01U)
 
#define XENSIV_PASCO2_REG_MEAS_RATE_H   (0x02U)
 
#define XENSIV_PASCO2_REG_MEAS_RATE_L   (0x03U)
 
#define XENSIV_PASCO2_REG_MEAS_CFG   (0x04U)
 
#define XENSIV_PASCO2_REG_CO2PPM_H   (0x05U)
 
#define XENSIV_PASCO2_REG_CO2PPM_L   (0x06U)
 
#define XENSIV_PASCO2_REG_MEAS_STS   (0x07U)
 
#define XENSIV_PASCO2_REG_INT_CFG   (0x08U)
 
#define XENSIV_PASCO2_REG_ALARM_TH_H   (0x09U)
 
#define XENSIV_PASCO2_REG_ALARM_TH_L   (0x0aU)
 
#define XENSIV_PASCO2_REG_PRESS_REF_H   (0x0bU)
 
#define XENSIV_PASCO2_REG_PRESS_REF_L   (0x0cU)
 
#define XENSIV_PASCO2_REG_CALIB_REF_H   (0x0dU)
 
#define XENSIV_PASCO2_REG_CALIB_REF_L   (0x0eU)
 
#define XENSIV_PASCO2_REG_SCRATCH_PAD   (0x0fU)
 
#define XENSIV_PASCO2_REG_SENS_RST   (0x10U)
 
#define XENSIV_PASCO2_REG_PROD_ID_REV_POS   (0U)
 
#define XENSIV_PASCO2_REG_PROD_ID_REV_MSK   (0x1fU << XENSIV_PASCO2_REG_PROD_ID_REV_POS)
 
#define XENSIV_PASCO2_REG_PROD_ID_PROD_POS   (5U)
 
#define XENSIV_PASCO2_REG_PROD_ID_PROD_MSK   (0x07U << XENSIV_PASCO2_REG_PROD_ID_PROD_POS)
 
#define XENSIV_PASCO2_REG_SENS_STS_ICCER_CLR_POS   (0U)
 
#define XENSIV_PASCO2_REG_SENS_STS_ICCER_CLR_MSK   (0x01U << XENSIV_PASCO2_REG_SENS_STS_ICCER_CLR_POS)
 
#define XENSIV_PASCO2_REG_SENS_STS_ORVS_CLR_POS   (1U)
 
#define XENSIV_PASCO2_REG_SENS_STS_ORVS_CLR_MSK   (0x01U << XENSIV_PASCO2_REG_SENS_STS_ORVS_CLR_POS)
 
#define XENSIV_PASCO2_REG_SENS_STS_ORTMP_CLR_POS   (2U)
 
#define XENSIV_PASCO2_REG_SENS_STS_ORTMP_CLR_MSK   (0x01U << XENSIV_PASCO2_REG_SENS_STS_ORTMP_CLR_POS)
 
#define XENSIV_PASCO2_REG_SENS_STS_ICCER_POS   (3U)
 
#define XENSIV_PASCO2_REG_SENS_STS_ICCER_MSK   (0x01U << XENSIV_PASCO2_REG_SENS_STS_ICCER_POS)
 
#define XENSIV_PASCO2_REG_SENS_STS_ORVS_POS   (4U)
 
#define XENSIV_PASCO2_REG_SENS_STS_ORVS_MSK   (0x01U << XENSIV_PASCO2_REG_SENS_STS_ORVS_POS)
 
#define XENSIV_PASCO2_REG_SENS_STS_ORTMP_POS   (5U)
 
#define XENSIV_PASCO2_REG_SENS_STS_ORTMP_MSK   (0x01U << XENSIV_PASCO2_REG_SENS_STS_ORTMP_POS)
 
#define XENSIV_PASCO2_REG_SENS_STS_PWM_DIS_ST_POS   (6U)
 
#define XENSIV_PASCO2_REG_SENS_STS_PWM_DIS_ST_MSK   (0x01U << XENSIV_PASCO2_REG_SENS_STS_PWM_DIS_ST_POS)
 
#define XENSIV_PASCO2_REG_SENS_STS_SEN_RDY_POS   (7U)
 
#define XENSIV_PASCO2_REG_SENS_STS_SEN_RDY_MSK   (0x01U << XENSIV_PASCO2_REG_SENS_STS_SEN_RDY_POS)
 
#define XENSIV_PASCO2_REG_MEAS_RATE_H_VAL_POS   (0U)
 
#define XENSIV_PASCO2_REG_MEAS_RATE_H_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_MEAS_RATE_H_VAL_POS)
 
#define XENSIV_PASCO2_REG_MEAS_RATE_L_VAL_POS   (0U)
 
#define XENSIV_PASCO2_REG_MEAS_RATE_L_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_MEAS_RATE_L_VAL_POS)
 
#define XENSIV_PASCO2_REG_MEAS_CFG_OP_MODE_POS   (0U)
 
#define XENSIV_PASCO2_REG_MEAS_CFG_OP_MODE_MSK   (0x03U << XENSIV_PASCO2_REG_MEAS_CFG_OP_MODE_POS)
 
#define XENSIV_PASCO2_REG_MEAS_CFG_BOC_CFG_POS   (2U)
 
#define XENSIV_PASCO2_REG_MEAS_CFG_BOC_CFG_MSK   (0x03U << XENSIV_PASCO2_REG_MEAS_CFG_BOC_CFG_POS)
 
#define XENSIV_PASCO2_REG_MEAS_CFG_PWM_MODE_POS   (4U)
 
#define XENSIV_PASCO2_REG_MEAS_CFG_PWM_MODE_MSK   (0x01U << XENSIV_PASCO2_REG_MEAS_CFG_PWM_MODE_POS)
 
#define XENSIV_PASCO2_REG_MEAS_CFG_PWM_OUTEN_POS   (5U)
 
#define XENSIV_PASCO2_REG_MEAS_CFG_PWM_OUTEN_MSK   (0x01U << XENSIV_PASCO2_REG_MEAS_CFG_PWM_OUTEN_POS)
 
#define XENSIV_PASCO2_REG_CO2PPM_H_VAL_POS   (0U)
 
#define XENSIV_PASCO2_REG_CO2PPM_H_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_CO2PPM_H_VAL_POS)
 
#define XENSIV_PASCO2_REG_CO2PPM_L_VAL_POS   (0U)
 
#define XENSIV_PASCO2_REG_CO2PPM_L_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_CO2PPM_L_VAL_POS)
 
#define XENSIV_PASCO2_REG_MEAS_STS_ALARM_CLR_POS   (0U)
 
#define XENSIV_PASCO2_REG_MEAS_STS_ALARM_CLR_MSK   (0x01U << XENSIV_PASCO2_REG_MEAS_STS_ALARM_CLR_POS)
 
#define XENSIV_PASCO2_REG_MEAS_STS_INT_STS_CLR_POS   (1U)
 
#define XENSIV_PASCO2_REG_MEAS_STS_INT_STS_CLR_MSK   (0x01U << XENSIV_PASCO2_REG_MEAS_STS_INT_STS_CLR_POS)
 
#define XENSIV_PASCO2_REG_MEAS_STS_ALARM_POS   (2U)
 
#define XENSIV_PASCO2_REG_MEAS_STS_ALARM_MSK   (0x01U << XENSIV_PASCO2_REG_MEAS_STS_ALARM_POS)
 
#define XENSIV_PASCO2_REG_MEAS_STS_INT_STS_POS   (3U)
 
#define XENSIV_PASCO2_REG_MEAS_STS_INT_STS_MSK   (0x01U << XENSIV_PASCO2_REG_MEAS_STS_INT_STS_POS)
 
#define XENSIV_PASCO2_REG_MEAS_STS_DRDY_POS   (4U)
 
#define XENSIV_PASCO2_REG_MEAS_STS_DRDY_MSK   (0x01U << XENSIV_PASCO2_REG_MEAS_STS_DRDY_POS)
 
#define XENSIV_PASCO2_REG_INT_CFG_ALARM_TYP_POS   (0U)
 
#define XENSIV_PASCO2_REG_INT_CFG_ALARM_TYP_MSK   (0x01U << XENSIV_PASCO2_REG_INT_CFG_ALARM_TYP_POS)
 
#define XENSIV_PASCO2_REG_INT_CFG_INT_FUNC_POS   (1U)
 
#define XENSIV_PASCO2_REG_INT_CFG_INT_FUNC_MSK   (0x07U << XENSIV_PASCO2_REG_INT_CFG_INT_FUNC_POS)
 
#define XENSIV_PASCO2_REG_INT_CFG_INT_TYP_POS   (4U)
 
#define XENSIV_PASCO2_REG_INT_CFG_INT_TYP_MSK   (0x01U << XENSIV_PASCO2_REG_INT_CFG_INT_TYP_POS)
 
#define XENSIV_PASCO2_REG_ALARM_TH_H_VAL_POS   (0U)
 
#define XENSIV_PASCO2_REG_ALARM_TH_H_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_ALARM_TH_H_VAL_POS)
 
#define XENSIV_PASCO2_REG_ALARM_TH_L_VAL_POS   (0U)
 
#define XENSIV_PASCO2_REG_ALARM_TH_L_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_ALARM_TH_L_VAL_POS)
 
#define XENSIV_PASCO2_REG_PRESS_REF_H_VAL_POS   (0U)
 
#define XENSIV_PASCO2_REG_PRESS_REF_H_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_PRESS_REF_H_VAL_POS)
 
#define XENSIV_PASCO2_REG_PRESS_REF_L_VAL_POS   (0U)
 
#define XENSIV_PASCO2_REG_PRESS_REF_L_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_PRESS_REF_L_VAL_POS)
 
#define XENSIV_PASCO2_REG_CALIB_REF_H_VAL_POS   (0U)
 
#define XENSIV_PASCO2_REG_CALIB_REF_H_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_CALIB_REF_H_VAL_POS)
 
#define XENSIV_PASCO2_REG_CALIB_REF_L_VAL_POS   (0U)
 
#define XENSIV_PASCO2_REG_CALIB_REF_L_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_CALIB_REF_L_VAL_POS)
 
#define XENSIV_PASCO2_REG_SCRATCH_PAD_VAL_POS   (0U)
 
#define XENSIV_PASCO2_REG_SCRATCH_PAD_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_SCRATCH_PAD_VAL_POS)
 
#define XENSIV_PASCO2_REG_SENS_RST_SRTRG_POS   (0U)
 
#define XENSIV_PASCO2_REG_SENS_RST_SRTRG_MSK   (0xffU << XENSIV_PASCO2_REG_SENS_RST_SRTRG_POS)
 

Typedefs

typedef int32_t(* xensiv_pasco2_read_fptr_t) (const struct xensiv_pasco2_s *dev, uint8_t reg_addr, uint8_t *data, uint8_t len)
 
typedef int32_t(* xensiv_pasco2_write_fptr_t) (const struct xensiv_pasco2_s *dev, uint8_t reg_addr, const uint8_t *data, uint8_t len)
 

Enumerations

enum  xensiv_pasco2_cmd_t {
  XENSIV_PASCO2_CMD_SOFT_RESET = 0xA3U,
  XENSIV_PASCO2_CMD_RESET_ABOC = 0xBCU,
  XENSIV_PASCO2_CMD_SAVE_FCS_CALIB_OFFSET = 0xCFU,
  XENSIV_PASCO2_CMD_RESET_FCS = 0xFCU
}
 Enum defining the different device commands. More...
 
enum  xensiv_pasco2_op_mode_t {
  XENSIV_PASCO2_OP_MODE_IDLE = 0U,
  XENSIV_PASCO2_OP_MODE_SINGLE = 1U,
  XENSIV_PASCO2_OP_MODE_CONTINUOUS = 2U
}
 Enum defining the different device operating modes. More...
 
enum  xensiv_pasco2_boc_cfg_t {
  XENSIV_PASCO2_BOC_CFG_DISABLE = 0U,
  XENSIV_PASCO2_BOC_CFG_AUTOMATIC = 1U,
  XENSIV_PASCO2_BOC_CFG_FORCED = 2U
}
 Enum defining the different device baseline offset compensation (BOC) modes. More...
 
enum  xensiv_pasco2_pwm_mode_t {
  XENSIV_PASCO2_PWM_MODE_SINGLE_PULSE = 0U,
  XENSIV_PASCO2_PWM_MODE_TRAIN_PULSE = 1U
}
 Enum defining the PWM mode configuration. More...
 
enum  xensiv_pasco2_interrupt_type_t {
  XENSIV_PASCO2_INTERRUPT_TYPE_LOW_ACTIVE = 0U,
  XENSIV_PASCO2_INTERRUPT_TYPE_HIGH_ACTIVE = 1U
}
 Enum defining different interrupt active levels. More...
 
enum  xensiv_pasco2_interrupt_function_t {
  XENSIV_PASCO2_INTERRUPT_FUNCTION_NONE = 0U,
  XENSIV_PASCO2_INTERRUPT_FUNCTION_ALARM = 1U,
  XENSIV_PASCO2_INTERRUPT_FUNCTION_DRDY = 2U,
  XENSIV_PASCO2_INTERRUPT_FUNCTION_BUSY = 3U,
  XENSIV_PASCO2_INTERRUPT_FUNCTION_EARLY = 4U
}
 Enum defining different pin interrupt functions. More...
 
enum  xensiv_pasco2_alarm_type_t {
  XENSIV_PASCO2_ALARM_TYPE_HIGH_TO_LOW = 0U,
  XENSIV_PASCO2_ALARM_TYPE_LOW_TO_HIGH = 1U
}
 Enum defining whether an alarm is issued in the case of a lower or higher threshold violation. More...
 

Functions

int32_t xensiv_pasco2_init_i2c (xensiv_pasco2_t *dev, void *ctx)
 Initializes the XENSIV™ PAS CO2 device using the I2C interface. More...
 
int32_t xensiv_pasco2_init_uart (xensiv_pasco2_t *dev, void *ctx)
 Initializes the XENSIV™ PAS CO2 device using the UART interface. More...
 
int32_t xensiv_pasco2_set_reg (const xensiv_pasco2_t *dev, uint8_t reg_addr, const uint8_t *data, uint8_t len)
 Writes the given data buffer into the sensor device. More...
 
int32_t xensiv_pasco2_get_reg (const xensiv_pasco2_t *dev, uint8_t reg_addr, uint8_t *data, uint8_t len)
 Reads from the sensor device into the given data buffer. More...
 
int32_t xensiv_pasco2_get_id (const xensiv_pasco2_t *dev, xensiv_pasco2_id_t *id)
 Gets the sensor device product and version ID. More...
 
int32_t xensiv_pasco2_get_status (const xensiv_pasco2_t *dev, xensiv_pasco2_status_t *status)
 Gets the sensor device status. More...
 
int32_t xensiv_pasco2_clear_status (const xensiv_pasco2_t *dev, uint8_t mask)
 Clears the sensor device status bits. More...
 
int32_t xensiv_pasco2_get_interrupt_config (const xensiv_pasco2_t *dev, xensiv_pasco2_interrupt_config_t *int_config)
 Gets the sensor device interrupt configuration. More...
 
int32_t xensiv_pasco2_set_interrupt_config (const xensiv_pasco2_t *dev, xensiv_pasco2_interrupt_config_t int_config)
 Sets the sensor device interrupt configuration. More...
 
int32_t xensiv_pasco2_get_measurement_config (const xensiv_pasco2_t *dev, xensiv_pasco2_measurement_config_t *meas_config)
 Gets the sensor device measurement configuration. More...
 
int32_t xensiv_pasco2_set_measurement_config (const xensiv_pasco2_t *dev, xensiv_pasco2_measurement_config_t meas_config)
 Sets the sensor device measurement configuration. More...
 
int32_t xensiv_pasco2_get_result (const xensiv_pasco2_t *dev, uint16_t *val)
 Gets the current CO2 ppm values from the sensor device. More...
 
int32_t xensiv_pasco2_set_measurement_rate (const xensiv_pasco2_t *dev, uint16_t val)
 Sets the measurement rate for continuos mode. More...
 
int32_t xensiv_pasco2_get_measurement_status (const xensiv_pasco2_t *dev, xensiv_pasco2_meas_status_t *status)
 Gets the measurement status of the sensor device. More...
 
int32_t xensiv_pasco2_clear_measurement_status (const xensiv_pasco2_t *dev, uint8_t mask)
 Clears the measurement status of the sensor device. More...
 
int32_t xensiv_pasco2_set_alarm_threshold (const xensiv_pasco2_t *dev, uint16_t val)
 Sets the alarm threshold. More...
 
int32_t xensiv_pasco2_set_pressure_compensation (const xensiv_pasco2_t *dev, uint16_t val)
 Sets the pressure compensation value. More...
 
int32_t xensiv_pasco2_set_offset_compensation (const xensiv_pasco2_t *dev, uint16_t val)
 Sets the offset compensation value Defines the reference value used for ABOC and force calibration. More...
 
int32_t xensiv_pasco2_set_scratch_pad (const xensiv_pasco2_t *dev, uint8_t val)
 Writes to the scratchpad register. More...
 
int32_t xensiv_pasco2_get_scratch_pad (const xensiv_pasco2_t *dev, uint8_t *val)
 Reads from the scratchpad register. More...
 
int32_t xensiv_pasco2_cmd (const xensiv_pasco2_t *dev, xensiv_pasco2_cmd_t cmd)
 Triggers a sensor device command. More...
 
int32_t xensiv_pasco2_start_single_mode (const xensiv_pasco2_t *dev)
 Triggers a single mode measurement. More...
 
int32_t xensiv_pasco2_start_continuous_mode (const xensiv_pasco2_t *dev, uint16_t val)
 Starts measurements in continuous mode. More...
 
int32_t xensiv_pasco2_perform_forced_compensation (const xensiv_pasco2_t *dev, uint16_t co2_ref)
 Performs force compensation. More...
 

Macro Definition Documentation

◆ XENSIV_PASCO2_REG_PROD_ID

#define XENSIV_PASCO2_REG_PROD_ID   (0x00U)

REG_PROD: Address

◆ XENSIV_PASCO2_REG_SENS_STS

#define XENSIV_PASCO2_REG_SENS_STS   (0x01U)

SENS_STS: Address

◆ XENSIV_PASCO2_REG_MEAS_RATE_H

#define XENSIV_PASCO2_REG_MEAS_RATE_H   (0x02U)

MEAS_RATE_H: Address

◆ XENSIV_PASCO2_REG_MEAS_RATE_L

#define XENSIV_PASCO2_REG_MEAS_RATE_L   (0x03U)

MEAS_RATE_L: Address

◆ XENSIV_PASCO2_REG_MEAS_CFG

#define XENSIV_PASCO2_REG_MEAS_CFG   (0x04U)

MEAS_CFG: Address

◆ XENSIV_PASCO2_REG_CO2PPM_H

#define XENSIV_PASCO2_REG_CO2PPM_H   (0x05U)

CO2PPM_H: Address

◆ XENSIV_PASCO2_REG_CO2PPM_L

#define XENSIV_PASCO2_REG_CO2PPM_L   (0x06U)

CO2PPM_L: Address

◆ XENSIV_PASCO2_REG_MEAS_STS

#define XENSIV_PASCO2_REG_MEAS_STS   (0x07U)

MEAS_STS: Address

◆ XENSIV_PASCO2_REG_INT_CFG

#define XENSIV_PASCO2_REG_INT_CFG   (0x08U)

INT_CFG: Address

◆ XENSIV_PASCO2_REG_ALARM_TH_H

#define XENSIV_PASCO2_REG_ALARM_TH_H   (0x09U)

ALARM_TH_H: Address

◆ XENSIV_PASCO2_REG_ALARM_TH_L

#define XENSIV_PASCO2_REG_ALARM_TH_L   (0x0aU)

ALARM_TH_L: Address

◆ XENSIV_PASCO2_REG_PRESS_REF_H

#define XENSIV_PASCO2_REG_PRESS_REF_H   (0x0bU)

PRESS_REF_H: Address

◆ XENSIV_PASCO2_REG_PRESS_REF_L

#define XENSIV_PASCO2_REG_PRESS_REF_L   (0x0cU)

PRESS_REF_L: Address

◆ XENSIV_PASCO2_REG_CALIB_REF_H

#define XENSIV_PASCO2_REG_CALIB_REF_H   (0x0dU)

CALIB_REF_H: Address

◆ XENSIV_PASCO2_REG_CALIB_REF_L

#define XENSIV_PASCO2_REG_CALIB_REF_L   (0x0eU)

CALIB_REF_L: Address

◆ XENSIV_PASCO2_REG_SCRATCH_PAD

#define XENSIV_PASCO2_REG_SCRATCH_PAD   (0x0fU)

SCRATCH_PAD: Address

◆ XENSIV_PASCO2_REG_SENS_RST

#define XENSIV_PASCO2_REG_SENS_RST   (0x10U)

SENS_RST: Address

◆ XENSIV_PASCO2_REG_PROD_ID_REV_POS

#define XENSIV_PASCO2_REG_PROD_ID_REV_POS   (0U)

REG_PROD: ID_REV position

◆ XENSIV_PASCO2_REG_PROD_ID_REV_MSK

#define XENSIV_PASCO2_REG_PROD_ID_REV_MSK   (0x1fU << XENSIV_PASCO2_REG_PROD_ID_REV_POS)

REG_PROD: ID_REV mask

◆ XENSIV_PASCO2_REG_PROD_ID_PROD_POS

#define XENSIV_PASCO2_REG_PROD_ID_PROD_POS   (5U)

REG_PROD: ID_PROD position

◆ XENSIV_PASCO2_REG_PROD_ID_PROD_MSK

#define XENSIV_PASCO2_REG_PROD_ID_PROD_MSK   (0x07U << XENSIV_PASCO2_REG_PROD_ID_PROD_POS)

REG_PROD: ID_PROD mask

◆ XENSIV_PASCO2_REG_SENS_STS_ICCER_CLR_POS

#define XENSIV_PASCO2_REG_SENS_STS_ICCER_CLR_POS   (0U)

SENS_STS: ICCER_CLR position

◆ XENSIV_PASCO2_REG_SENS_STS_ICCER_CLR_MSK

#define XENSIV_PASCO2_REG_SENS_STS_ICCER_CLR_MSK   (0x01U << XENSIV_PASCO2_REG_SENS_STS_ICCER_CLR_POS)

SENS_STS: ICCER_CLR mask

◆ XENSIV_PASCO2_REG_SENS_STS_ORVS_CLR_POS

#define XENSIV_PASCO2_REG_SENS_STS_ORVS_CLR_POS   (1U)

SENS_STS: ORVS_CLR position

◆ XENSIV_PASCO2_REG_SENS_STS_ORVS_CLR_MSK

#define XENSIV_PASCO2_REG_SENS_STS_ORVS_CLR_MSK   (0x01U << XENSIV_PASCO2_REG_SENS_STS_ORVS_CLR_POS)

SENS_STS: ORVS_CLR mask

◆ XENSIV_PASCO2_REG_SENS_STS_ORTMP_CLR_POS

#define XENSIV_PASCO2_REG_SENS_STS_ORTMP_CLR_POS   (2U)

SENS_STS: ORTMP_CLR position

◆ XENSIV_PASCO2_REG_SENS_STS_ORTMP_CLR_MSK

#define XENSIV_PASCO2_REG_SENS_STS_ORTMP_CLR_MSK   (0x01U << XENSIV_PASCO2_REG_SENS_STS_ORTMP_CLR_POS)

SENS_STS: ORTMP_CLR mask

◆ XENSIV_PASCO2_REG_SENS_STS_ICCER_POS

#define XENSIV_PASCO2_REG_SENS_STS_ICCER_POS   (3U)

SENS_STS: ICCER position

◆ XENSIV_PASCO2_REG_SENS_STS_ICCER_MSK

#define XENSIV_PASCO2_REG_SENS_STS_ICCER_MSK   (0x01U << XENSIV_PASCO2_REG_SENS_STS_ICCER_POS)

SENS_STS: ICCER mask

◆ XENSIV_PASCO2_REG_SENS_STS_ORVS_POS

#define XENSIV_PASCO2_REG_SENS_STS_ORVS_POS   (4U)

SENS_STS: ORVS position

◆ XENSIV_PASCO2_REG_SENS_STS_ORVS_MSK

#define XENSIV_PASCO2_REG_SENS_STS_ORVS_MSK   (0x01U << XENSIV_PASCO2_REG_SENS_STS_ORVS_POS)

SENS_STS: ORVS mask

◆ XENSIV_PASCO2_REG_SENS_STS_ORTMP_POS

#define XENSIV_PASCO2_REG_SENS_STS_ORTMP_POS   (5U)

SENS_STS: ORTMP position

◆ XENSIV_PASCO2_REG_SENS_STS_ORTMP_MSK

#define XENSIV_PASCO2_REG_SENS_STS_ORTMP_MSK   (0x01U << XENSIV_PASCO2_REG_SENS_STS_ORTMP_POS)

SENS_STS: ORTMP mask

◆ XENSIV_PASCO2_REG_SENS_STS_PWM_DIS_ST_POS

#define XENSIV_PASCO2_REG_SENS_STS_PWM_DIS_ST_POS   (6U)

SENS_STS: PWM_DIS_ST position

◆ XENSIV_PASCO2_REG_SENS_STS_PWM_DIS_ST_MSK

#define XENSIV_PASCO2_REG_SENS_STS_PWM_DIS_ST_MSK   (0x01U << XENSIV_PASCO2_REG_SENS_STS_PWM_DIS_ST_POS)

SENS_STS: PWM_DIS_ST mask

◆ XENSIV_PASCO2_REG_SENS_STS_SEN_RDY_POS

#define XENSIV_PASCO2_REG_SENS_STS_SEN_RDY_POS   (7U)

SENS_STS: SEN_RDY position

◆ XENSIV_PASCO2_REG_SENS_STS_SEN_RDY_MSK

#define XENSIV_PASCO2_REG_SENS_STS_SEN_RDY_MSK   (0x01U << XENSIV_PASCO2_REG_SENS_STS_SEN_RDY_POS)

SENS_STS: SEN_RDY mask

◆ XENSIV_PASCO2_REG_MEAS_RATE_H_VAL_POS

#define XENSIV_PASCO2_REG_MEAS_RATE_H_VAL_POS   (0U)

MEAS_RATE_H: VAL position

◆ XENSIV_PASCO2_REG_MEAS_RATE_H_VAL_MSK

#define XENSIV_PASCO2_REG_MEAS_RATE_H_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_MEAS_RATE_H_VAL_POS)

MEAS_RATE_H: VAL mask

◆ XENSIV_PASCO2_REG_MEAS_RATE_L_VAL_POS

#define XENSIV_PASCO2_REG_MEAS_RATE_L_VAL_POS   (0U)

MEAS_RATE_L: VAL position

◆ XENSIV_PASCO2_REG_MEAS_RATE_L_VAL_MSK

#define XENSIV_PASCO2_REG_MEAS_RATE_L_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_MEAS_RATE_L_VAL_POS)

MEAS_RATE_L: VAL mask

◆ XENSIV_PASCO2_REG_MEAS_CFG_OP_MODE_POS

#define XENSIV_PASCO2_REG_MEAS_CFG_OP_MODE_POS   (0U)

MEAS_CFG: OP_MODE position

◆ XENSIV_PASCO2_REG_MEAS_CFG_OP_MODE_MSK

#define XENSIV_PASCO2_REG_MEAS_CFG_OP_MODE_MSK   (0x03U << XENSIV_PASCO2_REG_MEAS_CFG_OP_MODE_POS)

MEAS_CFG: OP_MODE mask

◆ XENSIV_PASCO2_REG_MEAS_CFG_BOC_CFG_POS

#define XENSIV_PASCO2_REG_MEAS_CFG_BOC_CFG_POS   (2U)

MEAS_CFG: BOC_CFG position

◆ XENSIV_PASCO2_REG_MEAS_CFG_BOC_CFG_MSK

#define XENSIV_PASCO2_REG_MEAS_CFG_BOC_CFG_MSK   (0x03U << XENSIV_PASCO2_REG_MEAS_CFG_BOC_CFG_POS)

MEAS_CFG: BOC_CFG mask

◆ XENSIV_PASCO2_REG_MEAS_CFG_PWM_MODE_POS

#define XENSIV_PASCO2_REG_MEAS_CFG_PWM_MODE_POS   (4U)

MEAS_CFG: PWM_MODE position

◆ XENSIV_PASCO2_REG_MEAS_CFG_PWM_MODE_MSK

#define XENSIV_PASCO2_REG_MEAS_CFG_PWM_MODE_MSK   (0x01U << XENSIV_PASCO2_REG_MEAS_CFG_PWM_MODE_POS)

MEAS_CFG: PWM_MODE mask

◆ XENSIV_PASCO2_REG_MEAS_CFG_PWM_OUTEN_POS

#define XENSIV_PASCO2_REG_MEAS_CFG_PWM_OUTEN_POS   (5U)

MEAS_CFG: PWM_OUTEN position

◆ XENSIV_PASCO2_REG_MEAS_CFG_PWM_OUTEN_MSK

#define XENSIV_PASCO2_REG_MEAS_CFG_PWM_OUTEN_MSK   (0x01U << XENSIV_PASCO2_REG_MEAS_CFG_PWM_OUTEN_POS)

MEAS_CFG: PWM_OUTEN mask

◆ XENSIV_PASCO2_REG_CO2PPM_H_VAL_POS

#define XENSIV_PASCO2_REG_CO2PPM_H_VAL_POS   (0U)

CO2PPM_H: VAL position

◆ XENSIV_PASCO2_REG_CO2PPM_H_VAL_MSK

#define XENSIV_PASCO2_REG_CO2PPM_H_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_CO2PPM_H_VAL_POS)

CO2PPM_H: VAL mask

◆ XENSIV_PASCO2_REG_CO2PPM_L_VAL_POS

#define XENSIV_PASCO2_REG_CO2PPM_L_VAL_POS   (0U)

CO2PPM_L: VAL position

◆ XENSIV_PASCO2_REG_CO2PPM_L_VAL_MSK

#define XENSIV_PASCO2_REG_CO2PPM_L_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_CO2PPM_L_VAL_POS)

CO2PPM_L: VAL mask

◆ XENSIV_PASCO2_REG_MEAS_STS_ALARM_CLR_POS

#define XENSIV_PASCO2_REG_MEAS_STS_ALARM_CLR_POS   (0U)

MEAS_STS: ALARM_CLR position

◆ XENSIV_PASCO2_REG_MEAS_STS_ALARM_CLR_MSK

#define XENSIV_PASCO2_REG_MEAS_STS_ALARM_CLR_MSK   (0x01U << XENSIV_PASCO2_REG_MEAS_STS_ALARM_CLR_POS)

MEAS_STS: ALARM_CLR mask

◆ XENSIV_PASCO2_REG_MEAS_STS_INT_STS_CLR_POS

#define XENSIV_PASCO2_REG_MEAS_STS_INT_STS_CLR_POS   (1U)

MEAS_STS: INT_STS_CLR position

◆ XENSIV_PASCO2_REG_MEAS_STS_INT_STS_CLR_MSK

#define XENSIV_PASCO2_REG_MEAS_STS_INT_STS_CLR_MSK   (0x01U << XENSIV_PASCO2_REG_MEAS_STS_INT_STS_CLR_POS)

MEAS_STS: INT_STS_CLR mask

◆ XENSIV_PASCO2_REG_MEAS_STS_ALARM_POS

#define XENSIV_PASCO2_REG_MEAS_STS_ALARM_POS   (2U)

MEAS_STS: ALARM position

◆ XENSIV_PASCO2_REG_MEAS_STS_ALARM_MSK

#define XENSIV_PASCO2_REG_MEAS_STS_ALARM_MSK   (0x01U << XENSIV_PASCO2_REG_MEAS_STS_ALARM_POS)

MEAS_STS: ALARM mask

◆ XENSIV_PASCO2_REG_MEAS_STS_INT_STS_POS

#define XENSIV_PASCO2_REG_MEAS_STS_INT_STS_POS   (3U)

MEAS_STS: INT_STS position

◆ XENSIV_PASCO2_REG_MEAS_STS_INT_STS_MSK

#define XENSIV_PASCO2_REG_MEAS_STS_INT_STS_MSK   (0x01U << XENSIV_PASCO2_REG_MEAS_STS_INT_STS_POS)

MEAS_STS: INT_STS mask

◆ XENSIV_PASCO2_REG_MEAS_STS_DRDY_POS

#define XENSIV_PASCO2_REG_MEAS_STS_DRDY_POS   (4U)

MEAS_STS: DRDY position

◆ XENSIV_PASCO2_REG_MEAS_STS_DRDY_MSK

#define XENSIV_PASCO2_REG_MEAS_STS_DRDY_MSK   (0x01U << XENSIV_PASCO2_REG_MEAS_STS_DRDY_POS)

MEAS_STS: DRDY mask

◆ XENSIV_PASCO2_REG_INT_CFG_ALARM_TYP_POS

#define XENSIV_PASCO2_REG_INT_CFG_ALARM_TYP_POS   (0U)

INT_CFG: ALARM_TYP position

◆ XENSIV_PASCO2_REG_INT_CFG_ALARM_TYP_MSK

#define XENSIV_PASCO2_REG_INT_CFG_ALARM_TYP_MSK   (0x01U << XENSIV_PASCO2_REG_INT_CFG_ALARM_TYP_POS)

INT_CFG: ALARM_TYP mask

◆ XENSIV_PASCO2_REG_INT_CFG_INT_FUNC_POS

#define XENSIV_PASCO2_REG_INT_CFG_INT_FUNC_POS   (1U)

INT_CFG: INT_FUNC position

◆ XENSIV_PASCO2_REG_INT_CFG_INT_FUNC_MSK

#define XENSIV_PASCO2_REG_INT_CFG_INT_FUNC_MSK   (0x07U << XENSIV_PASCO2_REG_INT_CFG_INT_FUNC_POS)

INT_CFG: INT_FUNC mask

◆ XENSIV_PASCO2_REG_INT_CFG_INT_TYP_POS

#define XENSIV_PASCO2_REG_INT_CFG_INT_TYP_POS   (4U)

INT_CFG: INT_TYP position

◆ XENSIV_PASCO2_REG_INT_CFG_INT_TYP_MSK

#define XENSIV_PASCO2_REG_INT_CFG_INT_TYP_MSK   (0x01U << XENSIV_PASCO2_REG_INT_CFG_INT_TYP_POS)

INT_CFG: INT_TYP mask

◆ XENSIV_PASCO2_REG_ALARM_TH_H_VAL_POS

#define XENSIV_PASCO2_REG_ALARM_TH_H_VAL_POS   (0U)

ALARM_TH_H: VAL position

◆ XENSIV_PASCO2_REG_ALARM_TH_H_VAL_MSK

#define XENSIV_PASCO2_REG_ALARM_TH_H_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_ALARM_TH_H_VAL_POS)

ALARM_TH_H: VAL mask

◆ XENSIV_PASCO2_REG_ALARM_TH_L_VAL_POS

#define XENSIV_PASCO2_REG_ALARM_TH_L_VAL_POS   (0U)

ALARM_TH_L: VAL position

◆ XENSIV_PASCO2_REG_ALARM_TH_L_VAL_MSK

#define XENSIV_PASCO2_REG_ALARM_TH_L_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_ALARM_TH_L_VAL_POS)

ALARM_TH_L: VAL mask

◆ XENSIV_PASCO2_REG_PRESS_REF_H_VAL_POS

#define XENSIV_PASCO2_REG_PRESS_REF_H_VAL_POS   (0U)

PRESS_REF_H: VAL position

◆ XENSIV_PASCO2_REG_PRESS_REF_H_VAL_MSK

#define XENSIV_PASCO2_REG_PRESS_REF_H_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_PRESS_REF_H_VAL_POS)

PRESS_REF_H: VAL mask

◆ XENSIV_PASCO2_REG_PRESS_REF_L_VAL_POS

#define XENSIV_PASCO2_REG_PRESS_REF_L_VAL_POS   (0U)

PRESS_REF_L: VAL position

◆ XENSIV_PASCO2_REG_PRESS_REF_L_VAL_MSK

#define XENSIV_PASCO2_REG_PRESS_REF_L_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_PRESS_REF_L_VAL_POS)

PRESS_REF_L: VAL mask

◆ XENSIV_PASCO2_REG_CALIB_REF_H_VAL_POS

#define XENSIV_PASCO2_REG_CALIB_REF_H_VAL_POS   (0U)

CALIB_REF_H: VAL position

◆ XENSIV_PASCO2_REG_CALIB_REF_H_VAL_MSK

#define XENSIV_PASCO2_REG_CALIB_REF_H_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_CALIB_REF_H_VAL_POS)

CALIB_REF_H: VAL mask

◆ XENSIV_PASCO2_REG_CALIB_REF_L_VAL_POS

#define XENSIV_PASCO2_REG_CALIB_REF_L_VAL_POS   (0U)

CALIB_REF_L: VAL position

◆ XENSIV_PASCO2_REG_CALIB_REF_L_VAL_MSK

#define XENSIV_PASCO2_REG_CALIB_REF_L_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_CALIB_REF_L_VAL_POS)

CALIB_REF_L: VAL mask

◆ XENSIV_PASCO2_REG_SCRATCH_PAD_VAL_POS

#define XENSIV_PASCO2_REG_SCRATCH_PAD_VAL_POS   (0U)

SCRATCH_PAD: VAL position

◆ XENSIV_PASCO2_REG_SCRATCH_PAD_VAL_MSK

#define XENSIV_PASCO2_REG_SCRATCH_PAD_VAL_MSK   (0xffU << XENSIV_PASCO2_REG_SCRATCH_PAD_VAL_POS)

SCRATCH_PAD: VAL mask

◆ XENSIV_PASCO2_REG_SENS_RST_SRTRG_POS

#define XENSIV_PASCO2_REG_SENS_RST_SRTRG_POS   (0U)

SENS_RST: SRTRG position

◆ XENSIV_PASCO2_REG_SENS_RST_SRTRG_MSK

#define XENSIV_PASCO2_REG_SENS_RST_SRTRG_MSK   (0xffU << XENSIV_PASCO2_REG_SENS_RST_SRTRG_POS)

SENS_RST: SRTRG mask

Enumeration Type Documentation

◆ xensiv_pasco2_cmd_t

Enum defining the different device commands.

Enumerator
XENSIV_PASCO2_CMD_SOFT_RESET 

Soft reset the sensor.

XENSIV_PASCO2_CMD_RESET_ABOC 

Resets the ABOC context.

XENSIV_PASCO2_CMD_SAVE_FCS_CALIB_OFFSET 

Saves the force calibration offset into the non volatile memory.

XENSIV_PASCO2_CMD_RESET_FCS 

Resets the forced calibration correction factor.

◆ xensiv_pasco2_op_mode_t

Enum defining the different device operating modes.

Enumerator
XENSIV_PASCO2_OP_MODE_IDLE 

The device does not perform any CO2 concentration measurement.

XENSIV_PASCO2_OP_MODE_SINGLE 

The device triggers a single measurement sequence.

At the end of the measurement sequence, the device automatically goes back to idle mode.

XENSIV_PASCO2_OP_MODE_CONTINUOUS 

The device periodically triggers a CO2 concentration measurement sequence.

Once a measurement sequence is completed, the device goes back to an inactive state and wakes up automatically for the next measurement sequence. The measurement period can be programmed from 5 seconds to 4095 seconds.

◆ xensiv_pasco2_boc_cfg_t

Enum defining the different device baseline offset compensation (BOC) modes.

Enumerator
XENSIV_PASCO2_BOC_CFG_DISABLE 

No offset compensation occurs.

XENSIV_PASCO2_BOC_CFG_AUTOMATIC 

The offset is periodically updated at each BOC computation.

XENSIV_PASCO2_BOC_CFG_FORCED 

Forced compensation.

◆ xensiv_pasco2_pwm_mode_t

Enum defining the PWM mode configuration.

Enumerator
XENSIV_PASCO2_PWM_MODE_SINGLE_PULSE 

PWM single-pulse.

XENSIV_PASCO2_PWM_MODE_TRAIN_PULSE 

PWM pulse-train mode.

◆ xensiv_pasco2_interrupt_type_t

Enum defining different interrupt active levels.

Enumerator
XENSIV_PASCO2_INTERRUPT_TYPE_LOW_ACTIVE 

Pin INT is configured as push-pull and is active LOW.

XENSIV_PASCO2_INTERRUPT_TYPE_HIGH_ACTIVE 

Pin INT is configured as push-pull and is active HIGH.

◆ xensiv_pasco2_interrupt_function_t

Enum defining different pin interrupt functions.

Enumerator
XENSIV_PASCO2_INTERRUPT_FUNCTION_NONE 

Pin INT is inactive.

XENSIV_PASCO2_INTERRUPT_FUNCTION_ALARM 

Pin INT is configured as the alarm threshold violation notification pin.

XENSIV_PASCO2_INTERRUPT_FUNCTION_DRDY 

Pin INT is configured as the data ready notification pin.

XENSIV_PASCO2_INTERRUPT_FUNCTION_BUSY 

Pin INT is configured as the sensor busy notification pin.

XENSIV_PASCO2_INTERRUPT_FUNCTION_EARLY 

Pin INT is configured as the early measurement start notification pin.

Note
This function is available only in continuous mode

◆ xensiv_pasco2_alarm_type_t

Enum defining whether an alarm is issued in the case of a lower or higher threshold violation.

Enumerator
XENSIV_PASCO2_ALARM_TYPE_HIGH_TO_LOW 

CO2 ppm value falling below the alarm threshold.

XENSIV_PASCO2_ALARM_TYPE_LOW_TO_HIGH 

CO2 ppm value rising above the alarm threshold.

Function Documentation

◆ xensiv_pasco2_init_i2c()

int32_t xensiv_pasco2_init_i2c ( xensiv_pasco2_t dev,
void *  ctx 
)

Initializes the XENSIV™ PAS CO2 device using the I2C interface.

It initializes the dev structure, verifies the integrity of the communication layer of the serial communication interface, and checks whether the sensor is ready

Parameters
[in,out]devPointer to a XENSIV™ PAS CO2 sensor device structure allocated by the user, but the init function will initialize its contents
[in]ctxPointer to the platform-specific I2C communication handler
Returns
XENSIV_PASCO2_OK if the initialization was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_init_uart()

int32_t xensiv_pasco2_init_uart ( xensiv_pasco2_t dev,
void *  ctx 
)

Initializes the XENSIV™ PAS CO2 device using the UART interface.

It initializes the dev structure, verifies the integrity of the communication layer of the serial communication interface, and checks whether the sensor is ready

Parameters
[in,out]devPointer to a XENSIV™ PAS CO2 sensor device structure allocated by user, but the init function will initialize its contents
[in]ctxPointer to the platform-specific I2C communication handler
Returns
XENSIV_PASCO2_OK if the initialization was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_set_reg()

int32_t xensiv_pasco2_set_reg ( const xensiv_pasco2_t dev,
uint8_t  reg_addr,
const uint8_t *  data,
uint8_t  len 
)

Writes the given data buffer into the sensor device.

Writes the given data buffer to the sensor register map starting at the register address

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[in]reg_addrStart register address
[in]dataPointer to the data buffer to be written in the sensor
[in]lenNumber of bytes of data to be written
Returns
XENSIV_PASCO2_OK if writing to the register was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_get_reg()

int32_t xensiv_pasco2_get_reg ( const xensiv_pasco2_t dev,
uint8_t  reg_addr,
uint8_t *  data,
uint8_t  len 
)

Reads from the sensor device into the given data buffer.

Reads from the sensor register map sensor starting at register address into the given data buffer

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[in]reg_addrStart register address
[out]dataPointer to the data buffer to store the register values of the sensor
[in]lenNumber of bytes of data to be read
Returns
XENSIV_PASCO2_OK if reading from the register was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_get_id()

int32_t xensiv_pasco2_get_id ( const xensiv_pasco2_t dev,
xensiv_pasco2_id_t id 
)

Gets the sensor device product and version ID.

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[out]idPointer to populate with the sensor device product and version ID
Note
: Refer to the register map description of the XENSIV™ PAS CO2 device for detailed information on the ID format
Returns
XENSIV_PASCO2_OK if reading the product id was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_get_status()

int32_t xensiv_pasco2_get_status ( const xensiv_pasco2_t dev,
xensiv_pasco2_status_t status 
)

Gets the sensor device status.

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[out]statusPointer to populate with the sensor device status
Returns
XENSIV_PASCO2_OK if reading the device status was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_clear_status()

int32_t xensiv_pasco2_clear_status ( const xensiv_pasco2_t dev,
uint8_t  mask 
)

Clears the sensor device status bits.

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[in]maskORed combination of the following values:
Returns
XENSIV_PASCO2_OK if the status bits clearing was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_get_interrupt_config()

int32_t xensiv_pasco2_get_interrupt_config ( const xensiv_pasco2_t dev,
xensiv_pasco2_interrupt_config_t int_config 
)

Gets the sensor device interrupt configuration.

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[out]int_configPointer to populate with the sensor device interrupt configuration
Returns
XENSIV_PASCO2_OK if getting the interrupt configuration was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_set_interrupt_config()

int32_t xensiv_pasco2_set_interrupt_config ( const xensiv_pasco2_t dev,
xensiv_pasco2_interrupt_config_t  int_config 
)

Sets the sensor device interrupt configuration.

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[in]int_configNew sensor device interrupt configuration to apply
Returns
XENSIV_PASCO2_OK if setting the interrupt configuration was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_get_measurement_config()

int32_t xensiv_pasco2_get_measurement_config ( const xensiv_pasco2_t dev,
xensiv_pasco2_measurement_config_t meas_config 
)

Gets the sensor device measurement configuration.

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[out]meas_configPointer to populate with the sensor device measurement configuration
Returns
XENSIV_PASCO2_OK if getting the measurement configuration was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_set_measurement_config()

int32_t xensiv_pasco2_set_measurement_config ( const xensiv_pasco2_t dev,
xensiv_pasco2_measurement_config_t  meas_config 
)

Sets the sensor device measurement configuration.

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[in]meas_configNew sensor device measurement configuration to apply
Returns
XENSIV_PASCO2_OK if setting the measurement configuration was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_get_result()

int32_t xensiv_pasco2_get_result ( const xensiv_pasco2_t dev,
uint16_t *  val 
)

Gets the current CO2 ppm values from the sensor device.

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[out]valPointer to populate with the CO2 ppm value
Returns
XENSIV_PASCO2_OK if obtaining the current CO2 value successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_set_measurement_rate()

int32_t xensiv_pasco2_set_measurement_rate ( const xensiv_pasco2_t dev,
uint16_t  val 
)

Sets the measurement rate for continuos mode.

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[in]valNew measurement rate to apply [5-4095s]
Returns
XENSIV_PASCO2_OK if setting the measurement rate was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_get_measurement_status()

int32_t xensiv_pasco2_get_measurement_status ( const xensiv_pasco2_t dev,
xensiv_pasco2_meas_status_t status 
)

Gets the measurement status of the sensor device.

Used to check if a new CO2 concentration value is available to be read (status.b.drdy) using xensiv_pasco2_get_result Used to check if an interrupt is asserted (status.b.int_sts). Used to check if an alarm is triggered (status.b.alarm)

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[out]statusPointer to populate with the sensor device measurement status
Returns
XENSIV_PASCO2_OK if getting the measurement was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_clear_measurement_status()

int32_t xensiv_pasco2_clear_measurement_status ( const xensiv_pasco2_t dev,
uint8_t  mask 
)

Clears the measurement status of the sensor device.

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[in]maskORed combination of the following values:
Returns
XENSIV_PASCO2_OK if clearing the measurement status selected bits was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_set_alarm_threshold()

int32_t xensiv_pasco2_set_alarm_threshold ( const xensiv_pasco2_t dev,
uint16_t  val 
)

Sets the alarm threshold.

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[in]valNew alarm threshold value to apply
Returns
XENSIV_PASCO2_OK if setting the alarm threshold was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_set_pressure_compensation()

int32_t xensiv_pasco2_set_pressure_compensation ( const xensiv_pasco2_t dev,
uint16_t  val 
)

Sets the pressure compensation value.

The CO2 concentration value acquired by the sensor is dependent on the external atmospheric pressure. To compensate for this effect, the application can provide the value of the atmospheric pressure using this function. At the end of a measurement sequence, the device reads the pressure value and applies it for compensation on the CO2 concentration value before storing it into the result registers, and can be retrieved using xensiv_pasco2_get_result

Parameters
[in]devPointer to a XENSIV™ PAS CO2 sensor device
[in]valNew pressure compensation value to apply
Returns
XENSIV_PASCO2_OK if setting the pressure reference value was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_set_offset_compensation()

int32_t xensiv_pasco2_set_offset_compensation ( const xensiv_pasco2_t dev,
uint16_t  val 
)

Sets the offset compensation value Defines the reference value used for ABOC and force calibration.

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[in]valNew pressure calibration value to apply
Returns
XENSIV_PASCO2_OK if setting the measurement offset was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_set_scratch_pad()

int32_t xensiv_pasco2_set_scratch_pad ( const xensiv_pasco2_t dev,
uint8_t  val 
)

Writes to the scratchpad register.

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[in]valNew scratchpad register value to apply
Returns
XENSIV_PASCO2_OK if writing to the scratch pad register was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_get_scratch_pad()

int32_t xensiv_pasco2_get_scratch_pad ( const xensiv_pasco2_t dev,
uint8_t *  val 
)

Reads from the scratchpad register.

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[out]valPointer to populate with the sensor device scratchpad register value
Returns
XENSIV_PASCO2_OK if reading from the scratch pad register was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_cmd()

int32_t xensiv_pasco2_cmd ( const xensiv_pasco2_t dev,
xensiv_pasco2_cmd_t  cmd 
)

Triggers a sensor device command.

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[in]cmdCommand to trigger
Returns
XENSIV_PASCO2_OK if triggering the command was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_start_single_mode()

int32_t xensiv_pasco2_start_single_mode ( const xensiv_pasco2_t dev)

Triggers a single mode measurement.

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
Returns
XENSIV_PASCO2_OK if starting the measurement was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_start_continuous_mode()

int32_t xensiv_pasco2_start_continuous_mode ( const xensiv_pasco2_t dev,
uint16_t  val 
)

Starts measurements in continuous mode.

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[in]valMeasurement rate to apply [5-4095s]
Returns
XENSIV_PASCO2_OK if starting the measurements was successful; an error indicating what went wrong otherwise

◆ xensiv_pasco2_perform_forced_compensation()

int32_t xensiv_pasco2_perform_forced_compensation ( const xensiv_pasco2_t dev,
uint16_t  co2_ref 
)

Performs force compensation.

Used to calculate the offset compensation when the sensor is exposed to a CO2 reference value. The device is left in idle mode and the new offset compensation value is stored in non-volatile memory.

Parameters
[in]devPointer to the XENSIV™ PAS CO2 sensor device
[in]co2_refCO2 reference value
Returns
XENSIV_PASCO2_OK if the force compensation was successful; an error indicating what went wrong otherwise