airquality9 2.0.0.0
airquality9.h File Reference

This file contains API for Air Quality 9 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"

Go to the source code of this file.

Data Structures

struct  airquality9_s
 Air Quality 9 Click context object. More...
 
struct  airquality9_cfg_t
 Air Quality 9 Click configuration object. More...
 

Macros

#define AIRQUALITY9_REG_PART_ID   0x00
 Air Quality 9 Register Map.
 
#define AIRQUALITY9_REG_OPMODE   0x10
 
#define AIRQUALITY9_REG_CONFIG   0x11
 
#define AIRQUALITY9_REG_COMMAND   0x12
 
#define AIRQUALITY9_REG_TEMP_IN   0x13
 
#define AIRQUALITY9_REG_RH_IN   0x15
 
#define AIRQUALITY9_REG_DATA_STATUS   0x20
 
#define AIRQUALITY9_REG_DATA_AQI   0x21
 
#define AIRQUALITY9_REG_DATA_TVOC   0x22
 
#define AIRQUALITY9_REG_DATA_ECO2   0x24
 
#define AIRQUALITY9_REG_DATA_T   0x30
 
#define AIRQUALITY9_REG_DATA_RH   0x32
 
#define AIRQUALITY9_REG_DATA_MISR   0x38
 
#define AIRQUALITY9_REG_GPR_WRITE   0x40
 
#define AIRQUALITY9_REG_GPR_READ   0x48
 
#define AIRQUALITY9_OPMODE_DEEP_SLEEP   0x00
 Air Quality 9 operating mode settings.
 
#define AIRQUALITY9_OPMODE_IDLE   0x01
 
#define AIRQUALITY9_OPMODE_STANDARD   0x02
 
#define AIRQUALITY9_OPMODE_RESET   0xF0
 
#define AIRQUALITY_CONFIG_INTPOL_LOW   0x00
 Air Quality 9 interrupt config register settings.
 
#define AIRQUALITY_CONFIG_INTPOL_HIGH   0x40
 
#define AIRQUALITY_CONFIG_INTCFG_OPEN_DRAIN   0x00
 
#define AIRQUALITY_CONFIG_INTCFG_PUSH_PULL   0x20
 
#define AIRQUALITY_CONFIG_INTGPR_BIT   0x08
 
#define AIRQUALITY_CONFIG_INTDAT_BIT   0x02
 
#define AIRQUALITY_CONFIG_INTEN_BIT   0x01
 
#define AIRQUALITY_STATUS_OPMODE_RUNNING   0x80
 Air Quality 9 data status register values.
 
#define AIRQUALITY_STATUS_ERROR_DETECTED   0x40
 
#define AIRQUALITY_STATUS_VALID_NORMAL_OP   0x00
 
#define AIRQUALITY_STATUS_VALID_WARM_UP   0x04
 
#define AIRQUALITY_STATUS_VALID_INIT_START_UP   0x08
 
#define AIRQUALITY_STATUS_VALID_INVALID   0x0C
 
#define AIRQUALITY_STATUS_VALID_FLAG_BITS   0x0C
 
#define AIRQUALITY_STATUS_NEW_DATA   0x02
 
#define AIRQUALITY_STATUS_NEW_GPR   0x01
 
#define AIRQUALITY9_PART_ID_LSB   0x60
 Air Quality 9 part ID value.
 
#define AIRQUALITY9_PART_ID_MSB   0x01
 
#define AIRQUALITY9_AQI_UBA_EXELLENT   1
 Air Quality 9 AQI-UBA rating values.
 
#define AIRQUALITY9_AQI_UBA_GOOD   2
 
#define AIRQUALITY9_AQI_UBA_MODERATE   3
 
#define AIRQUALITY9_AQI_UBA_POOR   4
 
#define AIRQUALITY9_AQI_UBA_UNHEALTHY   5
 
#define AIRQUALITY9_DEVICE_ADDRESS_0   0x52
 Air Quality 9 device address setting.
 
#define AIRQUALITY9_DEVICE_ADDRESS_1   0x53
 
#define AIRQUALITY9_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define AIRQUALITY9_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define AIRQUALITY9_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* airquality9_master_io_t) (struct airquality9_s *, uint8_t, uint8_t *, uint8_t)
 Air Quality 9 Click driver interface.
 
typedef struct airquality9_s airquality9_t
 Air Quality 9 Click context object.
 

Enumerations

enum  airquality9_drv_t { AIRQUALITY9_DRV_SEL_SPI , AIRQUALITY9_DRV_SEL_I2C }
 Air Quality 9 Click driver selector. More...
 
enum  airquality9_return_value_t { AIRQUALITY9_OK = 0 , AIRQUALITY9_ERROR = -1 }
 Air Quality 9 Click return value data. More...
 

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

This file contains API for Air Quality 9 Click Driver.

Typedef Documentation

◆ airquality9_master_io_t

typedef err_t(* airquality9_master_io_t) (struct airquality9_s *, uint8_t, uint8_t *, uint8_t)

Air Quality 9 Click driver interface.

Definition of driver interface of Air Quality 9 Click driver. Driver serial interface.

◆ airquality9_t

typedef struct airquality9_s airquality9_t

Air Quality 9 Click context object.

Context object definition of Air Quality 9 Click driver.

Enumeration Type Documentation

◆ airquality9_drv_t

Air Quality 9 Click driver selector.

Selects target driver interface of Air Quality 9 Click driver.

Enumerator
AIRQUALITY9_DRV_SEL_SPI 

SPI driver descriptor.

AIRQUALITY9_DRV_SEL_I2C 

I2C driver descriptor.

◆ airquality9_return_value_t

Air Quality 9 Click return value data.

Predefined enum values for driver return values.

Enumerator
AIRQUALITY9_OK 
AIRQUALITY9_ERROR