LibDriver SGP30
Loading...
Searching...
No Matches
sgp30 base driver function

sgp30 base driver modules More...

Collaboration diagram for sgp30 base driver function:

Data Structures

struct  sgp30_handle_s
 sgp30 handle structure definition More...
struct  sgp30_info_s
 sgp30 information structure definition More...

Typedefs

typedef struct sgp30_handle_s sgp30_handle_t
 sgp30 handle structure definition
typedef struct sgp30_info_s sgp30_info_t
 sgp30 information structure definition

Functions

uint8_t sgp30_info (sgp30_info_t *info)
 get chip information
uint8_t sgp30_init (sgp30_handle_t *handle)
 initialize the chip
uint8_t sgp30_deinit (sgp30_handle_t *handle)
 close the chip
uint8_t sgp30_iaq_init (sgp30_handle_t *handle)
 initialize the chip iaq
uint8_t sgp30_read (sgp30_handle_t *handle, uint16_t *co2_eq_ppm, uint16_t *tvoc_ppb)
 read the iaq measure result
uint8_t sgp30_measure_iaq (sgp30_handle_t *handle, uint16_t *co2_eq_ppm, uint16_t *tvoc_ppb)
 get the iaq measure result
uint8_t sgp30_get_measure_raw (sgp30_handle_t *handle, uint16_t *tvoc, uint16_t *co2_eq)
 get the iaq measure raw result
uint8_t sgp30_set_tvoc_baseline (sgp30_handle_t *handle, uint16_t tvoc_baseline)
 set the chip tvoc baseline
uint8_t sgp30_get_tvoc_inceptive_baseline (sgp30_handle_t *handle, uint16_t *tvoc_baseline)
 get the chip tvoc inceptive baseline
uint8_t sgp30_soft_reset (sgp30_handle_t *handle)
 soft reset the chip
uint8_t sgp30_get_serial_id (sgp30_handle_t *handle, uint16_t id[3])
 get the chip serial id
uint8_t sgp30_set_iaq_baseline (sgp30_handle_t *handle, uint16_t tvoc, uint16_t co2_eq)
 set the chip iaq baseline
uint8_t sgp30_get_iaq_baseline (sgp30_handle_t *handle, uint16_t *tvoc, uint16_t *co2_eq)
 get the chip iaq baseline
uint8_t sgp30_set_absolute_humidity (sgp30_handle_t *handle, uint16_t humidity)
 set the chip absolute_humidity
uint8_t sgp30_absolute_humidity_convert_to_register (sgp30_handle_t *handle, float temp, float rh, uint16_t *reg)
 convert the absolute humidity to the register data
uint8_t sgp30_measure_test (sgp30_handle_t *handle, uint16_t *result)
 run the chip measure test
uint8_t sgp30_get_feature_set (sgp30_handle_t *handle, uint8_t *product_type, uint8_t *product_version)
 get the chip feature

Detailed Description

sgp30 base driver modules

Typedef Documentation

◆ sgp30_handle_t

sgp30 handle structure definition

◆ sgp30_info_t

typedef struct sgp30_info_s sgp30_info_t

sgp30 information structure definition

Function Documentation

◆ sgp30_absolute_humidity_convert_to_register()

uint8_t sgp30_absolute_humidity_convert_to_register ( sgp30_handle_t * handle,
float temp,
float rh,
uint16_t * reg )

convert the absolute humidity to the register data

Parameters
[in]*handlepointer to an sgp30 handle structure
[in]tempcurrent temperature
[in]rhcurrent relative humidity
[out]*regpointer to a converted register data
Returns
status code
  • 0 success
  • 1 absolute humidity convert to register failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 602 of file driver_sgp30.c.

◆ sgp30_deinit()

