LibDriver STCC4
Loading...
Searching...
No Matches
stcc4 basic driver function

stcc4 basic driver modules More...

Collaboration diagram for stcc4 basic driver function:

Data Structures

struct  stcc4_handle_s
 stcc4 handle structure definition More...
struct  stcc4_info_s
 stcc4 information structure definition More...

Typedefs

typedef struct stcc4_handle_s stcc4_handle_t
 stcc4 handle structure definition
typedef struct stcc4_info_s stcc4_info_t
 stcc4 information structure definition

Enumerations

enum  stcc4_address_t { STCC4_ADDRESS_0 = (0x64 << 1) , STCC4_ADDRESS_1 = (0x65 << 1) }
 stcc4 address enumeration definition More...
enum  stcc4_bool_t { STCC4_BOOL_FALSE = 0x00 , STCC4_BOOL_TRUE = 0x01 }
 stcc4 bool enumeration definition More...

Functions

uint8_t stcc4_info (stcc4_info_t *info)
 get chip information
uint8_t stcc4_set_address_pin (stcc4_handle_t *handle, stcc4_address_t address)
 set address pin
uint8_t stcc4_get_address_pin (stcc4_handle_t *handle, stcc4_address_t *address)
 get address pin
uint8_t stcc4_init (stcc4_handle_t *handle)
 initialize the chip
uint8_t stcc4_deinit (stcc4_handle_t *handle)
 close the chip
uint8_t stcc4_read (stcc4_handle_t *handle, int16_t *co2_raw, int16_t *co2_ppm, uint16_t *temperature_raw, float *temperature_s, uint16_t *humidity_raw, float *humidity_s, uint16_t *sensor_status)
 read data
uint8_t stcc4_start_continuous_measurement (stcc4_handle_t *handle)
 start continuous measurement
uint8_t stcc4_stop_continuous_measurement (stcc4_handle_t *handle)
 stop continuous measurement
uint8_t stcc4_set_rht_compensation (stcc4_handle_t *handle, uint16_t temperature_raw, uint16_t humidity_raw)
 set rht compensation
uint8_t stcc4_set_pressure_compensation (stcc4_handle_t *handle, uint16_t pressure_raw)
 set pressure compensation
uint8_t stcc4_measure_single_shot (stcc4_handle_t *handle)
 measure single shot
uint8_t stcc4_enter_sleep_mode (stcc4_handle_t *handle)
 enter sleep mode
uint8_t stcc4_exit_sleep_mode (stcc4_handle_t *handle)
 exit sleep mode
uint8_t stcc4_perform_conditioning (stcc4_handle_t *handle)
 perform conditioning
uint8_t stcc4_perform_soft_reset (stcc4_handle_t *handle)
 perform soft reset
uint8_t stcc4_perform_factory_reset (stcc4_handle_t *handle)
 perform factory reset
uint8_t stcc4_perform_self_test (stcc4_handle_t *handle, uint16_t *result)
 perform self test
uint8_t stcc4_enable_testing_mode (stcc4_handle_t *handle)
 enable testing mode
uint8_t stcc4_disable_testing_mode (stcc4_handle_t *handle)
 disable testing mode
uint8_t stcc4_perform_forced_recalibration (stcc4_handle_t *handle, uint16_t target_co2, uint16_t *correct_co2)
 perform forced recalibration
uint8_t stcc4_get_product_id (stcc4_handle_t *handle, uint32_t *product_id, uint8_t unique_serial_number[8])
 get product id
uint8_t stcc4_frc_co2_convert_to_register (stcc4_handle_t *handle, float ppm, uint16_t *reg)
 convert the frc co2 to the register raw data
uint8_t stcc4_frc_co2_convert_to_data (stcc4_handle_t *handle, uint16_t reg, float *ppm)
 convert the register raw data to frc co2 ppm
uint8_t stcc4_humidity_convert_to_register (stcc4_handle_t *handle, float percentage, uint16_t *reg)
 convert the humidity to the register raw data
uint8_t stcc4_humidity_convert_to_data (stcc4_handle_t *handle, uint16_t reg, float *percentage)
 convert the register raw data to humidity
uint8_t stcc4_temperature_convert_to_register (stcc4_handle_t *handle, float deg, uint16_t *reg)
 convert the temperature to the register raw data
uint8_t stcc4_temperature_convert_to_data (stcc4_handle_t *handle, uint16_t reg, float *deg)
 convert the register raw data to temperature
uint8_t stcc4_pressure_convert_to_register (stcc4_handle_t *handle, float pa, uint16_t *reg)
 convert the pressure to the register raw data
uint8_t stcc4_pressure_convert_to_data (stcc4_handle_t *handle, uint16_t reg, float *pa)
 convert the register raw data to pressure

Detailed Description

stcc4 basic driver modules

Typedef Documentation

◆ stcc4_handle_t

stcc4 handle structure definition

◆ stcc4_info_t

typedef struct stcc4_info_s stcc4_info_t

stcc4 information structure definition

Enumeration Type Documentation

◆ stcc4_address_t

