co23 2.1.0.0
CO2 3 Click Driver

API for configuring and manipulating CO2 3 Click driver. More...

Topics

 CO2 3 Registers List
 List of registers of CO2 3 Click driver.
 
 CO2 3 Registers Settings
 Settings for registers of CO2 3 Click driver.
 
 CO2 3 MikroBUS Map
 MikroBUS pin mapping of CO2 3 Click driver.
 

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

API for configuring and manipulating CO2 3 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ co23_cfg_setup()

void co23_cfg_setup ( co23_cfg_t * cfg)

CO2 3 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See co23_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ co23_default_cfg()

err_t co23_default_cfg ( co23_t * ctx)

CO2 3 default configuration function.

This function executes a default configuration of CO2 3 click board.

Parameters
[in]ctx: Click context object. See co23_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ co23_drv_interface_selection()

void co23_drv_interface_selection ( co23_cfg_t * cfg,
co23_drv_t drv_sel )

CO2 3 driver interface setup function.

This function sets a serial driver interface which will be used further in the click driver.

Parameters
[out]cfg: Click configuration structure. See co23_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See co23_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be call before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ co23_generic_read()

err_t co23_generic_read ( co23_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

CO2 3 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See co23_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ co23_generic_write()

err_t co23_generic_write ( co23_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

CO2 3 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See co23_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ co23_get_co2_ppm()

err_t co23_get_co2_ppm ( co23_t * ctx,
uint16_t * co2_ppm )

CO2 3 get CO2 concentration function.

This function reads a CO2 concentration measurement data of the XENSIV™ PAS CO2 on the CO2 3 Click board™.

Parameters
[in]ctx: Click context object. See co23_t object definition for detailed explanation.
[out]co2_ppm: CO2 concentration measurement data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ co23_get_device_id()

err_t co23_get_device_id ( co23_t * ctx,
uint8_t * prod,
uint8_t * rev )

CO2 3 get device ID function.

This function reads a device’s product and version ID of the XENSIV™ PAS CO2 on the CO2 3 Click board™.

Parameters
[in]ctx: Click context object. See co23_t object definition for detailed explanation.
[out]prod: Product ID.
[out]rev: Revision ID.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ co23_get_int_cfg()

err_t co23_get_int_cfg ( co23_t * ctx,
co23_int_cfg_t * int_cfg )

CO2 3 get interrupt pin configuration function.

This function reads a interrupt pin configuration object of the XENSIV™ PAS CO2 on the CO2 3 Click board™.

Parameters
[in]ctx: Click context object. See co23_t object definition for detailed explanation.
[out]int_cfg: Interrupt pin configuration object. See co23_int_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ co23_get_int_pin()

uint8_t co23_get_int_pin ( co23_t * ctx)

CO2 3 get interrupt function.

This function get states of the Interrupt ( INT ) pin of XENSIV™ PAS CO2 on the CO2 3 Click board™.

Parameters
[in]ctx: Click context object. See co23_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state.
Note
None.

◆ co23_get_meas_cfg()

err_t co23_get_meas_cfg ( co23_t * ctx,
co23_meas_cfg_t * meas_cfg )

CO2 3 get measurement configuration function.

This function reads a measurement configuration object of the XENSIV™ PAS CO2 on the CO2 3 Click board™.

Parameters
[in]ctx: Click context object. See co23_t object definition for detailed explanation.
[out]meas_cfg: Measurement configuration object. See co23_meas_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ co23_get_meas_status()

err_t co23_get_meas_status ( co23_t * ctx,
co23_meas_status_t * meas_status )

CO2 3 get measurement status function.

This function reads a measurement status object of the XENSIV™ PAS CO2 on the CO2 3 Click board™.

Parameters
[in]ctx: Click context object. See co23_t object definition for detailed explanation.
[out]sens_status: Measurement status object. See co23_meas_status_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ co23_get_pwo_pin()

uint8_t co23_get_pwo_pin ( co23_t * ctx)

CO2 3 get PWM output function.

This function get states of the PWM output ( PWO/AN ) pin of XENSIV™ PAS CO2 on the CO2 3 Click board™.

Parameters
[in]ctx: Click context object. See co23_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state.
Note
None.

◆ co23_get_sens_status()

err_t co23_get_sens_status ( co23_t * ctx,
co23_sens_status_t * sens_status )

CO2 3 get sensor status function.

This function reads a sensor status object of the XENSIV™ PAS CO2 on the CO2 3 Click board™.

Parameters
[in]ctx: Click context object. See co23_t object definition for detailed explanation.
[out]sens_status: Sensor status object. See co23_sens_status_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ co23_init()

err_t co23_init ( co23_t * ctx,
co23_cfg_t * cfg )

CO2 3 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See co23_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See co23_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ co23_set_alarm_threshold()

err_t co23_set_alarm_threshold ( co23_t * ctx,
uint16_t alarm_th_ppm )

CO2 3 set alarm threshold function.

This function sets the alarm threshold of the XENSIV™ PAS CO2 on the CO2 3 Click board™.

Parameters
[in]ctx: Click context object. See co23_t object definition for detailed explanation.
[in]alarm_th: Concatenated alarm threshold value [greater than 1000ppm].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ co23_set_calib_ref()

err_t co23_set_calib_ref ( co23_t * ctx,
uint16_t calib_ppm )

CO2 3 set calibration function.

This function sets the calibration reference value of the XENSIV™ PAS CO2 on the CO2 3 Click board™.

Parameters
[in]ctx: Click context object. See co23_t object definition for detailed explanation.
[in]calib_ppm: Calibration reference value [350mbar to 900mbar].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ co23_set_int_cfg()

err_t co23_set_int_cfg ( co23_t * ctx,
co23_int_cfg_t int_cfg )

CO2 3 set interrupt pin configuration function.

This function sets the interrupt pin configuration by writing the interrupt pin configuration object of the XENSIV™ PAS CO2 on the CO2 3 Click board™.

Parameters
[in]ctx: Click context object. See co23_t object definition for detailed explanation.
[in]int_cfg: Interrupt pin configuration object. See co23_int_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ co23_set_meas_cfg()

err_t co23_set_meas_cfg ( co23_t * ctx,
co23_meas_cfg_t meas_cfg )

CO2 3 set measurement configuration function.

This function sets the operation settings of the device by writing the measurement mode configuration object of the XENSIV™ PAS CO2 on the CO2 3 Click board™.

Parameters
[in]ctx: Click context object. See co23_t object definition for detailed explanation.
[in]meas_cfg: Measurement configuration object. See co23_meas_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ co23_set_meas_rate()

err_t co23_set_meas_rate ( co23_t * ctx,
uint16_t meas_rate_sec )

CO2 3 set measurement rate function.

This function set measurement period in continuous mode of the XENSIV™ PAS CO2 on the CO2 3 Click board™.

Parameters
[in]ctx: Click context object. See co23_t object definition for detailed explanation.
[in]meas_rate_sec: Measurement period in seconds [5 - 4095].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ co23_set_pressure_ref()

err_t co23_set_pressure_ref ( co23_t * ctx,
uint16_t pressure_mbar )

CO2 3 set alarm threshold function.

This function sets the alarm threshold reference value of the XENSIV™ PAS CO2 on the CO2 3 Click board™.

Parameters
[in]ctx: Click context object. See co23_t object definition for detailed explanation.
[in]pressure_mbar: Pressure reference value [750mbar to 1150mbar].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ co23_soft_reset_trigger()

err_t co23_soft_reset_trigger ( co23_t * ctx,
co23_soft_reset_value_t reset_cmd )

CO2 3 soft reset trigger function.

This function is used to trigger a soft reset of the XENSIV™ PAS CO2 on the CO2 3 Click board™.

Parameters
[in]ctx: Click context object. See co23_t object definition for detailed explanation.
[in]reset_cmd: Soft reset object. See co23_soft_reset_value_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.