LibDriver SHT30
Loading...
Searching...
No Matches
sht30 base driver function

sht30 base driver modules More...

Collaboration diagram for sht30 base driver function:

Data Structures

struct  sht30_handle_s
 sht30 handle structure definition More...
struct  sht30_info_s
 sht30 information structure definition More...

Typedefs

typedef struct sht30_handle_s sht30_handle_t
 sht30 handle structure definition
typedef struct sht30_info_s sht30_info_t
 sht30 information structure definition

Enumerations

enum  sht30_address_t { SHT30_ADDRESS_0 = (0x44 << 1) , SHT30_ADDRESS_1 = (0x45 << 1) }
 sht30 address enumeration definition More...
enum  sht30_bool_t { SHT30_BOOL_FALSE = 0x00 , SHT30_BOOL_TRUE = 0x01 }
 sht30 bool enumeration definition More...
enum  sht30_rate_t {
  SHT30_RATE_0P5HZ = 0x20 , SHT30_RATE_1HZ = 0x21 , SHT30_RATE_2HZ = 0x22 , SHT30_RATE_4HZ = 0x23 ,
  SHT30_RATE_10HZ = 0x27
}
 sht30 rate enumeration definition More...
enum  sht30_repeatability_t { SHT30_REPEATABILITY_HIGH = 0x00 , SHT30_REPEATABILITY_MEDIUM = 0x01 , SHT30_REPEATABILITY_LOW = 0x02 }
 sht30 repeatability enumeration definition More...
enum  sht30_status_t {
  SHT30_STATUS_ALERT_PENDING_STATUS = (1 << 15) , SHT30_STATUS_HEATER_ON = (1 << 13) , SHT30_STATUS_HUMIDITY_ALERT = (1 << 11) , SHT30_STATUS_TEMPERATURE_ALERT = (1 << 10) ,
  SHT30_STATUS_SYSTEM_RESET = (1 << 4) , SHT30_STATUS_COMMAND_STATUS = (1 << 1) , SHT30_STATUS_CHECKSUM_STATUS = (1 << 0)
}
 sht30 status enumeration definition More...

Functions

uint8_t sht30_info (sht30_info_t *info)
 get chip's information
uint8_t sht30_set_addr_pin (sht30_handle_t *handle, sht30_address_t addr_pin)
 set the iic address pin
uint8_t sht30_get_addr_pin (sht30_handle_t *handle, sht30_address_t *addr_pin)
 get the iic address pin
uint8_t sht30_irq_handler (sht30_handle_t *handle)
 irq handler
uint8_t sht30_init (sht30_handle_t *handle)
 initialize the chip
uint8_t sht30_deinit (sht30_handle_t *handle)
 close the chip
uint8_t sht30_single_read (sht30_handle_t *handle, sht30_bool_t clock_stretching_enable, uint16_t *temperature_raw, float *temperature_s, uint16_t *humidity_raw, float *humidity_s)
 read data once
uint8_t sht30_start_continuous_read (sht30_handle_t *handle, sht30_rate_t rate)
 start reading
uint8_t sht30_stop_continuous_read (sht30_handle_t *handle)
 stop reading
uint8_t sht30_continuous_read (sht30_handle_t *handle, uint16_t *temperature_raw, float *temperature_s, uint16_t *humidity_raw, float *humidity_s)
 read data continuously
uint8_t sht30_get_status (sht30_handle_t *handle, uint16_t *status)
 get the current status
uint8_t sht30_clear_status (sht30_handle_t *handle)
 clear the current status
uint8_t sht30_set_repeatability (sht30_handle_t *handle, sht30_repeatability_t repeatability)
 set the measurement repeatability
uint8_t sht30_get_repeatability (sht30_handle_t *handle, sht30_repeatability_t *repeatability)
 get the measurement repeatability
uint8_t sht30_set_art (sht30_handle_t *handle)
 set the chip art
uint8_t sht30_soft_reset (sht30_handle_t *handle)
 soft reset the chip
uint8_t sht30_set_heater (sht30_handle_t *handle, sht30_bool_t enable)
 enable or disable the chip heater
uint8_t sht30_get_serial_number (sht30_handle_t *handle, uint8_t sn[4])
 get serial number
uint8_t sht30_set_high_alert_limit (sht30_handle_t *handle, uint16_t set, uint16_t clear)
 set high alert limit
uint8_t sht30_get_high_alert_limit (sht30_handle_t *handle, uint16_t *set, uint16_t *clear)
 get high alert limit