stcc4 address enumeration definition

Enumerator
STCC4_ADDRESS_0 

addr pin connected to the GND

STCC4_ADDRESS_1 

addr pin connected to the VCC

Definition at line 62 of file driver_stcc4.h.

◆ stcc4_bool_t

stcc4 bool enumeration definition

Enumerator
STCC4_BOOL_FALSE 

false

STCC4_BOOL_TRUE 

true

Definition at line 71 of file driver_stcc4.h.

Function Documentation

◆ stcc4_deinit()

uint8_t stcc4_deinit ( stcc4_handle_t * handle)

close the chip

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

Definition at line 1049 of file driver_stcc4.c.

◆ stcc4_disable_testing_mode()

uint8_t stcc4_disable_testing_mode ( stcc4_handle_t * handle)

disable testing mode

Parameters
[in]*handlepointer to an stcc4 handle structure
Returns
status code
  • 0 success
  • 1 disable testing mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 719 of file driver_stcc4.c.

◆ stcc4_enable_testing_mode()

uint8_t stcc4_enable_testing_mode ( stcc4_handle_t * handle)

enable testing mode

Parameters
[in]*handlepointer to an stcc4 handle structure
Returns
status code
  • 0 success
  • 1 enable testing mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 685 of file driver_stcc4.c.

◆ stcc4_enter_sleep_mode()

uint8_t stcc4_enter_sleep_mode ( stcc4_handle_t * handle)

enter sleep mode

Parameters
[in]*handlepointer to an stcc4 handle structure
Returns
status code
  • 0 success
  • 1 enter sleep mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 469 of file driver_stcc4.c.

◆ stcc4_exit_sleep_mode()

uint8_t stcc4_exit_sleep_mode ( stcc4_handle_t * handle)

exit sleep mode

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

Definition at line 503 of file driver_stcc4.c.

◆ stcc4_frc_co2_convert_to_data()

uint8_t stcc4_frc_co2_convert_to_data ( stcc4_handle_t * handle,
uint16_t reg,
float * ppm )

convert the register raw data to frc co2 ppm

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

Definition at line 1118 of file driver_stcc4.c.

◆ stcc4_frc_co2_convert_to_register()

uint8_t stcc4_frc_co2_convert_to_register ( stcc4_handle_t * handle,
float ppm,
uint16_t * reg )

convert the frc co2 to the register raw data

