LibDriver STS3X
Loading...
Searching...
No Matches
sts3x base driver function

sts3x base driver modules More...

Collaboration diagram for sts3x base driver function:

Data Structures

struct  sts3x_handle_s
 sts3x handle structure definition More...
struct  sts3x_info_s
 sts3x information structure definition More...

Typedefs

typedef struct sts3x_handle_s sts3x_handle_t
 sts3x handle structure definition
typedef struct sts3x_info_s sts3x_info_t
 sts3x information structure definition

Enumerations

enum  sts3x_address_t { STS3X_ADDRESS_0 = (0x4A << 1) , STS3X_ADDRESS_1 = (0x4B << 1) }
 sts3x address enumeration definition More...
enum  sts3x_bool_t { STS3X_BOOL_FALSE = 0x00 , STS3X_BOOL_TRUE = 0x01 }
 sts3x bool enumeration definition More...
enum  sts3x_rate_t {
  STS3X_RATE_0P5HZ = 0x20 , STS3X_RATE_1HZ = 0x21 , STS3X_RATE_2HZ = 0x22 , STS3X_RATE_4HZ = 0x23 ,
  STS3X_RATE_10HZ = 0x27
}
 sts3x rate enumeration definition More...
enum  sts3x_repeatability_t { STS3X_REPEATABILITY_HIGH = 0x00 , STS3X_REPEATABILITY_MEDIUM = 0x01 , STS3X_REPEATABILITY_LOW = 0x02 }
 sts3x repeatability enumeration definition More...
enum  sts3x_status_t {
  STS3X_STATUS_ALERT_PENDING_STATUS = (1 << 15) , STS3X_STATUS_HEATER_ON = (1 << 13) , STS3X_STATUS_TEMPERATURE_ALERT = (1 << 10) , STS3X_STATUS_SYSTEM_RESET = (1 << 4) ,
  STS3X_STATUS_COMMAND_STATUS = (1 << 1) , STS3X_STATUS_CHECKSUM_STATUS = (1 << 0)
}
 sts3x status enumeration definition More...

Functions

uint8_t sts3x_info (sts3x_info_t *info)
 get chip's information
uint8_t sts3x_set_addr_pin (sts3x_handle_t *handle, sts3x_address_t addr_pin)
 set the iic address pin
uint8_t sts3x_get_addr_pin (sts3x_handle_t *handle, sts3x_address_t *addr_pin)
 get the iic address pin
uint8_t sts3x_init (sts3x_handle_t *handle)
 initialize the chip
uint8_t sts3x_deinit (sts3x_handle_t *handle)
 close the chip
uint8_t sts3x_single_read (sts3x_handle_t *handle, sts3x_bool_t clock_stretching_enable, uint16_t *temperature_raw, float *temperature_s)
 read data once
uint8_t sts3x_start_continuous_read (sts3x_handle_t *handle, sts3x_rate_t rate)
 start reading
uint8_t sts3x_stop_continuous_read (sts3x_handle_t *handle)
 stop reading
uint8_t sts3x_continuous_read (sts3x_handle_t *handle, uint16_t *temperature_raw, float *temperature_s)
 read data continuously
uint8_t sts3x_get_status (sts3x_handle_t *handle, uint16_t *status)
 get the current status
uint8_t sts3x_clear_status (sts3x_handle_t *handle)
 clear the current status
uint8_t sts3x_set_repeatability (sts3x_handle_t *handle, sts3x_repeatability_t repeatability)
 set the measurement repeatability
uint8_t sts3x_get_repeatability (sts3x_handle_t *handle, sts3x_repeatability_t *repeatability)
 get the measurement repeatability
uint8_t sts3x_soft_reset (sts3x_handle_t *handle)
 soft reset the chip
uint8_t sts3x_set_heater (sts3x_handle_t *handle, sts3x_bool_t enable)
 enable or disable the chip heater

Detailed Description

sts3x base driver modules

Typedef Documentation

◆ sts3x_handle_t

sts3x handle structure definition

◆ sts3x_info_t

typedef struct sts3x_info_s sts3x_info_t

sts3x information structure definition

Enumeration Type Documentation

◆ sts3x_address_t

sts3x address enumeration definition

Enumerator
STS3X_ADDRESS_0 

ADDR pin connected to GND

STS3X_ADDRESS_1 

ADDR pin connected to VCC

Definition at line 62 of file driver_sts3x.h.

◆ sts3x_bool_t

sts3x bool enumeration definition

Enumerator
STS3X_BOOL_FALSE 

disable function

STS3X_BOOL_TRUE 

enable function

Definition at line 71 of file driver_sts3x.h.

◆ sts3x_rate_t

sts3x rate enumeration definition

Enumerator
STS3X_RATE_0P5HZ 

0.5Hz sample rate

STS3X_RATE_1HZ 

1Hz sample rate

STS3X_RATE_2HZ 

2Hz sample rate

STS3X_RATE_4HZ 

4Hz sample rate

STS3X_RATE_10HZ 

10Hz sample rate

Definition at line 80 of file driver_sts3x.h.

◆ sts3x_repeatability_t

sts3x repeatability enumeration definition

Enumerator
STS3X_REPEATABILITY_HIGH 

high repeatability

STS3X_REPEATABILITY_MEDIUM 

medium repeatability

STS3X_REPEATABILITY_LOW 

low repeatability

Definition at line 92 of file driver_sts3x.h.

