LibDriver SCD30
Loading...
Searching...
No Matches
scd30 basic driver function

scd30 basic driver modules More...

Collaboration diagram for scd30 basic driver function:

Data Structures

struct  scd30_handle_s
 scd30 handle structure definition More...
struct  scd30_data_s
 scd30 data structure definition More...
struct  scd30_info_s
 scd30 information structure definition More...

Typedefs

typedef struct scd30_handle_s scd30_handle_t
 scd30 handle structure definition
typedef struct scd30_data_s scd30_data_t
 scd30 data structure definition
typedef struct scd30_info_s scd30_info_t
 scd30 information structure definition

Enumerations

enum  scd30_interface_t { SCD30_INTERFACE_IIC = 0x00 , SCD30_INTERFACE_UART = 0x01 }
 scd30 interface enumeration definition More...
enum  scd30_bool_t { SCD30_BOOL_FALSE = 0x0000 , SCD30_BOOL_TRUE = 0x0001 }
 scd30 bool enumeration definition More...

Functions

uint8_t scd30_info (scd30_info_t *info)
 get chip information
uint8_t scd30_set_interface (scd30_handle_t *handle, scd30_interface_t interface)
 set the chip interface
uint8_t scd30_get_interface (scd30_handle_t *handle, scd30_interface_t *interface)
 get the chip interface
uint8_t scd30_init (scd30_handle_t *handle)
 initialize the chip
uint8_t scd30_deinit (scd30_handle_t *handle)
 close the chip
uint8_t scd30_read (scd30_handle_t *handle, scd30_data_t *data)
 read the result
uint8_t scd30_start_measurement_with_pressure_compensation (scd30_handle_t *handle, uint16_t mbar)
 start the measurement with pressure compensation
uint8_t scd30_start_measurement (scd30_handle_t *handle)
 start the measurement
uint8_t scd30_stop_measurement (scd30_handle_t *handle)
 stop the measurement
uint8_t scd30_set_measurement_interval (scd30_handle_t *handle, uint16_t second)
 set the measurement interval
uint8_t scd30_get_measurement_interval (scd30_handle_t *handle, uint16_t *second)
 get the measurement interval
uint8_t scd30_get_data_ready_status (scd30_handle_t *handle, uint16_t *status)
 get data ready status
uint8_t scd30_set_automatic_self_calibration (scd30_handle_t *handle, scd30_bool_t enable)
 set automatic self calibration
uint8_t scd30_get_automatic_self_calibration (scd30_handle_t *handle, scd30_bool_t *enable)
 get automatic self calibration
uint8_t scd30_set_forced_recalibration (scd30_handle_t *handle, uint16_t co2_ppm)
 set forced recalibration
uint8_t scd30_get_forced_recalibration (scd30_handle_t *handle, uint16_t *co2_ppm)
 get forced recalibration
uint8_t scd30_set_temperature_offset (scd30_handle_t *handle, uint16_t deg)
 set temperature offset
uint8_t scd30_get_temperature_offset (scd30_handle_t *handle, uint16_t *deg)
 get temperature offset
uint8_t scd30_temperature_offset_convert_to_register (scd30_handle_t *handle, float deg, uint16_t *reg)
 convert the temperature offset to the register raw data
uint8_t scd30_temperature_offset_convert_to_data (scd30_handle_t *handle, uint16_t reg, float *deg)
 convert the register raw data to the temperature offset
uint8_t scd30_set_altitude_compensation (scd30_handle_t *handle, uint16_t m)
 set altitude compensation
uint8_t scd30_get_altitude_compensation (scd30_handle_t *handle, uint16_t *m)
 get altitude compensation
uint8_t scd30_get_firmware_version (scd30_handle_t *handle, uint16_t *version)
 get firmware version
uint8_t scd30_soft_reset (scd30_handle_t *handle)
 soft reset

Detailed Description

scd30 basic driver modules

Typedef Documentation

◆ scd30_data_t

typedef struct scd30_data_s scd30_data_t

scd30 data structure definition

◆ scd30_handle_t

scd30 handle structure definition

◆ scd30_info_t

typedef struct scd30_info_s scd30_info_t

scd30 information structure definition

Enumeration Type Documentation