Parameters
[in]*handlepointer to a stcc4 handle structure
[in]ppmco2 ppm
[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 1091 of file driver_stcc4.c.

◆ stcc4_get_address_pin()

uint8_t stcc4_get_address_pin ( stcc4_handle_t * handle,
stcc4_address_t * address )

get address pin

Parameters
[in]*handlepointer to a stcc4 handle structure
[out]*addresspointer to an address buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 258 of file driver_stcc4.c.

◆ stcc4_get_product_id()

uint8_t stcc4_get_product_id ( stcc4_handle_t * handle,
uint32_t * product_id,
uint8_t unique_serial_number[8] )

get product id

Parameters
[in]*handlepointer to a stcc4 handle structure
[out]*product_idpointer to a product id buffer
[out]*unique_serial_numberpointer to a unique serial number buffer
Returns
status code
  • 0 success
  • 1 get product id failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 crc check failed
Note
none

Definition at line 806 of file driver_stcc4.c.

◆ stcc4_humidity_convert_to_data()

uint8_t stcc4_humidity_convert_to_data ( stcc4_handle_t * handle,
uint16_t reg,
float * percentage )

convert the register raw data to humidity

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

Definition at line 1172 of file driver_stcc4.c.

◆ stcc4_humidity_convert_to_register()

uint8_t stcc4_humidity_convert_to_register ( stcc4_handle_t * handle,
float percentage,
uint16_t * reg )

convert the humidity to the register raw data

Parameters
[in]*handlepointer to a stcc4 handle structure
[in]percentagehumidity percentage
[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 1145 of file driver_stcc4.c.

◆ stcc4_info()

uint8_t stcc4_info ( stcc4_info_t * info)

get chip information

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

Definition at line 1359 of file driver_stcc4.c.

◆ stcc4_init()

uint8_t stcc4_init ( stcc4_handle_t * handle)

initialize the chip

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

Definition at line 947 of file driver_stcc4.c.

◆ stcc4_measure_single_shot()

uint8_t stcc4_measure_single_shot ( stcc4_handle_t * handle)

measure single shot

Parameters
[in]*handlepointer to an stcc4 handle structure
Returns
status code
  • 0 success
  • 1 measure single shot failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 434 of file driver_stcc4.c.

◆ stcc4_perform_conditioning()

uint8_t stcc4_perform_conditioning ( stcc4_handle_t * handle)

perform conditioning

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

Definition at line 533 of file driver_stcc4.c.

◆ stcc4_perform_factory_reset()

uint8_t stcc4_perform_factory_reset ( stcc4_handle_t * handle)

perform factory reset

Parameters
[in]*handlepointer to an stcc4 handle structure
Returns
status code
  • 0 success
  • 1 perform factory reset failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 not passed
Note
none

Definition at line 598 of file driver_stcc4.c.

◆ stcc4_perform_forced_recalibration()

uint8_t stcc4_perform_forced_recalibration ( stcc4_handle_t * handle,
uint16_t target_co2,
uint16_t * correct_co2 )

perform forced recalibration

Parameters
[in]*handlepointer to a stcc4 handle structure
[in]target_co2input target co2
[out]*correct_co2pointer to a correct co2 buffer
Returns
status code
  • 0 success
  • 1 perform forced recalibration failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 crc check failed
Note
none

Definition at line 756 of file driver_stcc4.c.

◆ stcc4_perform_self_test()

uint8_t stcc4_perform_self_test ( stcc4_handle_t * handle,
uint16_t * result )

perform self test

Parameters
[in]*handlepointer to a stcc4 handle structure
[out]*resultpointer to a result buffer
Returns
status code
  • 0 success
  • 1 perform self test failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 crc check failed
Note
none

Definition at line 643 of file driver_stcc4.c.

◆ stcc4_perform_soft_reset()

uint8_t stcc4_perform_soft_reset ( stcc4_handle_t * handle)

perform soft reset

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

Definition at line 567 of file driver_stcc4.c.

◆ stcc4_pressure_convert_to_data()

uint8_t stcc4_pressure_convert_to_data ( stcc4_handle_t * handle,
uint16_t reg,
float * pa )

convert the register raw data to pressure

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

Definition at line 1280 of file driver_stcc4.c.

◆ stcc4_pressure_convert_to_register()

uint8_t stcc4_pressure_convert_to_register ( stcc4_handle_t * handle,
float pa,
uint16_t * reg )

convert the pressure to the register raw data

Parameters
[in]*handlepointer to a stcc4 handle structure
[in]papressure pascal
[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 1253 of file driver_stcc4.c.

◆ stcc4_read()

uint8_t stcc4_read ( stcc4_handle_t * handle,
int16_t * co2_raw,
int16_t * co2_ppm,
uint16_t * temperature_raw,
float * temperature_s,
uint16_t * humidity_raw,
float * humidity_s,
uint16_t * sensor_status )

read data

Parameters
[in]*handlepointer to a stcc4 handle structure
[out]*co2_rawpointer to a co2 raw buffer
[out]*co2_ppmpointer to a co2 ppm buffer
[out]*temperature_rawpointer to a temperature raw buffer
[out]*temperature_spointer to a temperature buffer
[out]*humidity_rawpointer to a humidity raw buffer
[out]*humidity_spointer to a humidity buffer
[out]*sensor_statuspointer to a sensor status buffer
Returns
status code
  • 0 success
  • 1 read failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 crc is error
  • 5 sensor status is invalid
Note
none

Definition at line 870 of file driver_stcc4.c.

◆ stcc4_set_address_pin()

uint8_t stcc4_set_address_pin ( stcc4_handle_t * handle,
stcc4_address_t address )

set address pin

Parameters
[in]*handlepointer to a stcc4 handle structure
[in]addressaddress pin
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 237 of file driver_stcc4.c.

◆ stcc4_set_pressure_compensation()

uint8_t stcc4_set_pressure_compensation ( stcc4_handle_t * handle,
uint16_t pressure_raw )

set pressure compensation

Parameters
[in]*handlepointer to a stcc4 handle structure
[in]pressure_rawraw pressure
Returns
status code
  • 0 success
  • 1 set pressure compensation failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 395 of file driver_stcc4.c.

◆ stcc4_set_rht_compensation()

uint8_t stcc4_set_rht_compensation ( stcc4_handle_t * handle,
uint16_t temperature_raw,
uint16_t humidity_raw )

set rht compensation

Parameters
[in]*handlepointer to a stcc4 handle structure
[in]temperature_rawraw temperature
[in]humidity_rawraw humidity
Returns
status code
  • 0 success
  • 1 set rht compensation failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 352 of file driver_stcc4.c.

◆ stcc4_start_continuous_measurement()

uint8_t stcc4_start_continuous_measurement ( stcc4_handle_t * handle)

start continuous measurement

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

Definition at line 280 of file driver_stcc4.c.

◆ stcc4_stop_continuous_measurement()

uint8_t stcc4_stop_continuous_measurement ( stcc4_handle_t * handle)

stop continuous measurement

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

Definition at line 315 of file driver_stcc4.c.

◆ stcc4_temperature_convert_to_data()

uint8_t stcc4_temperature_convert_to_data ( stcc4_handle_t * handle,
uint16_t reg,
float * deg )

convert the register raw data to temperature

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

Definition at line 1226 of file driver_stcc4.c.

◆ stcc4_temperature_convert_to_register()

uint8_t stcc4_temperature_convert_to_register ( stcc4_handle_t * handle,
float deg,
uint16_t * reg )

convert the temperature to the register raw data

Parameters
[in]*handlepointer to a stcc4 handle structure
[in]degcelsius degrees
[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 1199 of file driver_stcc4.c.