uint8_t sgp30_deinit ( sgp30_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to an sgp30 handle structure
Returns
status code
  • 0 success
  • 1 iic deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 soft reset failed
Note
none

Definition at line 838 of file driver_sgp30.c.

Here is the call graph for this function:

◆ sgp30_get_feature_set()

uint8_t sgp30_get_feature_set ( sgp30_handle_t * handle,
uint8_t * product_type,
uint8_t * product_version )

get the chip feature

Parameters
[in]*handlepointer to an sgp30 handle structure
[out]*product_typepointer to a product type buffer
[out]*product_versionpointer to a product version buffer
Returns
status code
  • 0 success
  • 1 get feature set failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 679 of file driver_sgp30.c.

◆ sgp30_get_iaq_baseline()

uint8_t sgp30_get_iaq_baseline ( sgp30_handle_t * handle,
uint16_t * tvoc,
uint16_t * co2_eq )

get the chip iaq baseline

Parameters
[in]*handlepointer to an sgp30 handle structure
[out]*tvocpointer to a tvoc buffer
[out]*co2_eqpointer to a co2 buffer
Returns
status code
  • 0 success
  • 1 get iaq baseline failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 463 of file driver_sgp30.c.

◆ sgp30_get_measure_raw()

uint8_t sgp30_get_measure_raw ( sgp30_handle_t * handle,
uint16_t * tvoc,
uint16_t * co2_eq )

get the iaq measure raw result

Parameters
[in]*handlepointer to an sgp30 handle structure
[out]*tvocpointer to a tvoc buffer
[out]*co2_eqpointer to a co2 buffer
Returns
status code
  • 0 success
  • 1 get measure raw failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 725 of file driver_sgp30.c.

◆ sgp30_get_serial_id()

uint8_t sgp30_get_serial_id ( sgp30_handle_t * handle,
uint16_t id[3] )

get the chip serial id

Parameters
[in]*handlepointer to an sgp30 handle structure
[out]*idpointer to an id buffer
Returns
status code
  • 0 success
  • 1 get serial id failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 352 of file driver_sgp30.c.

◆ sgp30_get_tvoc_inceptive_baseline()

uint8_t sgp30_get_tvoc_inceptive_baseline ( sgp30_handle_t * handle,
uint16_t * tvoc_baseline )

get the chip tvoc inceptive baseline

Parameters
[in]*handlepointer to an sgp30 handle structure
[out]*tvoc_baselinepointer to a current tvoc baseline buffer
Returns
status code
  • 0 success
  • 1 get tvoc inceptive baseline failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 237 of file driver_sgp30.c.

◆ sgp30_iaq_init()

uint8_t sgp30_iaq_init ( sgp30_handle_t * handle)

initialize the chip iaq

Parameters
[in]*handlepointer to an sgp30 handle structure
Returns
status code
  • 0 success
  • 1 iaq init failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 280 of file driver_sgp30.c.

◆ sgp30_info()

uint8_t sgp30_info ( sgp30_info_t * info)

get chip information

Parameters
[out]*infopointer to an sgp30 info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 980 of file driver_sgp30.c.

◆ sgp30_init()

uint8_t sgp30_init ( sgp30_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to an sgp30 handle structure
Returns
status code
  • 0 success
  • 1 iic initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
Note
none

Definition at line 775 of file driver_sgp30.c.

◆ sgp30_measure_iaq()

uint8_t sgp30_measure_iaq ( sgp30_handle_t * handle,
uint16_t * co2_eq_ppm,
uint16_t * tvoc_ppb )

get the iaq measure result

Parameters
[in]*handlepointer to an sgp30 handle structure
[out]*co2_eq_ppmpointer to a co2 buffer
[out]*tvoc_ppbpointer to a tvoc buffer
Returns
status code
  • 0 success
  • 1 measure iaq failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 411 of file driver_sgp30.c.

◆ sgp30_measure_test()

uint8_t sgp30_measure_test ( sgp30_handle_t * handle,
uint16_t * result )

run the chip measure test

Parameters
[in]*handlepointer to an sgp30 handle structure
[out]*resultpointer to a test result buffer
Returns
status code
  • 0 success
  • 1 measure test failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 634 of file driver_sgp30.c.

◆ sgp30_read()

uint8_t sgp30_read ( sgp30_handle_t * handle,
uint16_t * co2_eq_ppm,
uint16_t * tvoc_ppb )

read the iaq measure result

Parameters
[in]*handlepointer to an sgp30 handle structure
[out]*co2_eq_ppmpointer to a co2 buffer
[out]*tvoc_ppbpointer to a tvoc buffer
Returns
status code
  • 0 success
  • 1 read failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 878 of file driver_sgp30.c.

◆ sgp30_set_absolute_humidity()

uint8_t sgp30_set_absolute_humidity ( sgp30_handle_t * handle,
uint16_t humidity )

set the chip absolute_humidity

Parameters
[in]*handlepointer to an sgp30 handle structure
[in]humiditycurrent absolute_humidity
Returns
status code
  • 0 success
  • 1 set absolute_humidity failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 559 of file driver_sgp30.c.

◆ sgp30_set_iaq_baseline()

uint8_t sgp30_set_iaq_baseline ( sgp30_handle_t * handle,
uint16_t tvoc,
uint16_t co2_eq )

set the chip iaq baseline

Parameters
[in]*handlepointer to an sgp30 handle structure
[in]tvoccurrent tvoc
[in]co2_eqcurrent co2 eq
Returns
status code
  • 0 success
  • 1 set iaq baseline failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 515 of file driver_sgp30.c.

◆ sgp30_set_tvoc_baseline()

uint8_t sgp30_set_tvoc_baseline ( sgp30_handle_t * handle,
uint16_t tvoc_baseline )

set the chip tvoc baseline

Parameters
[in]*handlepointer to an sgp30 handle structure
[in]tvoc_baselinecurrent tvoc baseline
Returns
status code
  • 0 success
  • 1 set tvoc baseline failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 196 of file driver_sgp30.c.

◆ sgp30_soft_reset()

uint8_t sgp30_soft_reset ( sgp30_handle_t * handle)

soft reset the chip

Parameters
[in]*handlepointer to an sgp30 handle structure
Returns
status code
  • 0 success
  • 1 soft reset failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 315 of file driver_sgp30.c.