airquality9 2.0.0.0
Air Quality 9 Click Driver

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

Topics

 Air Quality 9 Registers List
 List of registers of Air Quality 9 Click driver.
 
 Air Quality 9 Registers Settings
 Settings for registers of Air Quality 9 Click driver.
 
 Air Quality 9 MikroBUS Map
 MikroBUS pin mapping of Air Quality 9 Click driver.
 

Functions

void airquality9_cfg_setup (airquality9_cfg_t *cfg)
 Air Quality 9 configuration object setup function.
 
void airquality9_drv_interface_selection (airquality9_cfg_t *cfg, airquality9_drv_t drv_sel)
 Air Quality 9 driver interface setup function.
 
err_t airquality9_init (airquality9_t *ctx, airquality9_cfg_t *cfg)
 Air Quality 9 initialization function.
 
err_t airquality9_default_cfg (airquality9_t *ctx)
 Air Quality 9 default configuration function.
 
err_t airquality9_generic_write (airquality9_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Air Quality 9 data writing function.
 
err_t airquality9_generic_read (airquality9_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Air Quality 9 data reading function.
 
void airquality9_enable_device (airquality9_t *ctx)
 Air Quality 9 enable device function.
 
void airquality9_disable_device (airquality9_t *ctx)
 Air Quality 9 disable device function.
 
uint8_t airquality9_get_int_pin (airquality9_t *ctx)
 Air Quality 9 get int pin function.
 
err_t airquality9_check_communication (airquality9_t *ctx)
 Air Quality 9 check communication function.
 
err_t airquality9_set_operating_mode (airquality9_t *ctx, uint8_t opmode)
 Air Quality 9 set operating mode function.
 
err_t airquality9_set_interrupt_config (airquality9_t *ctx, uint8_t int_cfg)
 Air Quality 9 set interrupt config function.
 
err_t airquality9_read_status (airquality9_t *ctx, uint8_t *status)
 Air Quality 9 read status function.
 
err_t airquality9_read_aqi_uba (airquality9_t *ctx, uint8_t *aqi_uba)
 Air Quality 9 read aqi uba function.
 
err_t airquality9_read_tvoc (airquality9_t *ctx, uint16_t *tvoc)
 Air Quality 9 read tvoc function.
 
err_t airquality9_read_eco2 (airquality9_t *ctx, uint16_t *eco2)
 Air Quality 9 read eco2 function.
 

Detailed Description

API for configuring and manipulating Air Quality 9 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

◆ airquality9_cfg_setup()

void airquality9_cfg_setup ( airquality9_cfg_t * cfg)

Air Quality 9 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ airquality9_check_communication()

err_t airquality9_check_communication ( airquality9_t * ctx)

Air Quality 9 check communication function.

This function checks the communication by reading and verifying the chip part ID.

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

◆ airquality9_default_cfg()

err_t airquality9_default_cfg ( airquality9_t * ctx)

Air Quality 9 default configuration function.

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

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

◆ airquality9_disable_device()

void airquality9_disable_device ( airquality9_t * ctx)

Air Quality 9 disable device function.

This function disables the device by setting the EN pin to low logic state.

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

◆ airquality9_drv_interface_selection()

void airquality9_drv_interface_selection ( airquality9_cfg_t * cfg,
airquality9_drv_t drv_sel )

Air Quality 9 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 airquality9_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See airquality9_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.

◆ airquality9_enable_device()

void airquality9_enable_device ( airquality9_t * ctx)

Air Quality 9 enable device function.

This function enables the device by setting the EN pin to high logic state.

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

◆ airquality9_generic_read()

err_t airquality9_generic_read ( airquality9_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Air Quality 9 data reading function.

This function reads a desired number of data bytes starting from the selected register.

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

◆ airquality9_generic_write()

err_t airquality9_generic_write ( airquality9_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Air Quality 9 data writing function.

This function writes a desired number of data bytes starting from the selected register.

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

◆ airquality9_get_int_pin()

uint8_t airquality9_get_int_pin ( airquality9_t * ctx)

Air Quality 9 get int pin function.

This function returns the INT pin logic state.

Parameters
[in]ctx: Click context object. See airquality9_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ airquality9_init()

err_t airquality9_init ( airquality9_t * ctx,
airquality9_cfg_t * cfg )

Air Quality 9 initialization function.

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

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

◆ airquality9_read_aqi_uba()

err_t airquality9_read_aqi_uba ( airquality9_t * ctx,
uint8_t * aqi_uba )

Air Quality 9 read aqi uba function.

This function reads the Air Quality Index per UBA (AQI-UBA).

Parameters
[in]ctx: Click context object. See airquality9_t object definition for detailed explanation.
[out]aqi_uba: AQI-UBA value [1-5].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ airquality9_read_eco2()

err_t airquality9_read_eco2 ( airquality9_t * ctx,
uint16_t * eco2 )

Air Quality 9 read eco2 function.

This function reads the calculated Equivalent CO2 (eCO2) concentration per ppm.

Parameters
[in]ctx: Click context object. See airquality9_t object definition for detailed explanation.
[out]eco2: eCO2 per ppm [400-65000].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ airquality9_read_status()

err_t airquality9_read_status ( airquality9_t * ctx,
uint8_t * status )

Air Quality 9 read status function.

This function reads the data status register.

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

◆ airquality9_read_tvoc()

err_t airquality9_read_tvoc ( airquality9_t * ctx,
uint16_t * tvoc )

Air Quality 9 read tvoc function.

This function reads the calculated Total Volatile Organic Compounds (TVOC) concentration per ppb.

Parameters
[in]ctx: Click context object. See airquality9_t object definition for detailed explanation.
[out]tvoc: TVOC per ppb [0-65000].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ airquality9_set_interrupt_config()

err_t airquality9_set_interrupt_config ( airquality9_t * ctx,
uint8_t int_cfg )

Air Quality 9 set interrupt config function.

This function sets the interrupt config register.

Parameters
[in]ctx: Click context object. See airquality9_t object definition for detailed explanation.
[in]int_cfg: Interrupt config register value.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ airquality9_set_operating_mode()

err_t airquality9_set_operating_mode ( airquality9_t * ctx,
uint8_t opmode )

Air Quality 9 set operating mode function.

This function sets the device operating mode.

Parameters
[in]ctx: Click context object. See airquality9_t object definition for detailed explanation.
[in]opmode:
  • 0x00 - Deep sleep,
  • 0x01 - IDLE,
  • 0x02 - Standard,
  • 0xF0 - Reset.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.