uint8_t sht30_set_low_alert_limit (sht30_handle_t *handle, uint16_t set, uint16_t clear)
 set low alert limit
uint8_t sht30_get_low_alert_limit (sht30_handle_t *handle, uint16_t *set, uint16_t *clear)
 get low alert limit
uint8_t sht30_alert_limit_convert_to_register (sht30_handle_t *handle, float temperature, float humidity, uint16_t *reg)
 alert limit convert to register raw data

Detailed Description

sht30 base driver modules

Typedef Documentation

◆ sht30_handle_t

sht30 handle structure definition

◆ sht30_info_t

typedef struct sht30_info_s sht30_info_t

sht30 information structure definition

Enumeration Type Documentation

◆ sht30_address_t

sht30 address enumeration definition

Enumerator
SHT30_ADDRESS_0 

ADDR pin connected to GND

SHT30_ADDRESS_1 

ADDR pin connected to VCC

Definition at line 63 of file driver_sht30.h.

◆ sht30_bool_t

sht30 bool enumeration definition

Enumerator
SHT30_BOOL_FALSE 

disable function

SHT30_BOOL_TRUE 

enable function

Definition at line 72 of file driver_sht30.h.

◆ sht30_rate_t

sht30 rate enumeration definition

Enumerator
SHT30_RATE_0P5HZ 

0.5Hz sample rate

SHT30_RATE_1HZ 

1Hz sample rate

SHT30_RATE_2HZ 

2Hz sample rate

SHT30_RATE_4HZ 

4Hz sample rate

SHT30_RATE_10HZ 

10Hz sample rate

Definition at line 81 of file driver_sht30.h.

◆ sht30_repeatability_t

sht30 repeatability enumeration definition

Enumerator
SHT30_REPEATABILITY_HIGH 

high repeatability

SHT30_REPEATABILITY_MEDIUM 

medium repeatability

SHT30_REPEATABILITY_LOW 

low repeatability

Definition at line 93 of file driver_sht30.h.

◆ sht30_status_t

sht30 status enumeration definition

Enumerator
SHT30_STATUS_ALERT_PENDING_STATUS 

alert pending status

SHT30_STATUS_HEATER_ON 

heater on

SHT30_STATUS_HUMIDITY_ALERT 

humidity alert

SHT30_STATUS_TEMPERATURE_ALERT 

temperature alert

SHT30_STATUS_SYSTEM_RESET 

system reset

SHT30_STATUS_COMMAND_STATUS 

command status

SHT30_STATUS_CHECKSUM_STATUS 

checksum status

Definition at line 103 of file driver_sht30.h.

Function Documentation

◆ sht30_alert_limit_convert_to_register()

uint8_t sht30_alert_limit_convert_to_register ( sht30_handle_t * handle,
float temperature,
float humidity,
uint16_t * reg )

alert limit convert to register raw data

