LibDriver STTS22H
Loading...
Searching...
No Matches
stts22h base driver function

stts22h base driver modules More...

Collaboration diagram for stts22h base driver function:

Data Structures

struct  stts22h_handle_s
 stts22h handle structure definition More...
struct  stts22h_info_s
 stts22h information structure definition More...

Typedefs

typedef struct stts22h_handle_s stts22h_handle_t
 stts22h handle structure definition
typedef struct stts22h_info_s stts22h_info_t
 stts22h information structure definition

Enumerations

enum  stts22h_address_t { STTS22H_ADDRESS_VDD = 0x70 , STTS22H_ADDRESS_15K = 0x78 , STTS22H_ADDRESS_56K = 0x7C , STTS22H_ADDRESS_GND = 0x7E }
 stts22h address enumeration definition More...
enum  stts22h_bool_t { STTS22H_BOOL_FALSE = 0x00 , STTS22H_BOOL_TRUE = 0x01 }
 stts22h bool enumeration definition More...
enum  stts22h_output_data_rate_t {
  STTS22H_OUTPUT_DATA_RATE_25HZ = 0x00 , STTS22H_OUTPUT_DATA_RATE_50HZ = 0x01 , STTS22H_OUTPUT_DATA_RATE_100HZ = 0x02 , STTS22H_OUTPUT_DATA_RATE_200HZ = 0x03 ,
  STTS22H_OUTPUT_DATA_RATE_1HZ = 0x04
}
 stts22h output data rate enumeration definition More...
enum  stts22h_status_t { STTS22H_STATUS_UNDER_LOW_LIMIT = (1 << 2) , STTS22H_STATUS_OVER_HIGH_LIMIT = (1 << 1) }
 stts22h status enumeration definition More...

Functions

uint8_t stts22h_info (stts22h_info_t *info)
 get chip's information
uint8_t stts22h_set_addr_pin (stts22h_handle_t *handle, stts22h_address_t addr_pin)
 set the iic address pin
uint8_t stts22h_get_addr_pin (stts22h_handle_t *handle, stts22h_address_t *addr_pin)
 get the iic address pin
uint8_t stts22h_irq_handler (stts22h_handle_t *handle)
 irq handler
uint8_t stts22h_init (stts22h_handle_t *handle)
 initialize the chip
uint8_t stts22h_deinit (stts22h_handle_t *handle)
 close the chip
uint8_t stts22h_single_read (stts22h_handle_t *handle, int16_t *raw, float *celsius_deg)
 read data from the chip once
uint8_t stts22h_start_continuous_read (stts22h_handle_t *handle)
 start the chip reading
uint8_t stts22h_stop_continuous_read (stts22h_handle_t *handle)
 stop the chip reading
uint8_t stts22h_continuous_read (stts22h_handle_t *handle, int16_t *raw, float *celsius_deg)
 read data from the chip continuously
uint8_t stts22h_set_temperature_high_limit (stts22h_handle_t *handle, uint8_t raw)
 set temperature high limit
uint8_t stts22h_get_temperature_high_limit (stts22h_handle_t *handle, uint8_t *raw)
 get temperature high limit
uint8_t stts22h_set_temperature_low_limit (stts22h_handle_t *handle, uint8_t raw)
 set temperature low limit
uint8_t stts22h_get_temperature_low_limit (stts22h_handle_t *handle, uint8_t *raw)
 get temperature low limit
uint8_t stts22h_set_output_data_rate (stts22h_handle_t *handle, stts22h_output_data_rate_t rate)
 set output data rate
uint8_t stts22h_get_output_data_rate (stts22h_handle_t *handle, stts22h_output_data_rate_t *rate)
 get output data rate
uint8_t stts22h_set_block_data_update (stts22h_handle_t *handle, stts22h_bool_t enable)
 enable or disable block data update
uint8_t stts22h_get_block_data_update (stts22h_handle_t *handle, stts22h_bool_t *enable)
 get block data update status
uint8_t stts22h_set_iic_address_auto_increment (stts22h_handle_t *handle, stts22h_bool_t enable)
 enable or disable iic address auto increment
uint8_t stts22h_get_iic_address_auto_increment (stts22h_handle_t *handle, stts22h_bool_t *enable)
 get iic address auto increment status
uint8_t stts22h_set_disable_smbus_timeout (stts22h_handle_t *handle, stts22h_bool_t enable)
 enable or disable disable smbus timeout
uint8_t stts22h_get_disable_smbus_timeout (stts22h_handle_t *handle, stts22h_bool_t *enable)
 get disable smbus timeout status
uint8_t stts22h_get_status (stts22h_handle_t *handle, uint8_t *status)
 get status
uint8_t stts22h_temperature_convert_to_register (stts22h_handle_t *handle, float celsius_deg, uint8_t *reg)
 convert the temperature to the register raw data
