LibDriver SGP41
Loading...
Searching...
No Matches
sgp41 base driver function

sgp41 base driver modules More...

Collaboration diagram for sgp41 base driver function:

Data Structures

struct  sgp41_handle_s
 sgp41 handle structure definition More...
struct  sgp41_info_s
 sgp41 information structure definition More...

Typedefs

typedef struct sgp41_handle_s sgp41_handle_t
 sgp41 handle structure definition
typedef struct sgp41_info_s sgp41_info_t
 sgp41 information structure definition

Functions

uint8_t sgp41_info (sgp41_info_t *info)
 get chip information
uint8_t sgp41_init (sgp41_handle_t *handle)
 initialize the chip
uint8_t sgp41_deinit (sgp41_handle_t *handle)
 close the chip
uint8_t sgp41_get_execute_conditioning (sgp41_handle_t *handle, uint16_t *sraw_voc)
 get execute conditioning
uint8_t sgp41_get_measure_raw (sgp41_handle_t *handle, uint16_t raw_humidity, uint16_t raw_temperature, uint16_t *sraw_voc, uint16_t *sraw_nox)
 get the measure raw result
uint8_t sgp41_get_measure_raw_without_compensation (sgp41_handle_t *handle, uint16_t *sraw_voc, uint16_t *sraw_nox)
 get the measure raw result without compensation
uint8_t sgp41_humidity_convert_to_register (sgp41_handle_t *handle, float rh, uint16_t *reg)
 convert the humidity to the register data
uint8_t sgp41_temperature_convert_to_register (sgp41_handle_t *handle, float temp, uint16_t *reg)
 convert the temperature to the register data
uint8_t sgp41_get_measure_test (sgp41_handle_t *handle, uint16_t *result)
 get the chip measure test
uint8_t sgp41_soft_reset (sgp41_handle_t *handle)
 soft reset the chip
uint8_t sgp41_turn_heater_off (sgp41_handle_t *handle)
 turn heater off
uint8_t sgp41_get_serial_id (sgp41_handle_t *handle, uint16_t id[3])
 get the chip serial id

Detailed Description

sgp41 base driver modules

Typedef Documentation

◆ sgp41_handle_t

sgp41 handle structure definition

◆ sgp41_info_t

typedef struct sgp41_info_s sgp41_info_t

sgp41 information structure definition

Function Documentation

◆ sgp41_deinit()

uint8_t sgp41_deinit ( sgp41_handle_t * handle)

close the chip

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

Definition at line 699 of file driver_sgp41.c.

Here is the call graph for this function:

◆ sgp41_get_execute_conditioning()

uint8_t sgp41_get_execute_conditioning ( sgp41_handle_t * handle,
uint16_t * sraw_voc )

get execute conditioning

Parameters
[in]*handlepointer to an sgp41 handle structure
[out]*sraw_vocpointer to a raw tvoc buffer
Returns
status code
  • 0 success
  • 1 get execute conditioning failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 290 of file driver_sgp41.c.

◆ sgp41_get_measure_raw()

uint8_t sgp41_get_measure_raw ( sgp41_handle_t * handle,
uint16_t raw_humidity,
uint16_t raw_temperature,
uint16_t * sraw_voc,
uint16_t * sraw_nox )

get the measure raw result

Parameters
[in]*handlepointer to an sgp41 handle structure
[in]raw_humidityhumidity raw data
[in]raw_temperaturetemperature raw data
[out]*sraw_vocpointer to a raw tvoc buffer
[out]*sraw_noxpointer to a raw nox 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 345 of file driver_sgp41.c.

◆ sgp41_get_measure_raw_without_compensation()

uint8_t sgp41_get_measure_raw_without_compensation ( sgp41_handle_t * handle,
uint16_t * sraw_voc,
uint16_t * sraw_nox )

get the measure raw result without compensation

Parameters
[in]*handlepointer to an sgp41 handle structure
[out]*sraw_vocpointer to a raw tvoc buffer
[out]*sraw_noxpointer to a raw nox buffer
Returns
status code
  • 0 success
  • 1 get measure raw without compensation failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 405 of file driver_sgp41.c.

◆ sgp41_get_measure_test()

uint8_t sgp41_get_measure_test ( sgp41_handle_t * handle,
uint16_t * result )

get the chip measure test

Parameters
[in]*handlepointer to an sgp41 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 463 of file driver_sgp41.c.

◆ sgp41_get_serial_id()

uint8_t sgp41_get_serial_id ( sgp41_handle_t * handle,
uint16_t id[3] )

get the chip serial id

Parameters
[in]*handlepointer to an sgp41 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 579 of file driver_sgp41.c.

◆ sgp41_humidity_convert_to_register()

uint8_t sgp41_humidity_convert_to_register ( sgp41_handle_t * handle,
float rh,
uint16_t * reg )

convert the humidity to the register data

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

Definition at line 235 of file driver_sgp41.c.

◆ sgp41_info()

uint8_t sgp41_info ( sgp41_info_t * info)

get chip information

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

Definition at line 789 of file driver_sgp41.c.

◆ sgp41_init()

uint8_t sgp41_init ( sgp41_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to an sgp41 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 636 of file driver_sgp41.c.

◆ sgp41_soft_reset()

uint8_t sgp41_soft_reset ( sgp41_handle_t * handle)

soft reset the chip

Parameters
[in]*handlepointer to an sgp41 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 506 of file driver_sgp41.c.

◆ sgp41_temperature_convert_to_register()

uint8_t sgp41_temperature_convert_to_register ( sgp41_handle_t * handle,
float temp,
uint16_t * reg )

convert the temperature to the register data

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

Definition at line 263 of file driver_sgp41.c.

◆ sgp41_turn_heater_off()

uint8_t sgp41_turn_heater_off ( sgp41_handle_t * handle)

turn heater off

Parameters
[in]*handlepointer to an sgp41 handle structure
Returns
status code
  • 0 success
  • 1 turn heater off failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 543 of file driver_sgp41.c.