LibDriver HTU21D
Loading...
Searching...
No Matches
htu21d base driver function

htu21d base driver modules More...

Collaboration diagram for htu21d base driver function:

Data Structures

struct  htu21d_handle_s
 htu21d handle structure definition More...
struct  htu21d_info_s
 htu21d information structure definition More...

Typedefs

typedef struct htu21d_handle_s htu21d_handle_t
 htu21d handle structure definition
typedef struct htu21d_info_s htu21d_info_t
 htu21d information structure definition

Enumerations

enum  htu21d_bool_t { HTU21D_BOOL_FALSE = 0x00 , HTU21D_BOOL_TRUE = 0x01 }
 htu21d bool enumeration definition More...
enum  htu21d_mode_t { HTU21D_MODE_HOLD_MASTER = 0x00 , HTU21D_MODE_NO_HOLD_MASTER = 0x01 }
 htu21d mode enumeration definition More...
enum  htu21d_status_t { HTU21D_STATUS_OVER_2P25 = 0x00 , HTU21D_STATUS_LESS_2P25 = 0x01 }
 htu21d status enumeration definition More...
enum  htu21d_resolution_t { HTU21D_RESOLUTION_TEMP_11_BITS_RH_11_BITS = 0x03 , HTU21D_RESOLUTION_TEMP_12_BITS_RH_8_BITS = 0x01 , HTU21D_RESOLUTION_TEMP_13_BITS_RH_10_BITS = 0x02 , HTU21D_RESOLUTION_TEMP_14_BITS_RH_12_BITS = 0x00 }
 htu21d resolution enumeration definition More...

Functions

uint8_t htu21d_info (htu21d_info_t *info)
 get chip's information
uint8_t htu21d_init (htu21d_handle_t *handle)
 initialize the chip
uint8_t htu21d_deinit (htu21d_handle_t *handle)
 close the chip
uint8_t htu21d_set_mode (htu21d_handle_t *handle, htu21d_mode_t mode)
 set the chip mode
uint8_t htu21d_get_mode (htu21d_handle_t *handle, htu21d_mode_t *mode)
 get the chip mode
uint8_t htu21d_soft_reset (htu21d_handle_t *handle)
 soft reset
uint8_t htu21d_read_temperature_humidity (htu21d_handle_t *handle, uint16_t *temperature_raw, float *temperature_s, uint16_t *humidity_raw, float *humidity_s)
 read the temperature and humidity data
uint8_t htu21d_read_temperature (htu21d_handle_t *handle, uint16_t *temperature_raw, float *temperature_s)
 read the temperature data
uint8_t htu21d_read_humidity (htu21d_handle_t *handle, uint16_t *humidity_raw, float *humidity_s)
 read the humidity data
uint8_t htu21d_set_resolution (htu21d_handle_t *handle, htu21d_resolution_t resolution)
 set the resolution
uint8_t htu21d_get_resolution (htu21d_handle_t *handle, htu21d_resolution_t *resolution)
 get the resolution
uint8_t htu21d_get_battery_status (htu21d_handle_t *handle, htu21d_status_t *status)
 get the battery status
uint8_t htu21d_set_heater (htu21d_handle_t *handle, htu21d_bool_t enable)
 enable or disable the heater
uint8_t htu21d_get_heater (htu21d_handle_t *handle, htu21d_bool_t *enable)
 get the heater status
uint8_t htu21d_set_disable_otp_reload (htu21d_handle_t *handle, htu21d_bool_t enable)
 enable or disable otp reload
uint8_t htu21d_get_disable_otp_reload (htu21d_handle_t *handle, htu21d_bool_t *enable)
 get the disable otp reload status
uint8_t htu21d_get_serial_number (htu21d_handle_t *handle, uint64_t *number)
 get the serial number

Detailed Description

htu21d base driver modules

Typedef Documentation

◆ htu21d_handle_t

htu21d handle structure definition

◆ htu21d_info_t

typedef struct htu21d_info_s htu21d_info_t

htu21d information structure definition

Enumeration Type Documentation

◆ htu21d_bool_t

htu21d bool enumeration definition

Enumerator
HTU21D_BOOL_FALSE 

false

HTU21D_BOOL_TRUE 

true

Definition at line 62 of file driver_htu21d.h.

◆ htu21d_mode_t

htu21d mode enumeration definition

Enumerator
HTU21D_MODE_HOLD_MASTER 

hold master mode

HTU21D_MODE_NO_HOLD_MASTER 

no hold master mode

Definition at line 71 of file driver_htu21d.h.

◆ htu21d_resolution_t

htu21d resolution enumeration definition

Enumerator
HTU21D_RESOLUTION_TEMP_11_BITS_RH_11_BITS 

temp 11 bits and rh 11 bits

HTU21D_RESOLUTION_TEMP_12_BITS_RH_8_BITS 

temp 12 bits and rh 8 bits

HTU21D_RESOLUTION_TEMP_13_BITS_RH_10_BITS 

temp 13 bits and rh 10 bits

