Basic set of APIs for interacting with the XENSIV™ PAS CO2 sensor.
This provides basic initialization and access to the CO2 ppm value. It also provides access to the base XENSIV™ PAS CO2 driver for full control.
The following snippet initializes an I2C instance and the XENSIV™ PAS CO2 sensor, and then reads from the XENSIV™ PAS CO2 sensor.
The following snippet demonstrates how to configure a XENSIV™ PAS CO2 sensor interrupt.
Macros | |
#define | CY_RSLT_MODULE_BOARD_HARDWARE_XENSIV_PASCO2 0x01CA |
#define | XENSIV_PASCO2_RSLT_ERR_COMM (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_BOARD_HARDWARE_XENSIV_PASCO2, XENSIV_PASCO2_ERR_COMM)) |
Result code indicating a communication error. | |
#define | XENSIV_PASCO2_RSLT_ERR_WRITE_TOO_LARGE (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_BOARD_HARDWARE_XENSIV_PASCO2, XENSIV_PASCO2_ERR_WRITE_TOO_LARGE)) |
Result code indicating that an unexpectedly large I2C write was requested which is not supported. | |
#define | XENSIV_PASCO2_RSLT_ERR_NOT_READY (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_BOARD_HARDWARE_XENSIV_PASCO2, XENSIV_PASCO2_ERR_NOT_READY)) |
Result code indicating that the sensor is not yet ready after reset. | |
#define | XENSIV_PASCO2_RSLT_ICCERR (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_BOARD_HARDWARE_XENSIV_PASCO2, XENSIV_PASCO2_ICCERR)) |
Result code indicating whether an invalid command has been received by the serial communication interface. | |
#define | XENSIV_PASCO2_RSLT_ORVS (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_BOARD_HARDWARE_XENSIV_PASCO2, XENSIV_PASCO2_ORVS)) |
Result code indicating whether a condition where VDD12V has been outside the specified valid range has been detected. | |
#define | XENSIV_PASCO2_RSLT_ORTMP (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_BOARD_HARDWARE_XENSIV_PASCO2, XENSIV_PASCO2_ORTMP)) |
Result code indicating whether a condition where the temperature has been outside the specified valid range has been detected. | |
#define | XENSIV_PASCO2_RSLT_READ_NRDY (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_BOARD_HARDWARE_XENSIV_PASCO2, XENSIV_PASCO2_READ_NRDY)) |
Result code indicating that a new CO2 value is not yet ready. | |
Functions | |
cy_rslt_t | xensiv_pasco2_mtb_init_i2c (xensiv_pasco2_t *dev, cyhal_i2c_t *i2c) |
Initializes the XENSIV™ PAS CO2 sensor and configures it to use the specified I2C peripheral. More... | |
cy_rslt_t | xensiv_pasco2_mtb_init_uart (xensiv_pasco2_t *dev, cyhal_uart_t *uart) |
Initializes the XENSIV™ PAS CO2 sensor, and configures it to use the specified UART peripheral. More... | |
cy_rslt_t | xensiv_pasco2_mtb_interrupt_init (const xensiv_pasco2_t *dev, const xensiv_pasco2_interrupt_config_t int_config, uint16_t alarm_threshold, cyhal_gpio_t pin, uint8_t intr_priority, cyhal_gpio_event_callback_t callback, void *callback_arg) |
Configures a GPIO pin as an interrupt for the PAS CO2 sensor. More... | |
cy_rslt_t | xensiv_pasco2_mtb_interrupt_init_ex (xensiv_pasco2_t *dev, const xensiv_pasco2_interrupt_config_t int_config, uint16_t alarm_threshold, cyhal_gpio_t pin, uint8_t intr_priority, xensiv_pasco2_mtb_interrupt_cb_t *interrupt_cb) |
Configures a GPIO pin as an interrupt for the PAS CO2 sensor. More... | |
cy_rslt_t | xensiv_pasco2_mtb_read (const xensiv_pasco2_t *dev, uint16_t press_ref, uint16_t *co2_ppm_val) |
Reads the CO2 value value if available. More... | |
cy_rslt_t xensiv_pasco2_mtb_init_i2c | ( | xensiv_pasco2_t * | dev, |
cyhal_i2c_t * | i2c | ||
) |
Initializes the XENSIV™ PAS CO2 sensor and configures it to use the specified I2C peripheral.
[in,out] | obj | Pointer to the ModusToolbox&trade PAS CO2 object. The caller must allocate the memory for this object but the init function will initialize its contents |
[in] | i2c | Pointer to an initialized I2C object |
cy_rslt_t xensiv_pasco2_mtb_init_uart | ( | xensiv_pasco2_t * | dev, |
cyhal_uart_t * | uart | ||
) |
Initializes the XENSIV™ PAS CO2 sensor, and configures it to use the specified UART peripheral.
[in,out] | obj | Pointer to the ModusToolbox&trade PAS CO2 object. The caller must allocate the memory for this object but the init function will initialize its contents |
[in] | uart | Pointer to an initialized UART object |
cy_rslt_t xensiv_pasco2_mtb_interrupt_init | ( | const xensiv_pasco2_t * | dev, |
const xensiv_pasco2_interrupt_config_t | int_config, | ||
uint16_t | alarm_threshold, | ||
cyhal_gpio_t | pin, | ||
uint8_t | intr_priority, | ||
cyhal_gpio_event_callback_t | callback, | ||
void * | callback_arg | ||
) |
Configures a GPIO pin as an interrupt for the PAS CO2 sensor.
This initializes and configures the pin as an interrupt, and calls the PAS CO2 interrupt configuration API with the application-supplied settings structure
[in] | dev | Pointer to the PAS CO2 sensor device |
[in] | int_config | New sensor device interrupt configuration to apply |
[in] | alarm_threshold | New alarm threshold value to apply |
[in] | pin | Pin connected to the INT pin of the sensor |
[in] | intr_priority | Priority for NVIC interrupt events |
[in] | callback | Function to call when the specified event happens. Pass NULL to unregister the handler |
[in] | callback_arg | Generic argument that will be provided to the callback when called; can be NULL |
cy_rslt_t xensiv_pasco2_mtb_interrupt_init_ex | ( | xensiv_pasco2_t * | dev, |
const xensiv_pasco2_interrupt_config_t | int_config, | ||
uint16_t | alarm_threshold, | ||
cyhal_gpio_t | pin, | ||
uint8_t | intr_priority, | ||
xensiv_pasco2_mtb_interrupt_cb_t * | interrupt_cb | ||
) |
Configures a GPIO pin as an interrupt for the PAS CO2 sensor.
This initializes and configures the pin as an interrupt, and calls the PAS CO2 interrupt configuration API with the application-supplied settings structure
[in] | obj | Pointer to the ModusToolbox&trade PAS CO2 sensor object |
[in] | int_config | New sensor device interrupt configuration to apply |
[in] | alarm_threshold | New alarm threshold value to apply |
[in] | pin | Pin connected to the INT pin of the sensor |
[in] | intr_priority | Priority for NVIC interrupt events |
[in] | interrupt_cb | Interrupt callback |
cy_rslt_t xensiv_pasco2_mtb_read | ( | const xensiv_pasco2_t * | dev, |
uint16_t | press_ref, | ||
uint16_t * | co2_ppm_val | ||
) |
Reads the CO2 value value if available.
This checks whether a new CO2 value is available, in which case it returns it and sets the new pressure reference value for the next measurement
[in] | obj | Pointer to the ModusToolbox&trade PAS CO2 object |
[in] | press_ref | New pressure reference value to apply |
[out] | co2_ppm_val | Pointer to populate with the CO2 ppm value |