uint8_t stts22h_temperature_convert_to_data (stts22h_handle_t *handle, uint8_t reg, float *celsius_deg)
 convert the register raw data to the temperature

Detailed Description

stts22h base driver modules

Typedef Documentation

◆ stts22h_handle_t

stts22h handle structure definition

◆ stts22h_info_t

stts22h information structure definition

Enumeration Type Documentation

◆ stts22h_address_t

stts22h address enumeration definition

Enumerator
STTS22H_ADDRESS_VDD 

addr pin connected to the VDD

STTS22H_ADDRESS_15K 

addr pin connected to the 15K pull-up resistor

STTS22H_ADDRESS_56K 

addr pin connected to the 56K pull-up resistor

STTS22H_ADDRESS_GND 

addr pin connected to the GND

Definition at line 62 of file driver_stts22h.h.

◆ stts22h_bool_t

stts22h bool enumeration definition

Enumerator
STTS22H_BOOL_FALSE 

false

STTS22H_BOOL_TRUE 

true

Definition at line 73 of file driver_stts22h.h.

◆ stts22h_output_data_rate_t

stts22h output data rate enumeration definition

Enumerator
STTS22H_OUTPUT_DATA_RATE_25HZ 

25hz

STTS22H_OUTPUT_DATA_RATE_50HZ 

50hz

STTS22H_OUTPUT_DATA_RATE_100HZ 

100hz

STTS22H_OUTPUT_DATA_RATE_200HZ 

200hz

STTS22H_OUTPUT_DATA_RATE_1HZ 

1hz

Definition at line 82 of file driver_stts22h.h.

◆ stts22h_status_t

stts22h status enumeration definition

Enumerator
STTS22H_STATUS_UNDER_LOW_LIMIT 

under low limit

STTS22H_STATUS_OVER_HIGH_LIMIT 

over high limit

Definition at line 94 of file driver_stts22h.h.

Function Documentation

◆ stts22h_continuous_read()

uint8_t stts22h_continuous_read ( stts22h_handle_t * handle,
int16_t * raw,
float * celsius_deg )

read data from the chip continuously

Parameters
[in]*handlepointer to a stts22h handle structure
[out]*rawpointer to a raw adc buffer
[out]*celsius_degpointer to a celsius degrees buffer
Returns
status code
  • 0 success
  • 1 continuous read failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
this function can be used only after run stts22h_start_continuous_read and can be stopped by stts22h_stop_continuous_read

Definition at line 891 of file driver_stts22h.c.

◆ stts22h_deinit()

