LibDriver SHT2X
Loading...
Searching...
No Matches
sht2x base driver function

sht2x base driver modules More...

Collaboration diagram for sht2x base driver function:

Data Structures

struct  sht2x_handle_s
 sht2x handle structure definition More...
struct  sht2x_info_s
 sht2x information structure definition More...

Typedefs

typedef struct sht2x_handle_s sht2x_handle_t
 sht2x handle structure definition
typedef struct sht2x_info_s sht2x_info_t
 sht2x information structure definition

Enumerations

enum  sht2x_bool_t { SHT2X_BOOL_FALSE = 0x00 , SHT2X_BOOL_TRUE = 0x01 }
 sht2x bool enumeration definition More...
enum  sht2x_status_t { SHT35_STATUS_VDD_OVER_2P25V = 0 , SHT35_STATUS_VDD_LESS_2P25V = 1 }
 sht2x status enumeration definition More...
enum  sht2x_mode_t { SHT2X_MODE_HOLD_MASTER = 0x00 , SHT2X_MODE_NO_HOLD_MASTER = 0x01 }
 sht2x mode enumeration definition More...
enum  sht2x_resolution_t { SHT2X_RESOLUTION_RH_12BIT_T_14BIT = 0x00 , SHT2X_RESOLUTION_RH_8BIT_T_12BIT = 0x01 , SHT2X_RESOLUTION_RH_10BIT_T_13BIT = 0x02 , SHT2X_RESOLUTION_RH_11BIT_T_11BIT = 0x03 }
 sht2x resolution enumeration definition More...

Functions

uint8_t sht2x_info (sht2x_info_t *info)
 get chip's information
uint8_t sht2x_init (sht2x_handle_t *handle)
 initialize the chip
uint8_t sht2x_deinit (sht2x_handle_t *handle)
 close the chip
uint8_t sht2x_read (sht2x_handle_t *handle, uint16_t *temperature_raw, float *temperature_s, uint16_t *humidity_raw, float *humidity_s)
 read data
uint8_t sht2x_set_mode (sht2x_handle_t *handle, sht2x_mode_t mode)
 set chip mode
uint8_t sht2x_get_mode (sht2x_handle_t *handle, sht2x_mode_t *mode)
 get chip mode
uint8_t sht2x_soft_reset (sht2x_handle_t *handle)
 soft reset the chip
uint8_t sht2x_set_resolution (sht2x_handle_t *handle, sht2x_resolution_t resolution)
 set resolution
uint8_t sht2x_get_resolution (sht2x_handle_t *handle, sht2x_resolution_t *resolution)
 get resolution
uint8_t sht2x_set_heater (sht2x_handle_t *handle, sht2x_bool_t enable)
 enable or disable heater
uint8_t sht2x_get_heater (sht2x_handle_t *handle, sht2x_bool_t *enable)
 get heater status
uint8_t sht2x_set_disable_otp_reload (sht2x_handle_t *handle, sht2x_bool_t enable)
 enable or disable disable otp reload
uint8_t sht2x_get_disable_otp_reload (sht2x_handle_t *handle, sht2x_bool_t *enable)
 get disable otp reload status
uint8_t sht2x_get_status (sht2x_handle_t *handle, sht2x_status_t *status)
 get status
uint8_t sht2x_get_serial_number (sht2x_handle_t *handle, uint8_t sn[8])
 get serial number

Detailed Description

sht2x base driver modules

Typedef Documentation

◆ sht2x_handle_t

sht2x handle structure definition

◆ sht2x_info_t

typedef struct sht2x_info_s sht2x_info_t

sht2x information structure definition

Enumeration Type Documentation

◆ sht2x_bool_t

sht2x bool enumeration definition

Enumerator
SHT2X_BOOL_FALSE 

disable

SHT2X_BOOL_TRUE 

enable

Definition at line 62 of file driver_sht2x.h.

◆ sht2x_mode_t

sht2x mode enumeration definition

Enumerator
SHT2X_MODE_HOLD_MASTER 

hold master mode

SHT2X_MODE_NO_HOLD_MASTER 

no hold master mode

Definition at line 80 of file driver_sht2x.h.

◆ sht2x_resolution_t

sht2x resolution enumeration definition

Enumerator
SHT2X_RESOLUTION_RH_12BIT_T_14BIT 

resolution rh 12bit, t 14bit

SHT2X_RESOLUTION_RH_8BIT_T_12BIT 

resolution rh 8bit, t 12bit