◆ scd30_bool_t

scd30 bool enumeration definition

Enumerator
SCD30_BOOL_FALSE 

false

SCD30_BOOL_TRUE 

true

Definition at line 71 of file driver_scd30.h.

◆ scd30_interface_t

scd30 interface enumeration definition

Enumerator
SCD30_INTERFACE_IIC 

iic interface

SCD30_INTERFACE_UART 

uart interface

Definition at line 62 of file driver_scd30.h.

Function Documentation

◆ scd30_deinit()

uint8_t scd30_deinit ( scd30_handle_t * handle)

close the chip

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

Definition at line 2220 of file driver_scd30.c.

◆ scd30_get_altitude_compensation()

uint8_t scd30_get_altitude_compensation ( scd30_handle_t * handle,
uint16_t * m )

get altitude compensation

Parameters
[in]*handlepointer to an scd30 handle structure
[out]*mpointer to a meter buffer
Returns
status code
  • 0 success
  • 1 get altitude compensation failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1620 of file driver_scd30.c.

◆ scd30_get_automatic_self_calibration()

uint8_t scd30_get_automatic_self_calibration ( scd30_handle_t * handle,
scd30_bool_t * enable )

get automatic self calibration

Parameters
[in]*handlepointer to an scd30 handle structure
[out]*enablepointer to a bool buffer
Returns
status code
  • 0 success
  • 1 get automatic self calibration failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1028 of file driver_scd30.c.

◆ scd30_get_data_ready_status()

uint8_t scd30_get_data_ready_status ( scd30_handle_t * handle,
uint16_t * status )

get data ready status

Parameters
[in]*handlepointer to an scd30 handle structure
[out]*statuspointer to a status buffer
Returns
status code
  • 0 success
  • 1 get data ready status failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 851 of file driver_scd30.c.

◆ scd30_get_firmware_version()

uint8_t scd30_get_firmware_version ( scd30_handle_t * handle,
uint16_t * version )

get firmware version

Parameters
[in]*handlepointer to an scd30 handle structure
[out]*versionpointer to a version buffer
Returns
status code
  • 0 success
  • 1 get firmware version failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1717 of file driver_scd30.c.

◆ scd30_get_forced_recalibration()

uint8_t scd30_get_forced_recalibration ( scd30_handle_t * handle,
uint16_t * co2_ppm )

get forced recalibration

Parameters
[in]*handlepointer to an scd30 handle structure
[out]*co2_ppmpointer to a co2 ppm buffer
Returns
status code
  • 0 success
  • 1 get forced recalibration failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1212 of file driver_scd30.c.

◆ scd30_get_interface()

uint8_t scd30_get_interface ( scd30_handle_t * handle,
scd30_interface_t * interface )

get the chip interface

Parameters
[in]*handlepointer to an scd30 handle structure
[out]*interfacepointer to a chip interface buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 404 of file driver_scd30.c.

◆ scd30_get_measurement_interval()

uint8_t scd30_get_measurement_interval ( scd30_handle_t * handle,
uint16_t * second )

get the measurement interval

Parameters
[in]*handlepointer to an scd30 handle structure
[out]*secondpointer to a second buffer
Returns
status code
  • 0 success
  • 1 get measurement interval failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 754 of file driver_scd30.c.

◆ scd30_get_temperature_offset()

uint8_t scd30_get_temperature_offset ( scd30_handle_t * handle,
uint16_t * deg )

get temperature offset

Parameters
[in]*handlepointer to an scd30 handle structure
[out]*degpointer to a degree buffer
Returns
status code
  • 0 success
  • 1 get temperature offset failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1389 of file driver_scd30.c.

◆ scd30_info()

uint8_t scd30_info ( scd30_info_t * info)

get chip information

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

Definition at line 2414 of file driver_scd30.c.

◆ scd30_init()

uint8_t scd30_init ( scd30_handle_t * handle)

initialize the chip

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

Definition at line 2070 of file driver_scd30.c.

◆ scd30_read()

uint8_t scd30_read ( scd30_handle_t * handle,
scd30_data_t * data )

read the result

Parameters
[in]*handlepointer to an scd30 handle structure
[out]*datapointer to an scd30 data structure
Returns
status code
  • 0 success
  • 1 read failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 read timeout
