LibDriver SHT4X
Loading...
Searching...
No Matches
sht4x base driver function

sht4x base driver modules More...

Collaboration diagram for sht4x base driver function:

Data Structures

struct  sht4x_handle_s
 sht4x handle structure definition More...
struct  sht4x_info_s
 sht4x information structure definition More...

Typedefs

typedef struct sht4x_handle_s sht4x_handle_t
 sht4x handle structure definition
typedef struct sht4x_info_s sht4x_info_t
 sht4x information structure definition

Enumerations

enum  sht4x_address_t { SHT4X_ADDRESS_0 = (0x44 << 1) , SHT4X_ADDRESS_1 = (0x45 << 1) , SHT4X_ADDRESS_2 = (0x46 << 1) }
 sht4x address enumeration definition More...
enum  sht4x_mode_t {
  SHT4X_MODE_HIGH_PRECISION_WITH_NO_HEATER = 0xFD , SHT4X_MODE_MEDIUM_PRECISION_WITH_NO_HEATER = 0xF6 , SHT4X_MODE_LOWEST_PRECISION_WITH_NO_HEATER = 0xE0 , SHT4X_MODE_HIGH_PRECISION_WITH_HEATER_200MW_1S = 0x39 ,
  SHT4X_MODE_HIGH_PRECISION_WITH_HEATER_200MW_0P1S = 0x32 , SHT4X_MODE_HIGH_PRECISION_WITH_HEATER_110MW_1S = 0x2F , SHT4X_MODE_HIGH_PRECISION_WITH_HEATER_110MW_0P1S = 0x24 , SHT4X_MODE_HIGH_PRECISION_WITH_HEATER_20MW_1S = 0x1E ,
  SHT4X_MODE_HIGH_PRECISION_WITH_HEATER_20MW_0P1S = 0x15
}
 sht4x mode enumeration definition More...

Functions

uint8_t sht4x_info (sht4x_info_t *info)
 get chip's information
uint8_t sht4x_set_addr (sht4x_handle_t *handle, sht4x_address_t addr)
 set the iic address
uint8_t sht4x_get_addr (sht4x_handle_t *handle, sht4x_address_t *addr)
 get the iic address
uint8_t sht4x_init (sht4x_handle_t *handle)
 initialize the chip
uint8_t sht4x_deinit (sht4x_handle_t *handle)
 close the chip
uint8_t sht4x_read (sht4x_handle_t *handle, sht4x_mode_t mode, uint16_t *temperature_raw, float *temperature_s, uint16_t *humidity_raw, float *humidity_s)
 read temperature and humidity
uint8_t sht4x_soft_reset (sht4x_handle_t *handle)
 soft reset the chip
uint8_t sht4x_get_serial_number (sht4x_handle_t *handle, uint8_t num[4])
 get serial number

Detailed Description

sht4x base driver modules

Typedef Documentation

◆ sht4x_handle_t

sht4x handle structure definition

◆ sht4x_info_t

typedef struct sht4x_info_s sht4x_info_t

sht4x information structure definition

Enumeration Type Documentation

◆ sht4x_address_t

sht4x address enumeration definition

Enumerator
SHT4X_ADDRESS_0 

address0

SHT4X_ADDRESS_1 

address1

SHT4X_ADDRESS_2 

address2

Definition at line 62 of file driver_sht4x.h.

◆ sht4x_mode_t

sht4x mode enumeration definition

Enumerator
SHT4X_MODE_HIGH_PRECISION_WITH_NO_HEATER 

measure T & RH with high precision

SHT4X_MODE_MEDIUM_PRECISION_WITH_NO_HEATER 

measure T & RH with medium precision

SHT4X_MODE_LOWEST_PRECISION_WITH_NO_HEATER 

measure T & RH with lowest precision

SHT4X_MODE_HIGH_PRECISION_WITH_HEATER_200MW_1S 

activate heater with 200mW for 1s, high precision

SHT4X_MODE_HIGH_PRECISION_WITH_HEATER_200MW_0P1S 

activate heater with 200mW for 0.1s, high precision

SHT4X_MODE_HIGH_PRECISION_WITH_HEATER_110MW_1S 

activate heater with 110mW for 1s, high precision

SHT4X_MODE_HIGH_PRECISION_WITH_HEATER_110MW_0P1S 

activate heater with 110mW for 0.1s, high precision

SHT4X_MODE_HIGH_PRECISION_WITH_HEATER_20MW_1S 

activate heater with 20mW for 1s, high precision

SHT4X_MODE_HIGH_PRECISION_WITH_HEATER_20MW_0P1S 

activate heater with 20mW for 0.1s, high precision

Definition at line 72 of file driver_sht4x.h.

Function Documentation

◆ sht4x_deinit()

uint8_t sht4x_deinit ( sht4x_handle_t * handle)

close the chip

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

Definition at line 201 of file driver_sht4x.c.

◆ sht4x_get_addr()

uint8_t sht4x_get_addr ( sht4x_handle_t * handle,
sht4x_address_t * addr )

get the iic address

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

Definition at line 265 of file driver_sht4x.c.

◆ sht4x_get_serial_number()

uint8_t sht4x_get_serial_number ( sht4x_handle_t * handle,
uint8_t num[4] )

get serial number

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

Definition at line 484 of file driver_sht4x.c.

◆ sht4x_info()

uint8_t sht4x_info ( sht4x_info_t * info)

get chip's information

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

Definition at line 596 of file driver_sht4x.c.

◆ sht4x_init()

uint8_t sht4x_init ( sht4x_handle_t * handle)

initialize the chip

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

Definition at line 127 of file driver_sht4x.c.

◆ sht4x_read()

uint8_t sht4x_read ( sht4x_handle_t * handle,
sht4x_mode_t mode,
uint16_t * temperature_raw,
float * temperature_s,
uint16_t * humidity_raw,
float * humidity_s )

read temperature and humidity

Parameters
[in]*handlepointer to an sht4x handle structure
[in]moderead mode
[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 read failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 crc is error
Note
none

Definition at line 293 of file driver_sht4x.c.

◆ sht4x_set_addr()

uint8_t sht4x_set_addr ( sht4x_handle_t * handle,
sht4x_address_t addr )

set the iic address

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

Definition at line 243 of file driver_sht4x.c.

◆ sht4x_soft_reset()

uint8_t sht4x_soft_reset ( sht4x_handle_t * handle)

soft reset the chip

Parameters
[in]*handlepointer to an sht4x 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 537 of file driver_sht4x.c.