Parameters
[in]*handlepointer to an sht30 handle structure
[in]temperatureconverted temperature
[in]humidityconverted humidity
[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 1225 of file driver_sht30.c.

◆ sht30_clear_status()

uint8_t sht30_clear_status ( sht30_handle_t * handle)

clear the current status

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

Definition at line 385 of file driver_sht30.c.

◆ sht30_continuous_read()

uint8_t sht30_continuous_read ( sht30_handle_t * handle,
uint16_t * temperature_raw,
float * temperature_s,
uint16_t * humidity_raw,
float * humidity_s )

read data continuously

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

Definition at line 760 of file driver_sht30.c.

◆ sht30_deinit()

uint8_t sht30_deinit ( sht30_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to an sht30 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 249 of file driver_sht30.c.

◆ sht30_get_addr_pin()

uint8_t sht30_get_addr_pin ( sht30_handle_t * handle,
sht30_address_t * addr_pin )

get the iic address pin

Parameters
[in]*handlepointer to an sht30 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 314 of file driver_sht30.c.

◆ sht30_get_high_alert_limit()

uint8_t sht30_get_high_alert_limit ( sht30_handle_t * handle,
uint16_t * set,
uint16_t * clear )

get high alert limit

Parameters
[in]*handlepointer to an sht30 handle structure
[out]*setpointer to a high alert limit set buffer
[out]*clearpointer to a high alert limit clear buffer
Returns
status code
  • 0 success
  • 1 get high alert limit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1047 of file driver_sht30.c.

◆ sht30_get_low_alert_limit()

uint8_t sht30_get_low_alert_limit ( sht30_handle_t * handle,
uint16_t * set,
uint16_t * clear )

get low alert limit

Parameters
[in]*handlepointer to an sht30 handle structure
[out]*setpointer to a low alert limit set buffer
[out]*clearpointer to a low alert limit clear buffer
Returns
status code
  • 0 success
  • 1 get low alert limit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1163 of file driver_sht30.c.

◆ sht30_get_repeatability()

uint8_t sht30_get_repeatability ( sht30_handle_t * handle,
sht30_repeatability_t * repeatability )

get the measurement repeatability

Parameters
[in]*handlepointer to an sht30 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 447 of file driver_sht30.c.

◆ sht30_get_serial_number()

uint8_t sht30_get_serial_number ( sht30_handle_t * handle,
uint8_t sn[4] )

get serial number

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

Definition at line 938 of file driver_sht30.c.

◆ sht30_get_status()

uint8_t sht30_get_status ( sht30_handle_t * handle,
uint16_t * status )

get the current status

Parameters
[in]*handlepointer to an sht30 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 337 of file driver_sht30.c.

◆ sht30_info()

uint8_t sht30_info ( sht30_info_t * info)

get chip's information

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

Definition at line 1387 of file driver_sht30.c.

◆ sht30_init()

uint8_t sht30_init ( sht30_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to an sht30 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 175 of file driver_sht30.c.

◆ sht30_irq_handler()

uint8_t sht30_irq_handler ( sht30_handle_t * handle)

irq handler

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

Definition at line 1258 of file driver_sht30.c.

◆ sht30_set_addr_pin()

uint8_t sht30_set_addr_pin ( sht30_handle_t * handle,
sht30_address_t addr_pin )

set the iic address pin

Parameters
[in]*handlepointer to an sht30 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 292 of file driver_sht30.c.

◆ sht30_set_art()

uint8_t sht30_set_art ( sht30_handle_t * handle)

set the chip art

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

Definition at line 815 of file driver_sht30.c.

◆ sht30_set_heater()

uint8_t sht30_set_heater ( sht30_handle_t * handle,
sht30_bool_t enable )

enable or disable the chip heater

Parameters
[in]*handlepointer to an sht30 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 888 of file driver_sht30.c.

◆ sht30_set_high_alert_limit()

uint8_t sht30_set_high_alert_limit ( sht30_handle_t * handle,
uint16_t set,
uint16_t clear )

set high alert limit

Parameters
[in]*handlepointer to an sht30 handle structure
[in]sethigh alert limit set
[in]clearhigh alert limit clear
Returns
status code
  • 0 success
  • 1 set high alert limit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 993 of file driver_sht30.c.

◆ sht30_set_low_alert_limit()

uint8_t sht30_set_low_alert_limit ( sht30_handle_t * handle,
uint16_t set,
uint16_t clear )

set low alert limit

Parameters
[in]*handlepointer to an sht30 handle structure
[in]setlow alert limit set
[in]clearlow alert limit clear
Returns
status code
  • 0 success
  • 1 set low alert limit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1109 of file driver_sht30.c.

◆ sht30_set_repeatability()

uint8_t sht30_set_repeatability ( sht30_handle_t * handle,
sht30_repeatability_t repeatability )

set the measurement repeatability

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

Definition at line 421 of file driver_sht30.c.

◆ sht30_single_read()

uint8_t sht30_single_read ( sht30_handle_t * handle,
sht30_bool_t clock_stretching_enable,
uint16_t * temperature_raw,
float * temperature_s,
uint16_t * humidity_raw,
float * humidity_s )

read data once

Parameters
[in]*handlepointer to an sht30 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
[out]*humidity_rawpointer to a raw humidity buffer
[out]*humidity_spointer to a converted humidity buffer
Returns
status code
  • 0 success
  • 1 single read failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 478 of file driver_sht30.c.

◆ sht30_soft_reset()

uint8_t sht30_soft_reset ( sht30_handle_t * handle)

soft reset the chip

Parameters
[in]*handlepointer to an sht30 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 851 of file driver_sht30.c.

◆ sht30_start_continuous_read()

uint8_t sht30_start_continuous_read ( sht30_handle_t * handle,
sht30_rate_t rate )

start reading

Parameters
[in]*handlepointer to an sht30 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 592 of file driver_sht30.c.

◆ sht30_stop_continuous_read()

uint8_t sht30_stop_continuous_read ( sht30_handle_t * handle)

stop reading

Parameters
[in]*handlepointer to an sht30 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 720 of file driver_sht30.c.