◆ sts3x_status_t

sts3x status enumeration definition

Enumerator
STS3X_STATUS_ALERT_PENDING_STATUS 

alert pending status

STS3X_STATUS_HEATER_ON 

heater on

STS3X_STATUS_TEMPERATURE_ALERT 

temperature alert

STS3X_STATUS_SYSTEM_RESET 

system reset

STS3X_STATUS_COMMAND_STATUS 

command status

STS3X_STATUS_CHECKSUM_STATUS 

checksum status

Definition at line 102 of file driver_sts3x.h.

Function Documentation

◆ sts3x_clear_status()

uint8_t sts3x_clear_status ( sts3x_handle_t * handle)

clear the current status

Parameters
[in]*handlepointer to an sts3x handle structure
Returns
status code
  • 0 success
  • 1 clear status failed
  • 2 handle is NULL
Note
none

Definition at line 346 of file driver_sts3x.c.

◆ sts3x_continuous_read()

uint8_t sts3x_continuous_read ( sts3x_handle_t * handle,
uint16_t * temperature_raw,
float * temperature_s )

read data continuously

Parameters
[in]*handlepointer to an sts3x handle structure
[out]*temperature_rawpointer to a raw temperature buffer
[out]*temperature_spointer to a converted temperature buffer
Returns
status code
  • 0 success
  • 1 continuous read failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 707 of file driver_sts3x.c.

◆ sts3x_deinit()

uint8_t sts3x_deinit ( sts3x_handle_t * handle)

close the chip

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

Definition at line 212 of file driver_sts3x.c.

◆ sts3x_get_addr_pin()

uint8_t sts3x_get_addr_pin ( sts3x_handle_t * handle,
sts3x_address_t * addr_pin )

get the iic address pin

Parameters
[in]*handlepointer to an sts3x handle structure
[out]*addr_pinpointer to a chip iic address pin buffer
Returns
status code
  • 0 success
  • 1 get addr pin failed
  • 2 handle is NULL
Note
none

Definition at line 277 of file driver_sts3x.c.

◆ sts3x_get_repeatability()

uint8_t sts3x_get_repeatability ( sts3x_handle_t * handle,
sts3x_repeatability_t * repeatability )

get the measurement repeatability

Parameters
[in]*handlepointer to an sts3x handle structure
[out]*repeatabilitypointer to a measurement repeatability buffer
Returns
status code
  • 0 success
  • 1 get repeatability failed
  • 2 handle is NULL
Note
none

Definition at line 408 of file driver_sts3x.c.

◆ sts3x_get_status()

uint8_t sts3x_get_status ( sts3x_handle_t * handle,
uint16_t * status )

get the current status

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

Definition at line 299 of file driver_sts3x.c.

◆ sts3x_info()

uint8_t sts3x_info ( sts3x_info_t * info)

get chip's information

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

Definition at line 889 of file driver_sts3x.c.

◆ sts3x_init()

uint8_t sts3x_init ( sts3x_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to an sts3x 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 137 of file driver_sts3x.c.

◆ sts3x_set_addr_pin()

uint8_t sts3x_set_addr_pin ( sts3x_handle_t * handle,
sts3x_address_t addr_pin )

set the iic address pin

Parameters
[in]*handlepointer to an sts3x handle structure
[in]addr_pinchip iic address pin
Returns
status code
  • 0 success
  • 1 set addr pin failed
  • 2 handle is NULL
Note
none

Definition at line 255 of file driver_sts3x.c.

◆ sts3x_set_heater()

uint8_t sts3x_set_heater ( sts3x_handle_t * handle,
sts3x_bool_t enable )

enable or disable the chip heater

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

Definition at line 790 of file driver_sts3x.c.

◆ sts3x_set_repeatability()

uint8_t sts3x_set_repeatability ( sts3x_handle_t * handle,
sts3x_repeatability_t repeatability )

set the measurement repeatability

Parameters
[in]*handlepointer to an sts3x handle structure
[in]repeatabilitymeasurement repeatability
Returns
status code
  • 0 success
  • 1 set repeatability failed
  • 2 handle is NULL
Note
none

Definition at line 382 of file driver_sts3x.c.

◆ sts3x_single_read()

uint8_t sts3x_single_read ( sts3x_handle_t * handle,
sts3x_bool_t clock_stretching_enable,
uint16_t * temperature_raw,
float * temperature_s )

read data once

Parameters
[in]*handlepointer to an sts3x handle structure
[in]clock_stretching_enableclock stretching bool value
[out]*temperature_rawpointer to a raw temperature buffer
[out]*temperature_spointer to a converted temperature buffer
Returns
status code
  • 0 success
  • 1 single read failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 437 of file driver_sts3x.c.

◆ sts3x_soft_reset()

uint8_t sts3x_soft_reset ( sts3x_handle_t * handle)

soft reset the chip

Parameters
[in]*handlepointer to an sts3x 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 752 of file driver_sts3x.c.

◆ sts3x_start_continuous_read()

uint8_t sts3x_start_continuous_read ( sts3x_handle_t * handle,
sts3x_rate_t rate )

start reading

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

Definition at line 541 of file driver_sts3x.c.

◆ sts3x_stop_continuous_read()

uint8_t sts3x_stop_continuous_read ( sts3x_handle_t * handle)

stop reading

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

Definition at line 669 of file driver_sts3x.c.