SHT2X_RESOLUTION_RH_10BIT_T_13BIT 

resolution rh 10bit, t 13bit

SHT2X_RESOLUTION_RH_11BIT_T_11BIT 

resolution rh 11bit, t 11bit

Definition at line 89 of file driver_sht2x.h.

◆ sht2x_status_t

sht2x status enumeration definition

Enumerator
SHT35_STATUS_VDD_OVER_2P25V 

vdd > 2.25v

SHT35_STATUS_VDD_LESS_2P25V 

vdd < 2.25v

Definition at line 71 of file driver_sht2x.h.

Function Documentation

◆ sht2x_deinit()

uint8_t sht2x_deinit ( sht2x_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to a sht2x 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 336 of file driver_sht2x.c.

◆ sht2x_get_disable_otp_reload()

uint8_t sht2x_get_disable_otp_reload ( sht2x_handle_t * handle,
sht2x_bool_t * enable )

get disable otp reload status

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

Definition at line 645 of file driver_sht2x.c.

◆ sht2x_get_heater()

uint8_t sht2x_get_heater ( sht2x_handle_t * handle,
sht2x_bool_t * enable )

get heater status

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

Definition at line 558 of file driver_sht2x.c.

◆ sht2x_get_mode()

uint8_t sht2x_get_mode ( sht2x_handle_t * handle,
sht2x_mode_t * mode )

get chip mode

Parameters
[in]*handlepointer to a sht2x handle structure
[out]*modepointer to a chip mode buffer
Returns
status code
  • 0 success
  • 1 get mode failed
  • 2 handle is NULL
Note
none

Definition at line 748 of file driver_sht2x.c.

◆ sht2x_get_resolution()

uint8_t sht2x_get_resolution ( sht2x_handle_t * handle,
sht2x_resolution_t * resolution )

get resolution

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

Definition at line 469 of file driver_sht2x.c.

◆ sht2x_get_serial_number()

uint8_t sht2x_get_serial_number ( sht2x_handle_t * handle,
uint8_t sn[8] )

get serial number

Parameters
[in]*handlepointer to a sht2x 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
  • 4 crc check failed
Note
none

Definition at line 933 of file driver_sht2x.c.

◆ sht2x_get_status()

uint8_t sht2x_get_status ( sht2x_handle_t * handle,
sht2x_status_t * status )

get status

Parameters
[in]*handlepointer to a sht2x 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 684 of file driver_sht2x.c.

◆ sht2x_info()

uint8_t sht2x_info ( sht2x_info_t * info)

get chip's information

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

Definition at line 1154 of file driver_sht2x.c.

◆ sht2x_init()

uint8_t sht2x_init ( sht2x_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to a sht2x 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 236 of file driver_sht2x.c.

◆ sht2x_read()

uint8_t sht2x_read ( sht2x_handle_t * handle,
uint16_t * temperature_raw,
float * temperature_s,
uint16_t * humidity_raw,
float * humidity_s )

read data

Parameters
[in]*handlepointer to a sht2x 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 read failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 crc check failed
Note
none

Definition at line 779 of file driver_sht2x.c.

◆ sht2x_set_disable_otp_reload()

uint8_t sht2x_set_disable_otp_reload ( sht2x_handle_t * handle,
sht2x_bool_t enable )

enable or disable disable otp reload

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

Definition at line 597 of file driver_sht2x.c.

◆ sht2x_set_heater()

uint8_t sht2x_set_heater ( sht2x_handle_t * handle,
sht2x_bool_t enable )

enable or disable heater

Parameters
[in]*handlepointer to a sht2x 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 510 of file driver_sht2x.c.

◆ sht2x_set_mode()

uint8_t sht2x_set_mode ( sht2x_handle_t * handle,
sht2x_mode_t mode )

set chip mode

Parameters
[in]*handlepointer to a sht2x handle structure
[in]modechip mode
Returns
status code
  • 0 success
  • 1 set mode failed
  • 2 handle is NULL
Note
none

Definition at line 722 of file driver_sht2x.c.

◆ sht2x_set_resolution()

uint8_t sht2x_set_resolution ( sht2x_handle_t * handle,
sht2x_resolution_t resolution )

set resolution

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

Definition at line 418 of file driver_sht2x.c.

◆ sht2x_soft_reset()

uint8_t sht2x_soft_reset ( sht2x_handle_t * handle)

soft reset the chip

Parameters
[in]*handlepointer to a sht2x 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 380 of file driver_sht2x.c.