co2  2.0.0.0
Functions
Public function

Functions

void co2_cfg_setup (co2_cfg_t *cfg)
 Config Object Initialization function. More...
 
CO2_RETVAL co2_init (co2_t *ctx, co2_cfg_t *cfg)
 Initialization function. More...
 
uint8_t co2_generic_write (co2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function. More...
 
uint8_t co2_generic_read (co2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function. More...
 
void co2_wait_i2c_ready (co2_t *ctx)
 Generic read function. More...
 
void co2_enable (co2_t *ctx, uint8_t state)
 Device Enable function. More...
 
void co2_read_adc (co2_t *ctx, uint16_t *data_out)
 Read ADC Data function. More...
 
void co2_get_co2_ppm (co2_t *ctx, float *co2_data)
 Get CO Data function. More...
 

Detailed Description

Function Documentation

◆ co2_cfg_setup()

void co2_cfg_setup ( co2_cfg_t cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ co2_enable()

void co2_enable ( co2_t ctx,
uint8_t  state 
)

Device Enable function.

Parameters
ctxClick object.
state0 - enable, value different from 0 - disable

Function puts the device to enabled or to disabled state.

◆ co2_generic_read()

uint8_t co2_generic_read ( co2_t ctx,
uint8_t  reg,
uint8_t *  data_buf,
uint8_t  len 
)

Generic read function.

Parameters
ctxClick object.
regRegister address.
data_bufOutput data buf
lenNumber of the bytes to be read

This function reads data from the desired register.

◆ co2_generic_write()

uint8_t co2_generic_write ( co2_t ctx,
uint8_t  reg,
uint8_t *  data_buf,
uint8_t  len 
)

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_bufData buf to be written.
lenNumber of the bytes in data buf.

This function writes data to the desired register.

◆ co2_get_co2_ppm()

void co2_get_co2_ppm ( co2_t ctx,
float *  co2_data 
)

Get CO Data function.

Parameters
ctxClick object.
co_dataMemory where CO data from the device be stored

Function reads the CO converted data and calculates this value to the ppm.

◆ co2_init()

CO2_RETVAL co2_init ( co2_t ctx,
co2_cfg_t cfg 
)

Initialization function.

Parameters
co2Click object.
cfgClick configuration structure.

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

◆ co2_read_adc()

void co2_read_adc ( co2_t ctx,
uint16_t *  data_out 
)

Read ADC Data function.

Parameters
ctxClick object.
data_outBuffer where the converted data be stored

Function reads the converted data (CO) from the 12-bit AD converter.

◆ co2_wait_i2c_ready()

void co2_wait_i2c_ready ( co2_t ctx)

Generic read function.

Parameters
ctxClick object.

Function waits until I2C is ready for the next command.