HTU21D_RESOLUTION_TEMP_14_BITS_RH_12_BITS 

temp 14 bits and rh 12 bits

Definition at line 89 of file driver_htu21d.h.

◆ htu21d_status_t

htu21d status enumeration definition

Enumerator
HTU21D_STATUS_OVER_2P25 

>2.25V

HTU21D_STATUS_LESS_2P25 

<2.25V

Definition at line 80 of file driver_htu21d.h.

Function Documentation

◆ htu21d_deinit()

uint8_t htu21d_deinit ( htu21d_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to an htu21d 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 1213 of file driver_htu21d.c.

◆ htu21d_get_battery_status()

uint8_t htu21d_get_battery_status ( htu21d_handle_t * handle,
htu21d_status_t * status )

get the battery status

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

Definition at line 812 of file driver_htu21d.c.

◆ htu21d_get_disable_otp_reload()

uint8_t htu21d_get_disable_otp_reload ( htu21d_handle_t * handle,
htu21d_bool_t * enable )

get the disable otp reload status

Parameters
[in]*handlepointer to an htu21d 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 980 of file driver_htu21d.c.

◆ htu21d_get_heater()

uint8_t htu21d_get_heater ( htu21d_handle_t * handle,
htu21d_bool_t * enable )

get the heater status

Parameters
[in]*handlepointer to an htu21d handle structure
[out]*enablepointer to a 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 896 of file driver_htu21d.c.

◆ htu21d_get_mode()

uint8_t htu21d_get_mode ( htu21d_handle_t * handle,
htu21d_mode_t * mode )

get the chip mode

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

Definition at line 246 of file driver_htu21d.c.

◆ htu21d_get_resolution()

uint8_t htu21d_get_resolution ( htu21d_handle_t * handle,
htu21d_resolution_t * resolution )

get the resolution

Parameters
[in]*handlepointer to an htu21d 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 772 of file driver_htu21d.c.

◆ htu21d_get_serial_number()

uint8_t htu21d_get_serial_number ( htu21d_handle_t * handle,
uint64_t * number )

get the serial number

Parameters
[in]*handlepointer to an htu21d handle structure
[out]*numberpointer 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 1019 of file driver_htu21d.c.

◆ htu21d_info()

uint8_t htu21d_info ( htu21d_info_t * info)

get chip's information

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

Definition at line 1305 of file driver_htu21d.c.

◆ htu21d_init()

uint8_t htu21d_init ( htu21d_handle_t * handle)

initialize the chip

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

Definition at line 1107 of file driver_htu21d.c.

◆ htu21d_read_humidity()

uint8_t htu21d_read_humidity ( htu21d_handle_t * handle,
uint16_t * humidity_raw,
float * humidity_s )

read the humidity data

Parameters
[in]*handlepointer to an htu21d handle structure
[out]*humidity_rawpointer to a raw humidity buffer
[out]*humidity_spointer to a converted humidity buffer
Returns
status code
  • 0 success
  • 1 read humidity failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 crc is error
  • 5 status is error
Note
none

Definition at line 614 of file driver_htu21d.c.

◆ htu21d_read_temperature()

uint8_t htu21d_read_temperature ( htu21d_handle_t * handle,
uint16_t * temperature_raw,
float * temperature_s )

read the temperature data

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

Definition at line 501 of file driver_htu21d.c.

◆ htu21d_read_temperature_humidity()

uint8_t htu21d_read_temperature_humidity ( htu21d_handle_t * handle,
uint16_t * temperature_raw,
float * temperature_s,
uint16_t * humidity_raw,
float * humidity_s )

read the temperature and humidity data

Parameters
[in]*handlepointer to an htu21d 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 temperature humidity failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 crc is error
  • 5 status is error
Note
none

Definition at line 313 of file driver_htu21d.c.

◆ htu21d_set_disable_otp_reload()

uint8_t htu21d_set_disable_otp_reload ( htu21d_handle_t * handle,
htu21d_bool_t enable )

enable or disable otp reload

Parameters
[in]*handlepointer to an htu21d 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 934 of file driver_htu21d.c.

◆ htu21d_set_heater()

uint8_t htu21d_set_heater ( htu21d_handle_t * handle,
htu21d_bool_t enable )

enable or disable the heater

Parameters
[in]*handlepointer to an htu21d 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 850 of file driver_htu21d.c.

◆ htu21d_set_mode()

uint8_t htu21d_set_mode ( htu21d_handle_t * handle,
htu21d_mode_t mode )

set the chip mode

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

Definition at line 219 of file driver_htu21d.c.

◆ htu21d_set_resolution()

uint8_t htu21d_set_resolution ( htu21d_handle_t * handle,
htu21d_resolution_t resolution )

set the resolution

Parameters
[in]*handlepointer to an htu21d 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 724 of file driver_htu21d.c.

◆ htu21d_soft_reset()

uint8_t htu21d_soft_reset ( htu21d_handle_t * handle)

soft reset

Parameters
[in]*handlepointer to an htu21d 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 272 of file driver_htu21d.c.