uint8_t stts22h_deinit ( stts22h_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to a stts22h handle structure
Returns
status code
  • 0 success
  • 1 iic deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 power down failed
Note
none

Definition at line 1141 of file driver_stts22h.c.

◆ stts22h_get_addr_pin()

uint8_t stts22h_get_addr_pin ( stts22h_handle_t * handle,
stts22h_address_t * addr_pin )

get the iic address pin

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

Definition at line 164 of file driver_stts22h.c.

◆ stts22h_get_block_data_update()

uint8_t stts22h_get_block_data_update ( stts22h_handle_t * handle,
stts22h_bool_t * enable )

get block data update status

Parameters
[in]*handlepointer to a stts22h handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get block data update failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 478 of file driver_stts22h.c.

◆ stts22h_get_disable_smbus_timeout()

uint8_t stts22h_get_disable_smbus_timeout ( stts22h_handle_t * handle,
stts22h_bool_t * enable )

get disable smbus timeout status

Parameters
[in]*handlepointer to a stts22h handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get disable smbus timeout failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 643 of file driver_stts22h.c.

◆ stts22h_get_iic_address_auto_increment()

uint8_t stts22h_get_iic_address_auto_increment ( stts22h_handle_t * handle,
stts22h_bool_t * enable )

get iic address auto increment status

Parameters
[in]*handlepointer to a stts22h handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get iic address auto increment failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 561 of file driver_stts22h.c.

◆ stts22h_get_output_data_rate()

uint8_t stts22h_get_output_data_rate ( stts22h_handle_t * handle,
stts22h_output_data_rate_t * rate )

get output data rate

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

Definition at line 388 of file driver_stts22h.c.

◆ stts22h_get_status()

uint8_t stts22h_get_status ( stts22h_handle_t * handle,
uint8_t * status )

get status

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

Definition at line 680 of file driver_stts22h.c.

◆ stts22h_get_temperature_high_limit()

uint8_t stts22h_get_temperature_high_limit ( stts22h_handle_t * handle,
uint8_t * raw )

get temperature high limit

Parameters
[in]*handlepointer to a stts22h handle structure
[out]*rawpointer to a raw data buffer
Returns
status code
  • 0 success
  • 1 get temperature high limit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 224 of file driver_stts22h.c.

◆ stts22h_get_temperature_low_limit()

uint8_t stts22h_get_temperature_low_limit ( stts22h_handle_t * handle,
uint8_t * raw )

get temperature low limit

Parameters
[in]*handlepointer to a stts22h handle structure
[out]*rawpointer to a raw data buffer
Returns
status code
  • 0 success
  • 1 get temperature low limit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 298 of file driver_stts22h.c.

◆ stts22h_info()

uint8_t stts22h_info ( stts22h_info_t * info)

get chip's information

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

Definition at line 1246 of file driver_stts22h.c.

◆ stts22h_init()

uint8_t stts22h_init ( stts22h_handle_t * handle)

initialize the chip

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

Definition at line 1032 of file driver_stts22h.c.

◆ stts22h_irq_handler()

uint8_t stts22h_irq_handler ( stts22h_handle_t * handle)

irq handler

Parameters
[in]*handlepointer to a stts22h handle structure
Returns
status code
  • 0 success
  • 1 run failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 928 of file driver_stts22h.c.

◆ stts22h_set_addr_pin()

uint8_t stts22h_set_addr_pin ( stts22h_handle_t * handle,
stts22h_address_t addr_pin )

set the iic address pin

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

Definition at line 143 of file driver_stts22h.c.

◆ stts22h_set_block_data_update()

uint8_t stts22h_set_block_data_update ( stts22h_handle_t * handle,
stts22h_bool_t enable )

enable or disable block data update

Parameters
[in]*handlepointer to a stts22h handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set block data update failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 433 of file driver_stts22h.c.

◆ stts22h_set_disable_smbus_timeout()

uint8_t stts22h_set_disable_smbus_timeout ( stts22h_handle_t * handle,
stts22h_bool_t enable )

enable or disable disable smbus timeout

Parameters
[in]*handlepointer to a stts22h handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set disable smbus timeout failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 598 of file driver_stts22h.c.

◆ stts22h_set_iic_address_auto_increment()

uint8_t stts22h_set_iic_address_auto_increment ( stts22h_handle_t * handle,
stts22h_bool_t enable )

enable or disable iic address auto increment

Parameters
[in]*handlepointer to a stts22h handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set iic address auto increment failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 515 of file driver_stts22h.c.

◆ stts22h_set_output_data_rate()

uint8_t stts22h_set_output_data_rate ( stts22h_handle_t * handle,
stts22h_output_data_rate_t rate )

set output data rate

Parameters
[in]*handlepointer to a stts22h handle structure
[in]rateoutput data rate
Returns
status code
  • 0 success
  • 1 set output data rate failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 335 of file driver_stts22h.c.

◆ stts22h_set_temperature_high_limit()

uint8_t stts22h_set_temperature_high_limit ( stts22h_handle_t * handle,
uint8_t raw )

set temperature high limit

Parameters
[in]*handlepointer to a stts22h handle structure
[in]rawraw data
Returns
status code
  • 0 success
  • 1 set temperature high limit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 187 of file driver_stts22h.c.

◆ stts22h_set_temperature_low_limit()

uint8_t stts22h_set_temperature_low_limit ( stts22h_handle_t * handle,
uint8_t raw )

set temperature low limit

Parameters
[in]*handlepointer to a stts22h handle structure
[in]rawraw data
Returns
status code
  • 0 success
  • 1 set temperature low limit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 261 of file driver_stts22h.c.

◆ stts22h_single_read()

uint8_t stts22h_single_read ( stts22h_handle_t * handle,
int16_t * raw,
float * celsius_deg )

read data from the chip once

Parameters
[in]*handlepointer to a stts22h handle structure
[out]*rawpointer to a raw adc buffer
[out]*celsius_degpointer to a celsius degrees buffer
Returns
status code
  • 0 success
  • 1 single read failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 read timeout
Note
none

Definition at line 719 of file driver_stts22h.c.

◆ stts22h_start_continuous_read()

uint8_t stts22h_start_continuous_read ( stts22h_handle_t * handle)

start the chip reading

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

Definition at line 800 of file driver_stts22h.c.

◆ stts22h_stop_continuous_read()

uint8_t stts22h_stop_continuous_read ( stts22h_handle_t * handle)

stop the chip reading

Parameters
[in]*handlepointer to a stts22h 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 844 of file driver_stts22h.c.

◆ stts22h_temperature_convert_to_data()

uint8_t stts22h_temperature_convert_to_data ( stts22h_handle_t * handle,
uint8_t reg,
float * celsius_deg )

convert the register raw data to the temperature

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

Definition at line 1005 of file driver_stts22h.c.

◆ stts22h_temperature_convert_to_register()

uint8_t stts22h_temperature_convert_to_register ( stts22h_handle_t * handle,
float celsius_deg,
uint8_t * reg )

convert the temperature to the register raw data

Parameters
[in]*handlepointer to a stts22h handle structure
[in]celsius_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 978 of file driver_stts22h.c.