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
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... | |
#define XENSIV_PASCO2_REG_PROD_ID (0x00U) |
REG_PROD: Address
#define XENSIV_PASCO2_REG_SENS_STS (0x01U) |
SENS_STS: Address
#define XENSIV_PASCO2_REG_MEAS_RATE_H (0x02U) |
MEAS_RATE_H: Address
#define XENSIV_PASCO2_REG_MEAS_RATE_L (0x03U) |
MEAS_RATE_L: Address
#define XENSIV_PASCO2_REG_MEAS_CFG (0x04U) |
MEAS_CFG: Address
#define XENSIV_PASCO2_REG_CO2PPM_H (0x05U) |
CO2PPM_H: Address
#define XENSIV_PASCO2_REG_CO2PPM_L (0x06U) |
CO2PPM_L: Address
#define XENSIV_PASCO2_REG_MEAS_STS (0x07U) |
MEAS_STS: Address
#define XENSIV_PASCO2_REG_INT_CFG (0x08U) |
INT_CFG: Address
#define XENSIV_PASCO2_REG_ALARM_TH_H (0x09U) |
ALARM_TH_H: Address
#define XENSIV_PASCO2_REG_ALARM_TH_L (0x0aU) |
ALARM_TH_L: Address
#define XENSIV_PASCO2_REG_PRESS_REF_H (0x0bU) |
PRESS_REF_H: Address
#define XENSIV_PASCO2_REG_PRESS_REF_L (0x0cU) |
PRESS_REF_L: Address
#define XENSIV_PASCO2_REG_CALIB_REF_H (0x0dU) |
CALIB_REF_H: Address
#define XENSIV_PASCO2_REG_CALIB_REF_L (0x0eU) |
CALIB_REF_L: Address
#define XENSIV_PASCO2_REG_SCRATCH_PAD (0x0fU) |
SCRATCH_PAD: Address
#define XENSIV_PASCO2_REG_SENS_RST (0x10U) |
SENS_RST: Address
#define XENSIV_PASCO2_REG_PROD_ID_REV_POS (0U) |
REG_PROD: ID_REV position
#define XENSIV_PASCO2_REG_PROD_ID_REV_MSK (0x1fU << XENSIV_PASCO2_REG_PROD_ID_REV_POS) |
REG_PROD: ID_REV mask
#define XENSIV_PASCO2_REG_PROD_ID_PROD_POS (5U) |
REG_PROD: ID_PROD position
#define XENSIV_PASCO2_REG_PROD_ID_PROD_MSK (0x07U << XENSIV_PASCO2_REG_PROD_ID_PROD_POS) |
REG_PROD: ID_PROD mask
#define XENSIV_PASCO2_REG_SENS_STS_ICCER_CLR_POS (0U) |
SENS_STS: ICCER_CLR position
#define XENSIV_PASCO2_REG_SENS_STS_ICCER_CLR_MSK (0x01U << XENSIV_PASCO2_REG_SENS_STS_ICCER_CLR_POS) |
SENS_STS: ICCER_CLR mask
#define XENSIV_PASCO2_REG_SENS_STS_ORVS_CLR_POS (1U) |
SENS_STS: ORVS_CLR position
#define XENSIV_PASCO2_REG_SENS_STS_ORVS_CLR_MSK (0x01U << XENSIV_PASCO2_REG_SENS_STS_ORVS_CLR_POS) |
SENS_STS: ORVS_CLR mask
#define XENSIV_PASCO2_REG_SENS_STS_ORTMP_CLR_POS (2U) |
SENS_STS: ORTMP_CLR position
#define XENSIV_PASCO2_REG_SENS_STS_ORTMP_CLR_MSK (0x01U << XENSIV_PASCO2_REG_SENS_STS_ORTMP_CLR_POS) |
SENS_STS: ORTMP_CLR mask
#define XENSIV_PASCO2_REG_SENS_STS_ICCER_POS (3U) |
SENS_STS: ICCER position
#define XENSIV_PASCO2_REG_SENS_STS_ICCER_MSK (0x01U << XENSIV_PASCO2_REG_SENS_STS_ICCER_POS) |
SENS_STS: ICCER mask
#define XENSIV_PASCO2_REG_SENS_STS_ORVS_POS (4U) |
SENS_STS: ORVS position
#define XENSIV_PASCO2_REG_SENS_STS_ORVS_MSK (0x01U << XENSIV_PASCO2_REG_SENS_STS_ORVS_POS) |
SENS_STS: ORVS mask
#define XENSIV_PASCO2_REG_SENS_STS_ORTMP_POS (5U) |
SENS_STS: ORTMP position
#define XENSIV_PASCO2_REG_SENS_STS_ORTMP_MSK (0x01U << XENSIV_PASCO2_REG_SENS_STS_ORTMP_POS) |
SENS_STS: ORTMP mask
#define XENSIV_PASCO2_REG_SENS_STS_PWM_DIS_ST_POS (6U) |
SENS_STS: PWM_DIS_ST position
#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
#define XENSIV_PASCO2_REG_SENS_STS_SEN_RDY_POS (7U) |
SENS_STS: SEN_RDY position
#define XENSIV_PASCO2_REG_SENS_STS_SEN_RDY_MSK (0x01U << XENSIV_PASCO2_REG_SENS_STS_SEN_RDY_POS) |
SENS_STS: SEN_RDY mask
#define XENSIV_PASCO2_REG_MEAS_RATE_H_VAL_POS (0U) |
MEAS_RATE_H: VAL position
#define XENSIV_PASCO2_REG_MEAS_RATE_H_VAL_MSK (0xffU << XENSIV_PASCO2_REG_MEAS_RATE_H_VAL_POS) |
MEAS_RATE_H: VAL mask
#define XENSIV_PASCO2_REG_MEAS_RATE_L_VAL_POS (0U) |
MEAS_RATE_L: VAL position
#define XENSIV_PASCO2_REG_MEAS_RATE_L_VAL_MSK (0xffU << XENSIV_PASCO2_REG_MEAS_RATE_L_VAL_POS) |
MEAS_RATE_L: VAL mask
#define XENSIV_PASCO2_REG_MEAS_CFG_OP_MODE_POS (0U) |
MEAS_CFG: OP_MODE position
#define XENSIV_PASCO2_REG_MEAS_CFG_OP_MODE_MSK (0x03U << XENSIV_PASCO2_REG_MEAS_CFG_OP_MODE_POS) |
MEAS_CFG: OP_MODE mask
#define XENSIV_PASCO2_REG_MEAS_CFG_BOC_CFG_POS (2U) |
MEAS_CFG: BOC_CFG position
#define XENSIV_PASCO2_REG_MEAS_CFG_BOC_CFG_MSK (0x03U << XENSIV_PASCO2_REG_MEAS_CFG_BOC_CFG_POS) |
MEAS_CFG: BOC_CFG mask
#define XENSIV_PASCO2_REG_MEAS_CFG_PWM_MODE_POS (4U) |
MEAS_CFG: PWM_MODE position
#define XENSIV_PASCO2_REG_MEAS_CFG_PWM_MODE_MSK (0x01U << XENSIV_PASCO2_REG_MEAS_CFG_PWM_MODE_POS) |
MEAS_CFG: PWM_MODE mask
#define XENSIV_PASCO2_REG_MEAS_CFG_PWM_OUTEN_POS (5U) |
MEAS_CFG: PWM_OUTEN position
#define XENSIV_PASCO2_REG_MEAS_CFG_PWM_OUTEN_MSK (0x01U << XENSIV_PASCO2_REG_MEAS_CFG_PWM_OUTEN_POS) |
MEAS_CFG: PWM_OUTEN mask
#define XENSIV_PASCO2_REG_CO2PPM_H_VAL_POS (0U) |
CO2PPM_H: VAL position
#define XENSIV_PASCO2_REG_CO2PPM_H_VAL_MSK (0xffU << XENSIV_PASCO2_REG_CO2PPM_H_VAL_POS) |
CO2PPM_H: VAL mask
#define XENSIV_PASCO2_REG_CO2PPM_L_VAL_POS (0U) |
CO2PPM_L: VAL position
#define XENSIV_PASCO2_REG_CO2PPM_L_VAL_MSK (0xffU << XENSIV_PASCO2_REG_CO2PPM_L_VAL_POS) |
CO2PPM_L: VAL mask
#define XENSIV_PASCO2_REG_MEAS_STS_ALARM_CLR_POS (0U) |
MEAS_STS: ALARM_CLR position
#define XENSIV_PASCO2_REG_MEAS_STS_ALARM_CLR_MSK (0x01U << XENSIV_PASCO2_REG_MEAS_STS_ALARM_CLR_POS) |
MEAS_STS: ALARM_CLR mask
#define XENSIV_PASCO2_REG_MEAS_STS_INT_STS_CLR_POS (1U) |
MEAS_STS: INT_STS_CLR position
#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
#define XENSIV_PASCO2_REG_MEAS_STS_ALARM_POS (2U) |
MEAS_STS: ALARM position
#define XENSIV_PASCO2_REG_MEAS_STS_ALARM_MSK (0x01U << XENSIV_PASCO2_REG_MEAS_STS_ALARM_POS) |
MEAS_STS: ALARM mask
#define XENSIV_PASCO2_REG_MEAS_STS_INT_STS_POS (3U) |
MEAS_STS: INT_STS position
#define XENSIV_PASCO2_REG_MEAS_STS_INT_STS_MSK (0x01U << XENSIV_PASCO2_REG_MEAS_STS_INT_STS_POS) |
MEAS_STS: INT_STS mask
#define XENSIV_PASCO2_REG_MEAS_STS_DRDY_POS (4U) |
MEAS_STS: DRDY position
#define XENSIV_PASCO2_REG_MEAS_STS_DRDY_MSK (0x01U << XENSIV_PASCO2_REG_MEAS_STS_DRDY_POS) |
MEAS_STS: DRDY mask
#define XENSIV_PASCO2_REG_INT_CFG_ALARM_TYP_POS (0U) |
INT_CFG: ALARM_TYP position
#define XENSIV_PASCO2_REG_INT_CFG_ALARM_TYP_MSK (0x01U << XENSIV_PASCO2_REG_INT_CFG_ALARM_TYP_POS) |
INT_CFG: ALARM_TYP mask
#define XENSIV_PASCO2_REG_INT_CFG_INT_FUNC_POS (1U) |
INT_CFG: INT_FUNC position
#define XENSIV_PASCO2_REG_INT_CFG_INT_FUNC_MSK (0x07U << XENSIV_PASCO2_REG_INT_CFG_INT_FUNC_POS) |
INT_CFG: INT_FUNC mask
#define XENSIV_PASCO2_REG_INT_CFG_INT_TYP_POS (4U) |
INT_CFG: INT_TYP position
#define XENSIV_PASCO2_REG_INT_CFG_INT_TYP_MSK (0x01U << XENSIV_PASCO2_REG_INT_CFG_INT_TYP_POS) |
INT_CFG: INT_TYP mask
#define XENSIV_PASCO2_REG_ALARM_TH_H_VAL_POS (0U) |
ALARM_TH_H: VAL position
#define XENSIV_PASCO2_REG_ALARM_TH_H_VAL_MSK (0xffU << XENSIV_PASCO2_REG_ALARM_TH_H_VAL_POS) |
ALARM_TH_H: VAL mask
#define XENSIV_PASCO2_REG_ALARM_TH_L_VAL_POS (0U) |
ALARM_TH_L: VAL position
#define XENSIV_PASCO2_REG_ALARM_TH_L_VAL_MSK (0xffU << XENSIV_PASCO2_REG_ALARM_TH_L_VAL_POS) |
ALARM_TH_L: VAL mask
#define XENSIV_PASCO2_REG_PRESS_REF_H_VAL_POS (0U) |
PRESS_REF_H: VAL position
#define XENSIV_PASCO2_REG_PRESS_REF_H_VAL_MSK (0xffU << XENSIV_PASCO2_REG_PRESS_REF_H_VAL_POS) |
PRESS_REF_H: VAL mask
#define XENSIV_PASCO2_REG_PRESS_REF_L_VAL_POS (0U) |
PRESS_REF_L: VAL position
#define XENSIV_PASCO2_REG_PRESS_REF_L_VAL_MSK (0xffU << XENSIV_PASCO2_REG_PRESS_REF_L_VAL_POS) |
PRESS_REF_L: VAL mask
#define XENSIV_PASCO2_REG_CALIB_REF_H_VAL_POS (0U) |
CALIB_REF_H: VAL position
#define XENSIV_PASCO2_REG_CALIB_REF_H_VAL_MSK (0xffU << XENSIV_PASCO2_REG_CALIB_REF_H_VAL_POS) |
CALIB_REF_H: VAL mask
#define XENSIV_PASCO2_REG_CALIB_REF_L_VAL_POS (0U) |
CALIB_REF_L: VAL position
#define XENSIV_PASCO2_REG_CALIB_REF_L_VAL_MSK (0xffU << XENSIV_PASCO2_REG_CALIB_REF_L_VAL_POS) |
CALIB_REF_L: VAL mask
#define XENSIV_PASCO2_REG_SCRATCH_PAD_VAL_POS (0U) |
SCRATCH_PAD: VAL position
#define XENSIV_PASCO2_REG_SCRATCH_PAD_VAL_MSK (0xffU << XENSIV_PASCO2_REG_SCRATCH_PAD_VAL_POS) |
SCRATCH_PAD: VAL mask
#define XENSIV_PASCO2_REG_SENS_RST_SRTRG_POS (0U) |
SENS_RST: SRTRG position
#define XENSIV_PASCO2_REG_SENS_RST_SRTRG_MSK (0xffU << XENSIV_PASCO2_REG_SENS_RST_SRTRG_POS) |
SENS_RST: SRTRG mask
enum xensiv_pasco2_cmd_t |
Enum defining the different device commands.
Enum defining the different device operating modes.
Enum defining different pin interrupt functions.
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
[in,out] | dev | Pointer to a XENSIV™ PAS CO2 sensor device structure allocated by the user, but the init function will initialize its contents |
[in] | ctx | Pointer to the platform-specific I2C communication handler |
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
[in,out] | dev | Pointer to a XENSIV™ PAS CO2 sensor device structure allocated by user, but the init function will initialize its contents |
[in] | ctx | Pointer to the platform-specific I2C communication handler |
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
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[in] | reg_addr | Start register address |
[in] | data | Pointer to the data buffer to be written in the sensor |
[in] | len | Number of bytes of data to be written |
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
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[in] | reg_addr | Start register address |
[out] | data | Pointer to the data buffer to store the register values of the sensor |
[in] | len | Number of bytes of data to be read |
int32_t xensiv_pasco2_get_id | ( | const xensiv_pasco2_t * | dev, |
xensiv_pasco2_id_t * | id | ||
) |
Gets the sensor device product and version ID.
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[out] | id | Pointer to populate with the sensor device product and version ID |
int32_t xensiv_pasco2_get_status | ( | const xensiv_pasco2_t * | dev, |
xensiv_pasco2_status_t * | status | ||
) |
Gets the sensor device status.
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[out] | status | Pointer to populate with the sensor device status |
int32_t xensiv_pasco2_clear_status | ( | const xensiv_pasco2_t * | dev, |
uint8_t | mask | ||
) |
Clears the sensor device status bits.
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[in] | mask | ORed combination of the following values:
|
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.
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[out] | int_config | Pointer to populate with the sensor device interrupt configuration |
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.
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[in] | int_config | New sensor device interrupt configuration to apply |
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.
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[out] | meas_config | Pointer to populate with the sensor device measurement configuration |
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.
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[in] | meas_config | New sensor device measurement configuration to apply |
int32_t xensiv_pasco2_get_result | ( | const xensiv_pasco2_t * | dev, |
uint16_t * | val | ||
) |
Gets the current CO2 ppm values from the sensor device.
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[out] | val | Pointer to populate with the CO2 ppm value |
int32_t xensiv_pasco2_set_measurement_rate | ( | const xensiv_pasco2_t * | dev, |
uint16_t | val | ||
) |
Sets the measurement rate for continuos mode.
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[in] | val | New measurement rate to apply [5-4095s] |
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)
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[out] | status | Pointer to populate with the sensor device 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.
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[in] | mask | ORed combination of the following values:
|
int32_t xensiv_pasco2_set_alarm_threshold | ( | const xensiv_pasco2_t * | dev, |
uint16_t | val | ||
) |
Sets the alarm threshold.
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[in] | val | New alarm threshold value to apply |
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
[in] | dev | Pointer to a XENSIV™ PAS CO2 sensor device |
[in] | val | New pressure compensation value to apply |
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.
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[in] | val | New pressure calibration value to apply |
int32_t xensiv_pasco2_set_scratch_pad | ( | const xensiv_pasco2_t * | dev, |
uint8_t | val | ||
) |
Writes to the scratchpad register.
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[in] | val | New scratchpad register value to apply |
int32_t xensiv_pasco2_get_scratch_pad | ( | const xensiv_pasco2_t * | dev, |
uint8_t * | val | ||
) |
Reads from the scratchpad register.
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[out] | val | Pointer to populate with the sensor device scratchpad register value |
int32_t xensiv_pasco2_cmd | ( | const xensiv_pasco2_t * | dev, |
xensiv_pasco2_cmd_t | cmd | ||
) |
Triggers a sensor device command.
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[in] | cmd | Command to trigger |
int32_t xensiv_pasco2_start_single_mode | ( | const xensiv_pasco2_t * | dev | ) |
Triggers a single mode measurement.
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
int32_t xensiv_pasco2_start_continuous_mode | ( | const xensiv_pasco2_t * | dev, |
uint16_t | val | ||
) |
Starts measurements in continuous mode.
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[in] | val | Measurement rate to apply [5-4095s] |
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.
[in] | dev | Pointer to the XENSIV™ PAS CO2 sensor device |
[in] | co2_ref | CO2 reference value |