Note
none

Definition at line 1890 of file driver_scd30.c.

◆ scd30_set_altitude_compensation()

uint8_t scd30_set_altitude_compensation ( scd30_handle_t * handle,
uint16_t m )

set altitude compensation

Parameters
[in]*handlepointer to an scd30 handle structure
[in]mset meter
Returns
status code
  • 0 success
  • 1 set altitude compensation failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1540 of file driver_scd30.c.

◆ scd30_set_automatic_self_calibration()

uint8_t scd30_set_automatic_self_calibration ( scd30_handle_t * handle,
scd30_bool_t enable )

set automatic self calibration

Parameters
[in]*handlepointer to an scd30 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set automatic self calibration failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 948 of file driver_scd30.c.

◆ scd30_set_forced_recalibration()

uint8_t scd30_set_forced_recalibration ( scd30_handle_t * handle,
uint16_t co2_ppm )

set forced recalibration

Parameters
[in]*handlepointer to an scd30 handle structure
[in]co2_ppmset co2 ppm
Returns
status code
  • 0 success
  • 1 set forced recalibration failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 co2_ppm is invalid
Note
400 <= co2_ppm <= 2000

Definition at line 1126 of file driver_scd30.c.

◆ scd30_set_interface()

uint8_t scd30_set_interface ( scd30_handle_t * handle,
scd30_interface_t interface )

set the chip interface

Parameters
[in]*handlepointer to an scd30 handle structure
[in]interfacechip interface
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 383 of file driver_scd30.c.

◆ scd30_set_measurement_interval()

uint8_t scd30_set_measurement_interval ( scd30_handle_t * handle,
uint16_t second )

set the measurement interval

Parameters
[in]*handlepointer to an scd30 handle structure
[in]secondset interval
Returns
status code
  • 0 success
  • 1 set measurement interval failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 second is invalid
Note
2 <= second <= 1800

Definition at line 668 of file driver_scd30.c.

◆ scd30_set_temperature_offset()

uint8_t scd30_set_temperature_offset ( scd30_handle_t * handle,
uint16_t deg )

set temperature offset

Parameters
[in]*handlepointer to an scd30 handle structure
[in]degset degree
Returns
status code
  • 0 success
  • 1 set temperature offset failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1309 of file driver_scd30.c.

◆ scd30_soft_reset()

uint8_t scd30_soft_reset ( scd30_handle_t * handle)

soft reset

Parameters
[in]*handlepointer to an scd30 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 1813 of file driver_scd30.c.

◆ scd30_start_measurement()

uint8_t scd30_start_measurement ( scd30_handle_t * handle)

start the measurement

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

Definition at line 513 of file driver_scd30.c.

◆ scd30_start_measurement_with_pressure_compensation()

uint8_t scd30_start_measurement_with_pressure_compensation ( scd30_handle_t * handle,
uint16_t mbar )

start the measurement with pressure compensation

Parameters
[in]*handlepointer to an scd30 handle structure
[in]mbarambient pressure compensation
Returns
status code
  • 0 success
  • 1 start measurement failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 mbar is invalid
Note
700 <= mbar <= 1400

Definition at line 428 of file driver_scd30.c.

◆ scd30_stop_measurement()

uint8_t scd30_stop_measurement ( scd30_handle_t * handle)

stop the measurement

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

Definition at line 592 of file driver_scd30.c.

◆ scd30_temperature_offset_convert_to_data()

uint8_t scd30_temperature_offset_convert_to_data ( scd30_handle_t * handle,
uint16_t reg,
float * deg )

convert the register raw data to the temperature offset

Parameters
[in]*handlepointer to an scd30 handle structure
[in]regregister raw data
[out]*degpointer to a degree buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1513 of file driver_scd30.c.

◆ scd30_temperature_offset_convert_to_register()

uint8_t scd30_temperature_offset_convert_to_register ( scd30_handle_t * handle,
float deg,
uint16_t * reg )

convert the temperature offset to the register raw data

Parameters
[in]*handlepointer to an scd30 handle structure
[in]degdegree
[out]*regpointer to a register raw buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1486 of file driver_scd30.c.