LibDriver SGP40
Loading...
Searching...
No Matches
sgp40 base driver function

sgp40 base driver modules More...

Collaboration diagram for sgp40 base driver function:

Data Structures

struct  sgp40_handle_s
 sgp40 handle structure definition More...
struct  sgp40_info_s
 sgp40 information structure definition More...

Typedefs

typedef struct sgp40_handle_s sgp40_handle_t
 sgp40 handle structure definition
typedef struct sgp40_info_s sgp40_info_t
 sgp40 information structure definition

Functions

uint8_t sgp40_info (sgp40_info_t *info)
 get chip information
uint8_t sgp40_init (sgp40_handle_t *handle)
 initialize the chip
uint8_t sgp40_deinit (sgp40_handle_t *handle)
 close the chip
uint8_t sgp40_get_measure_raw (sgp40_handle_t *handle, uint16_t raw_humidity, uint16_t raw_temperature, uint16_t *sraw_voc)
 get the measure raw result
uint8_t sgp40_get_measure_raw_without_compensation (sgp40_handle_t *handle, uint16_t *sraw_voc)
 get the measure raw result without compensation
uint8_t sgp40_humidity_convert_to_register (sgp40_handle_t *handle, float rh, uint16_t *reg)
 convert the humidity to the register data
uint8_t sgp40_temperature_convert_to_register (sgp40_handle_t *handle, float temp, uint16_t *reg)
 convert the temperature to the register data
uint8_t sgp40_get_measure_test (sgp40_handle_t *handle, uint16_t *result)
 get the chip measure test
uint8_t sgp40_soft_reset (sgp40_handle_t *handle)
 soft reset the chip
uint8_t sgp40_turn_heater_off (sgp40_handle_t *handle)
 turn heater off
uint8_t sgp40_get_serial_id (sgp40_handle_t *handle, uint16_t id[3])
 get the chip serial id

Detailed Description

sgp40 base driver modules

Typedef Documentation

◆ sgp40_handle_t

sgp40 handle structure definition

◆ sgp40_info_t

typedef struct sgp40_info_s sgp40_info_t

sgp40 information structure definition

Function Documentation

◆ sgp40_deinit()

uint8_t sgp40_deinit ( sgp40_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to an sgp40 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 630 of file driver_sgp40.c.

Here is the call graph for this function:

◆ sgp40_get_measure_raw()

uint8_t sgp40_get_measure_raw ( sgp40_handle_t * handle,
uint16_t raw_humidity,
uint16_t raw_temperature,
uint16_t * sraw_voc )

get the measure raw result

Parameters
[in]*handlepointer to an sgp40 handle structure
[in]raw_humidityhumidity raw data
[in]raw_temperaturetemperature raw data
[out]*sraw_vocpointer to a raw tvoc 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 291 of file driver_sgp40.c.

◆ sgp40_get_measure_raw_without_compensation()

uint8_t sgp40_get_measure_raw_without_compensation ( sgp40_handle_t * handle,
uint16_t * sraw_voc )

get the measure raw result without compensation

Parameters
[in]*handlepointer to an sgp40 handle structure
[out]*sraw_vocpointer to a raw tvoc 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 343 of file driver_sgp40.c.

◆ sgp40_get_measure_test()

uint8_t sgp40_get_measure_test ( sgp40_handle_t * handle,
uint16_t * result )

get the chip measure test

Parameters
[in]*handlepointer to an sgp40 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 394 of file driver_sgp40.c.

◆ sgp40_get_serial_id()

uint8_t sgp40_get_serial_id ( sgp40_handle_t * handle,
uint16_t id[3] )

get the chip serial id

Parameters
[in]*handlepointer to an sgp40 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 510 of file driver_sgp40.c.

◆ sgp40_humidity_convert_to_register()

uint8_t sgp40_humidity_convert_to_register ( sgp40_handle_t * handle,
float rh,
uint16_t * reg )

convert the humidity to the register data

Parameters
[in]*handlepointer to an sgp40 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 234 of file driver_sgp40.c.

◆ sgp40_info()

uint8_t sgp40_info ( sgp40_info_t * info)

get chip information

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

Definition at line 720 of file driver_sgp40.c.

◆ sgp40_init()

uint8_t sgp40_init ( sgp40_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to an sgp40 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 567 of file driver_sgp40.c.

◆ sgp40_soft_reset()

uint8_t sgp40_soft_reset ( sgp40_handle_t * handle)

soft reset the chip

Parameters
[in]*handlepointer to an sgp40 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 437 of file driver_sgp40.c.

◆ sgp40_temperature_convert_to_register()

uint8_t sgp40_temperature_convert_to_register ( sgp40_handle_t * handle,
float temp,
uint16_t * reg )

convert the temperature to the register data

Parameters
[in]*handlepointer to an sgp40 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 262 of file driver_sgp40.c.

◆ sgp40_turn_heater_off()

uint8_t sgp40_turn_heater_off ( sgp40_handle_t * handle)

turn heater off

Parameters
[in]*handlepointer to an sgp40 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 474 of file driver_sgp40.c.