airquality8 2.0.0.0
Air Quality 8 Click Driver

API for configuring and manipulating Air Quality 8 Click driver. More...

Functions

void airquality8_cfg_setup (airquality8_cfg_t *cfg)
 Air Quality 8 configuration object setup function.
 
err_t airquality8_init (airquality8_t *ctx, airquality8_cfg_t *cfg)
 Air Quality 8 initialization function.
 
err_t airquality8_default_cfg (airquality8_t *ctx)
 Air Quality 8 default configuration function.
 
err_t airquality8_generic_write (airquality8_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 Air Quality 8 I2C writing function.
 
err_t airquality8_generic_read (airquality8_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 Air Quality 8 I2C reading function.
 
void airquality8_hw_reset (airquality8_t *ctx)
 Air Quality 8 reset function.
 
err_t airquality8_get_status (airquality8_t *ctx, uint8_t *status)
 Air Quality 8 get status function.
 
err_t airquality8_get_sensor_info (airquality8_t *ctx, uint8_t *cfg_data, uint8_t *prod_data, uint16_t *pid)
 Air Quality 8 get sensor info function.
 
err_t airquality8_init_sensor (airquality8_t *ctx, uint16_t *mox_lr, uint16_t *mox_er)
 Air Quality 8 init sensor function.
 
err_t airquality8_init_measurement (airquality8_t *ctx)
 Air Quality 8 init measurement function.
 
err_t airquality8_start_measurement (airquality8_t *ctx)
 Air Quality 8 start measurement function.
 
err_t airquality8_read_rmox (airquality8_t *ctx, float *rmox, uint16_t mox_lr, uint16_t mox_er)
 Air Quality 8 calculate rmox resistance function.
 
float airquality8_calc_oaq (float *rmox, uint8_t rcda_strategy, uint8_t gas_detection_strategy)
 Air Quality 8 calculates AQI function.
 
uint8_t raq_check_interrupt (airquality8_t *ctx)
 Air Quality 8 check interrupt function.
 

Detailed Description

API for configuring and manipulating Air Quality 8 Click driver.

Function Documentation

◆ airquality8_calc_oaq()

float airquality8_calc_oaq ( float * rmox,
uint8_t rcda_strategy,
uint8_t gas_detection_strategy )

Air Quality 8 calculates AQI function.

This function calculates AQI from present sample of the ZMOD4510 Gas Sensor Module for OAQ targeting NO2 & O3 on the Air Quality 8 Click board™.

Parameters
[in]rmox: Pointer to array of the 15 sequencer rmox measurements.
[in]rcda_strategy: Strategy how to handle Rcda data
  • 0 ( AIRQUALITY8_RCDA_STRATEGY_FIX ) - Hold rcda fixed,
  • 1 ( AIRQUALITY8_RCDA_STRATEGY_SET ) - Set the rcda to the actal measurement,
  • 2 ( AIRQUALITY8_RCDA_STRATEGY_ADJ ) - Adjust rcda to follow slow drifts.
[in]gas_detection_strategy: Gas detection strategy handle
  • 0 ( AIRQUALITY8_GAS_DETECTION_STRATEGY_AUTO ) - Automatic gas discrimination,
  • 1 ( AIRQUALITY8_GAS_DETECTION_STRATEGY_FORCE_O3 ) - Handle the measurements as O3,
  • 2 ( AIRQUALITY8_GAS_DETECTION_STRATEGY_FORCE_NO2 ) - Handle the measurements as NO2.
Returns
Air quality index ( AQI ) value.
Note
None.

◆ airquality8_cfg_setup()

void airquality8_cfg_setup ( airquality8_cfg_t * cfg)

Air Quality 8 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ airquality8_default_cfg()

err_t airquality8_default_cfg ( airquality8_t * ctx)

Air Quality 8 default configuration function.

This function executes a default configuration of Air Quality 8 click board.

Parameters
[in]ctx: Click context object. See airquality8_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.

◆ airquality8_generic_read()

err_t airquality8_generic_read ( airquality8_t * ctx,
uint8_t reg,
uint8_t * rx_buf,
uint8_t rx_len )

Air Quality 8 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 airquality8_t object definition for detailed explanation.
[in]reg: Start register address.
[out]rx_buf: Output read data.
[in]rx_len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ airquality8_generic_write()

err_t airquality8_generic_write ( airquality8_t * ctx,
uint8_t reg,
uint8_t * tx_buf,
uint8_t tx_len )

Air Quality 8 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 airquality8_t object definition for detailed explanation.
[in]reg: Start register address.
[in]tx_buf: Data to be written.
[in]tx_len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ airquality8_get_sensor_info()

err_t airquality8_get_sensor_info ( airquality8_t * ctx,
uint8_t * cfg_data,
uint8_t * prod_data,
uint16_t * pid )

Air Quality 8 get sensor info function.

This function read product ID and configuration parameters of the ZMOD4510 Gas Sensor Module for OAQ targeting NO2 & O3 on the Air Quality 8 Click board™.

Parameters
[in]ctx: Click context object. See airquality8_t object definition for detailed explanation.
[out]cfg_data: Output configuration data.
[out]prod_data: Output product data.
[out]pid: Output product ID data.
Returns
  • 0 - Success,
  • -1 - Error,
  • 1 - Error initialization out of range,
  • 2 - Error Gas timeout,
  • 3 - Error I2C,
  • 4 - Error sensor unsupported,
  • 5 - Error config missing,
  • 6 - Error sensor,
  • 7 - Error access conflict,
  • 8 - Error por event.
See #err_t definition for detailed explanation.
Note
This step is required to select the correct configuration for the sensor.

◆ airquality8_get_status()

err_t airquality8_get_status ( airquality8_t * ctx,
uint8_t * status )

Air Quality 8 get status function.

This function read status data of the ZMOD4510 Gas Sensor Module for OAQ targeting NO2 & O3 on the Air Quality 8 Click board™.

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

◆ airquality8_hw_reset()

void airquality8_hw_reset ( airquality8_t * ctx)

Air Quality 8 reset function.

This function executes a hardware reset of the ZMOD4510 Gas Sensor Module for OAQ targeting NO2 & O3 on the Air Quality 8 Click board™.

Parameters
[in]ctx: Click context object. See airquality8_t object definition for detailed explanation.
Returns
Nothing.
Note
None.

◆ airquality8_init()

err_t airquality8_init ( airquality8_t * ctx,
airquality8_cfg_t * cfg )

Air Quality 8 initialization function.

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

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

◆ airquality8_init_measurement()

err_t airquality8_init_measurement ( airquality8_t * ctx)

Air Quality 8 init measurement function.

This function sensor measurement initialization of the ZMOD4510 Gas Sensor Module for OAQ targeting NO2 & O3 on the Air Quality 8 Click board™.

Parameters
[in]ctx: Click context object. See airquality8_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error,
  • 1 - Error initialization out of range,
  • 2 - Error Gas timeout,
  • 3 - Error I2C,
  • 4 - Error sensor unsupported,
  • 5 - Error config missing,
  • 6 - Error sensor,
  • 7 - Error access conflict,
  • 8 - Error por event.
See #err_t definition for detailed explanation.
Note
None.

◆ airquality8_init_sensor()

err_t airquality8_init_sensor ( airquality8_t * ctx,
uint16_t * mox_lr,
uint16_t * mox_er )

Air Quality 8 init sensor function.

This function sensor initialization after power on of the ZMOD4510 Gas Sensor Module for OAQ targeting NO2 & O3 on the Air Quality 8 Click board™.

Parameters
[in]ctx: Click context object. See airquality8_t object definition for detailed explanation.
[out]mox_lr: Output sensor specific parameter data.
[out]mox_er: Output sensor specific parameter data.
Returns
  • 0 - Success,
  • -1 - Error,
  • 1 - Error initialization out of range,
  • 2 - Error Gas timeout,
  • 3 - Error I2C,
  • 4 - Error sensor unsupported,
  • 5 - Error config missing,
  • 6 - Error sensor,
  • 7 - Error access conflict,
  • 8 - Error por event.
See #err_t definition for detailed explanation.
Note
None.

◆ airquality8_read_rmox()

err_t airquality8_read_rmox ( airquality8_t * ctx,
float * rmox,
uint16_t mox_lr,
uint16_t mox_er )

Air Quality 8 calculate rmox resistance function.

This function calculate rmox resistance data of the ZMOD4510 Gas Sensor Module for OAQ targeting NO2 & O3 on the Air Quality 8 Click board™.

Parameters
[in]ctx: Click context object. See airquality8_t object definition for detailed explanation.
[out]rmox: Output srmox data.
[in]mox_lr: Output sensor specific parameter data.
[in]mox_er: Output sensor specific parameter data.
Returns
  • 0 - Success,
  • -1 - Error,
  • 1 - Error initialization out of range,
  • 2 - Error Gas timeout,
  • 3 - Error I2C,
  • 4 - Error sensor unsupported,
  • 5 - Error config missing,
  • 6 - Error sensor,
  • 7 - Error access conflict,
  • 8 - Error por event.
See #err_t definition for detailed explanation.
Note
None.

◆ airquality8_start_measurement()

err_t airquality8_start_measurement ( airquality8_t * ctx)

Air Quality 8 start measurement function.

This function start measurement
of the ZMOD4510 Gas Sensor Module for OAQ targeting NO2 & O3 on the Air Quality 8 Click board™.

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

◆ raq_check_interrupt()

uint8_t raq_check_interrupt ( airquality8_t * ctx)

Air Quality 8 check interrupt function.

This function get states of the Interrupt ( INT pin ) of the ZMOD4510 Gas Sensor Module for OAQ targeting NO2 & O3 on the Air Quality 8 Click board™.

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