LibDriver HTU31D
Loading...
Searching...
No Matches
driver_htu31d.c File Reference

driver htu31d source file More...

#include "driver_htu31d.h"
Include dependency graph for driver_htu31d.c:

Go to the source code of this file.

Macros

#define CHIP_NAME   "TE HTU31D"
 chip information definition
#define MANUFACTURER_NAME   "TE"
#define SUPPLY_VOLTAGE_MIN   3.0f
#define SUPPLY_VOLTAGE_MAX   5.5f
#define MAX_CURRENT   0.414f
#define TEMPERATURE_MIN   -40.0f
#define TEMPERATURE_MAX   125.0f
#define DRIVER_VERSION   1000
#define HTU31D_COMMAND_CONVERSION   (0x1 << 6)
 chip command definition
#define HTU31D_COMMAND_READ_T_RH   (0x00)
#define HTU31D_COMMAND_READ_RH   (0x1 << 4)
#define HTU31D_COMMAND_RESET   (0x1E)
#define HTU31D_COMMAND_HEATER_ON   (0x1 << 2)
#define HTU31D_COMMAND_HEATER_OFF   (0x1 << 1)
#define HTU31D_COMMAND_READ_SERIAL_NUMBER   (0x0A)
#define HTU31D_COMMAND_READ_DIAGNOSTIC   (1 << 3)

Functions

uint8_t htu31d_set_addr_pin (htu31d_handle_t *handle, htu31d_addr_pin_t addr_pin)
 set the address pin
uint8_t htu31d_get_addr_pin (htu31d_handle_t *handle, htu31d_addr_pin_t *addr_pin)
 get the address pin
uint8_t htu31d_soft_reset (htu31d_handle_t *handle)
 soft reset
uint8_t htu31d_set_heater_on (htu31d_handle_t *handle)
 enable heater
uint8_t htu31d_set_heater_off (htu31d_handle_t *handle)
 disable heater
uint8_t htu31d_get_serial_number (htu31d_handle_t *handle, uint8_t number[3])
 get the serial number
uint8_t htu31d_get_diagnostic (htu31d_handle_t *handle, uint8_t *diagnostic)
 get the diagnostic
uint8_t htu31d_read_temperature_humidity (htu31d_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 htu31d_read_humidity (htu31d_handle_t *handle, uint16_t *humidity_raw, float *humidity_s)
 read the humidity data
uint8_t htu31d_init (htu31d_handle_t *handle)
 initialize the chip
uint8_t htu31d_deinit (htu31d_handle_t *handle)
 close the chip
uint8_t htu31d_set_humidity_osr (htu31d_handle_t *handle, htu31d_humidity_osr_t osr)
 set humidity osr
uint8_t htu31d_get_humidity_osr (htu31d_handle_t *handle, htu31d_humidity_osr_t *osr)
 get humidity osr
uint8_t htu31d_set_temperature_osr (htu31d_handle_t *handle, htu31d_temperature_osr_t osr)
 set temperature osr
uint8_t htu31d_get_temperature_osr (htu31d_handle_t *handle, htu31d_temperature_osr_t *osr)
 get temperature osr
uint8_t htu31d_set_reg (htu31d_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t htu31d_get_reg (htu31d_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 get the chip register
uint8_t htu31d_info (htu31d_info_t *info)
 get chip's information

Detailed Description

driver htu31d source file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2024-02-28

history

Date Version Author Description
2024/02/28 1.0 Shifeng Li first upload

Definition in file driver_htu31d.c.

Macro Definition Documentation

◆ CHIP_NAME

#define CHIP_NAME   "TE HTU31D"

chip information definition

chip name

Definition at line 42 of file driver_htu31d.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 49 of file driver_htu31d.c.

◆ HTU31D_COMMAND_CONVERSION

#define HTU31D_COMMAND_CONVERSION   (0x1 << 6)

chip command definition

conversion command

Definition at line 54 of file driver_htu31d.c.

◆ HTU31D_COMMAND_HEATER_OFF

#define HTU31D_COMMAND_HEATER_OFF   (0x1 << 1)

heater off command

Definition at line 59 of file driver_htu31d.c.

◆ HTU31D_COMMAND_HEATER_ON

#define HTU31D_COMMAND_HEATER_ON   (0x1 << 2)

heater on command

Definition at line 58 of file driver_htu31d.c.

◆ HTU31D_COMMAND_READ_DIAGNOSTIC

#define HTU31D_COMMAND_READ_DIAGNOSTIC   (1 << 3)

read diagnostic command

Definition at line 61 of file driver_htu31d.c.

◆ HTU31D_COMMAND_READ_RH

#define HTU31D_COMMAND_READ_RH   (0x1 << 4)

read rh command

Definition at line 56 of file driver_htu31d.c.

◆ HTU31D_COMMAND_READ_SERIAL_NUMBER

#define HTU31D_COMMAND_READ_SERIAL_NUMBER   (0x0A)

read serial number command

Definition at line 60 of file driver_htu31d.c.

◆ HTU31D_COMMAND_READ_T_RH

#define HTU31D_COMMAND_READ_T_RH   (0x00)

read t && rh command

Definition at line 55 of file driver_htu31d.c.

◆ HTU31D_COMMAND_RESET

#define HTU31D_COMMAND_RESET   (0x1E)

reset command

Definition at line 57 of file driver_htu31d.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "TE"

manufacturer name

Definition at line 43 of file driver_htu31d.c.

◆ MAX_CURRENT

#define MAX_CURRENT   0.414f

chip max current

Definition at line 46 of file driver_htu31d.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   5.5f

chip max supply voltage

Definition at line 45 of file driver_htu31d.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   3.0f

chip min supply voltage

Definition at line 44 of file driver_htu31d.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   125.0f

chip max operating temperature

Definition at line 48 of file driver_htu31d.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -40.0f

chip min operating temperature

Definition at line 47 of file driver_htu31d.c.