LibDriver HDC2080
Loading...
Searching...
No Matches
driver_hdc2080.c File Reference

driver hdc2080 source file More...

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

Go to the source code of this file.

Macros

#define CHIP_NAME   "Texas Instruments HDC2080"
 chip information definition
#define MANUFACTURER_NAME   "Texas Instruments"
#define SUPPLY_VOLTAGE_MIN   1.62f
#define SUPPLY_VOLTAGE_MAX   3.6f
#define MAX_CURRENT   90.0f
#define TEMPERATURE_MIN   -40.0f
#define TEMPERATURE_MAX   125.0f
#define DRIVER_VERSION   1000
#define HDC2080_REG_TEMPERATURE_LOW   0x00
 chip register definition
#define HDC2080_REG_TEMPERATURE_HIGH   0x01
#define HDC2080_REG_HUMIDITY_LOW   0x02
#define HDC2080_REG_HUMIDITY_HIGH   0x03
#define HDC2080_REG_INTERRUPT_DRDY   0x04
#define HDC2080_REG_TEMPERATURE_MAX   0x05
#define HDC2080_REG_HUMIDITY_MAX   0x06
#define HDC2080_REG_INTERRUPT_ENABLE   0x07
#define HDC2080_REG_TEMP_OFFSET_ADJUST   0x08
#define HDC2080_REG_HUM_OFFSET_ADJUST   0x09
#define HDC2080_REG_TEMP_THR_L   0x0A
#define HDC2080_REG_TEMP_THR_H   0x0B
#define HDC2080_REG_RH_THR_L   0x0C
#define HDC2080_REG_RH_THR_H   0x0D
#define HDC2080_REG_CONF   0x0E
#define HDC2080_REG_MEASUREMENT   0x0F
#define HDC2080_REG_MANUFACTURER_ID_LOW   0xFC
#define HDC2080_REG_MANUFACTURER_ID_HIGH   0xFD
#define HDC2080_REG_DEVICE_ID_LOW   0xFE
#define HDC2080_REG_DEVICE_ID_HIGH   0xFF

Functions

uint8_t hdc2080_set_addr_pin (hdc2080_handle_t *handle, hdc2080_address_t addr_pin)
 set the iic address pin
uint8_t hdc2080_get_addr_pin (hdc2080_handle_t *handle, hdc2080_address_t *addr_pin)
 get the iic address pin
uint8_t hdc2080_init (hdc2080_handle_t *handle)
 initialize the chip
uint8_t hdc2080_deinit (hdc2080_handle_t *handle)
 close the chip
uint8_t hdc2080_set_temperature_resolution (hdc2080_handle_t *handle, hdc2080_resolution_t resolution)
 set temperature resolution
uint8_t hdc2080_get_temperature_resolution (hdc2080_handle_t *handle, hdc2080_resolution_t *resolution)
 get temperature resolution
uint8_t hdc2080_set_humidity_resolution (hdc2080_handle_t *handle, hdc2080_resolution_t resolution)
 set humidity resolution
uint8_t hdc2080_get_humidity_resolution (hdc2080_handle_t *handle, hdc2080_resolution_t *resolution)
 get humidity resolution
uint8_t hdc2080_set_mode (hdc2080_handle_t *handle, hdc2080_mode_t mode)
 set the chip mode
uint8_t hdc2080_get_mode (hdc2080_handle_t *handle, hdc2080_mode_t *mode)
 get the chip mode
uint8_t hdc2080_set_measurement (hdc2080_handle_t *handle, hdc2080_bool_t enable)
 enable or disable measurement
uint8_t hdc2080_get_measurement (hdc2080_handle_t *handle, hdc2080_bool_t *enable)
 get measurement status
uint8_t hdc2080_soft_reset (hdc2080_handle_t *handle)
 soft reset
uint8_t hdc2080_set_auto_measurement_mode (hdc2080_handle_t *handle, hdc2080_auto_measurement_mode_t mode)
 set auto measurement mode
uint8_t hdc2080_get_auto_measurement_mode (hdc2080_handle_t *handle, hdc2080_auto_measurement_mode_t *mode)
 get auto measurement mode
uint8_t hdc2080_set_heater (hdc2080_handle_t *handle, hdc2080_bool_t enable)
 enable or disable heater
uint8_t hdc2080_get_heater (hdc2080_handle_t *handle, hdc2080_bool_t *enable)
 get heater status
uint8_t hdc2080_set_interrupt_pin (hdc2080_handle_t *handle, hdc2080_bool_t enable)
 enable or disable interrupt pin
uint8_t hdc2080_get_interrupt_pin (hdc2080_handle_t *handle, hdc2080_bool_t *enable)
 get interrupt pin status
uint8_t hdc2080_set_interrupt_polarity (hdc2080_handle_t *handle, hdc2080_interrupt_polarity_t polarity)
 set interrupt polarity
uint8_t hdc2080_get_interrupt_polarity (hdc2080_handle_t *handle, hdc2080_interrupt_polarity_t *polarity)
 get interrupt polarity
uint8_t hdc2080_set_interrupt_mode (hdc2080_handle_t *handle, hdc2080_interrupt_mode_t mode)
 set interrupt mode
uint8_t hdc2080_get_interrupt_mode (hdc2080_handle_t *handle, hdc2080_interrupt_mode_t *mode)
 get interrupt mode
uint8_t hdc2080_set_humidity_high_threshold (hdc2080_handle_t *handle, uint8_t threshold)
 set humidity high threshold
uint8_t hdc2080_get_humidity_high_threshold (hdc2080_handle_t *handle, uint8_t *threshold)
 get humidity high threshold
uint8_t hdc2080_set_humidity_low_threshold (hdc2080_handle_t *handle, uint8_t threshold)
 set humidity low threshold
uint8_t hdc2080_get_humidity_low_threshold (hdc2080_handle_t *handle, uint8_t *threshold)
 get humidity low threshold
uint8_t hdc2080_set_temperature_high_threshold (hdc2080_handle_t *handle, uint8_t threshold)
 set temperature high threshold
uint8_t hdc2080_get_temperature_high_threshold (hdc2080_handle_t *handle, uint8_t *threshold)
 get temperature high threshold
uint8_t hdc2080_set_temperature_low_threshold (hdc2080_handle_t *handle, uint8_t threshold)
 set temperature low threshold
uint8_t hdc2080_get_temperature_low_threshold (hdc2080_handle_t *handle, uint8_t *threshold)
 get temperature low threshold
uint8_t hdc2080_set_humidity_offset_adjustment (hdc2080_handle_t *handle, int8_t offset)
 set humidity offset adjustment
uint8_t hdc2080_get_humidity_offset_adjustment (hdc2080_handle_t *handle, int8_t *offset)
 get humidity offset adjustment
uint8_t hdc2080_set_temperature_offset_adjustment (hdc2080_handle_t *handle, int8_t offset)
 set temperature offset adjustment
uint8_t hdc2080_get_temperature_offset_adjustment (hdc2080_handle_t *handle, int8_t *offset)
 get temperature offset adjustment
uint8_t hdc2080_set_interrupt (hdc2080_handle_t *handle, hdc2080_interrupt_t interrupt, hdc2080_bool_t enable)
 enable or disable interrupt
uint8_t hdc2080_get_interrupt (hdc2080_handle_t *handle, hdc2080_interrupt_t interrupt, hdc2080_bool_t *enable)
 get interrupt status
uint8_t hdc2080_set_humidity_max (hdc2080_handle_t *handle, uint8_t max)
 set humidity max
uint8_t hdc2080_get_humidity_max (hdc2080_handle_t *handle, uint8_t *max)
 get humidity max
uint8_t hdc2080_set_temperature_max (hdc2080_handle_t *handle, uint8_t max)
 set temperature max
uint8_t hdc2080_get_temperature_max (hdc2080_handle_t *handle, uint8_t *max)
 get temperature max
uint8_t hdc2080_get_interrupt_status (hdc2080_handle_t *handle, uint8_t *status)
 get interrupt status
uint8_t hdc2080_humidity_convert_to_register (hdc2080_handle_t *handle, float percent, uint8_t *reg)
 convert the humidity to the register raw data
uint8_t hdc2080_humidity_convert_to_data (hdc2080_handle_t *handle, uint8_t reg, float *percent)
 convert the register raw data to the humidity
uint8_t hdc2080_temperature_convert_to_register (hdc2080_handle_t *handle, float deg, uint8_t *reg)
 convert the temperature to the register raw data
uint8_t hdc2080_temperature_convert_to_data (hdc2080_handle_t *handle, uint8_t reg, float *deg)
 convert the register raw data to the temperature
uint8_t hdc2080_humidity_offset_convert_to_register (hdc2080_handle_t *handle, float percent, int8_t *reg)
 convert the humidity offset to the register raw data
uint8_t hdc2080_humidity_offset_convert_to_data (hdc2080_handle_t *handle, int8_t reg, float *percent)
 convert the register raw data to the humidity offset
uint8_t hdc2080_temperature_offset_convert_to_register (hdc2080_handle_t *handle, float deg, int8_t *reg)
 convert the temperature offset to the register raw data
uint8_t hdc2080_temperature_offset_convert_to_data (hdc2080_handle_t *handle, int8_t reg, float *deg)
 convert the register raw data to the temperature offset
uint8_t hdc2080_read_temperature_humidity (hdc2080_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 hdc2080_read_temperature (hdc2080_handle_t *handle, uint16_t *temperature_raw, float *temperature_s)
 read the temperature
uint8_t hdc2080_read_humidity (hdc2080_handle_t *handle, uint16_t *humidity_raw, float *humidity_s)
 read the humidity data
uint8_t hdc2080_read_poll (hdc2080_handle_t *handle)
 read poll
uint8_t hdc2080_set_reg (hdc2080_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set chip register
uint8_t hdc2080_get_reg (hdc2080_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 get chip register
uint8_t hdc2080_info (hdc2080_info_t *info)
 get chip's information

Detailed Description

driver hdc2080 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-05-30

history

Date Version Author Description
2024/05/30 1.0 Shifeng Li first upload

Definition in file driver_hdc2080.c.

Macro Definition Documentation

◆ CHIP_NAME

#define CHIP_NAME   "Texas Instruments HDC2080"

chip information definition

chip name

Definition at line 42 of file driver_hdc2080.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 49 of file driver_hdc2080.c.

◆ HDC2080_REG_CONF

#define HDC2080_REG_CONF   0x0E

conf register

Definition at line 68 of file driver_hdc2080.c.

◆ HDC2080_REG_DEVICE_ID_HIGH

#define HDC2080_REG_DEVICE_ID_HIGH   0xFF

device id high register

Definition at line 73 of file driver_hdc2080.c.

◆ HDC2080_REG_DEVICE_ID_LOW

#define HDC2080_REG_DEVICE_ID_LOW   0xFE

device id low register

Definition at line 72 of file driver_hdc2080.c.

◆ HDC2080_REG_HUM_OFFSET_ADJUST

#define HDC2080_REG_HUM_OFFSET_ADJUST   0x09

hum offset adjust register

Definition at line 63 of file driver_hdc2080.c.

◆ HDC2080_REG_HUMIDITY_HIGH

#define HDC2080_REG_HUMIDITY_HIGH   0x03

humidity high register

Definition at line 57 of file driver_hdc2080.c.

◆ HDC2080_REG_HUMIDITY_LOW

#define HDC2080_REG_HUMIDITY_LOW   0x02

humidity low register

Definition at line 56 of file driver_hdc2080.c.

◆ HDC2080_REG_HUMIDITY_MAX

#define HDC2080_REG_HUMIDITY_MAX   0x06

humidity max register

Definition at line 60 of file driver_hdc2080.c.

◆ HDC2080_REG_INTERRUPT_DRDY

#define HDC2080_REG_INTERRUPT_DRDY   0x04

interrupt drdy register

Definition at line 58 of file driver_hdc2080.c.

◆ HDC2080_REG_INTERRUPT_ENABLE

#define HDC2080_REG_INTERRUPT_ENABLE   0x07

interrupt enable register

Definition at line 61 of file driver_hdc2080.c.

◆ HDC2080_REG_MANUFACTURER_ID_HIGH

#define HDC2080_REG_MANUFACTURER_ID_HIGH   0xFD

manufacturer id high register

Definition at line 71 of file driver_hdc2080.c.

◆ HDC2080_REG_MANUFACTURER_ID_LOW

#define HDC2080_REG_MANUFACTURER_ID_LOW   0xFC

manufacturer id low register

Definition at line 70 of file driver_hdc2080.c.

◆ HDC2080_REG_MEASUREMENT

#define HDC2080_REG_MEASUREMENT   0x0F

measurement register

Definition at line 69 of file driver_hdc2080.c.

◆ HDC2080_REG_RH_THR_H

#define HDC2080_REG_RH_THR_H   0x0D

rh thr high register

Definition at line 67 of file driver_hdc2080.c.

◆ HDC2080_REG_RH_THR_L

#define HDC2080_REG_RH_THR_L   0x0C

rh thr low register

Definition at line 66 of file driver_hdc2080.c.

◆ HDC2080_REG_TEMP_OFFSET_ADJUST

#define HDC2080_REG_TEMP_OFFSET_ADJUST   0x08

temp offset adjust register

Definition at line 62 of file driver_hdc2080.c.

◆ HDC2080_REG_TEMP_THR_H

#define HDC2080_REG_TEMP_THR_H   0x0B

temp thr high register

Definition at line 65 of file driver_hdc2080.c.

◆ HDC2080_REG_TEMP_THR_L

#define HDC2080_REG_TEMP_THR_L   0x0A

temp thr low register

Definition at line 64 of file driver_hdc2080.c.

◆ HDC2080_REG_TEMPERATURE_HIGH

#define HDC2080_REG_TEMPERATURE_HIGH   0x01

temperature high register

Definition at line 55 of file driver_hdc2080.c.

◆ HDC2080_REG_TEMPERATURE_LOW

#define HDC2080_REG_TEMPERATURE_LOW   0x00

chip register definition

temperature low register

Definition at line 54 of file driver_hdc2080.c.

◆ HDC2080_REG_TEMPERATURE_MAX

#define HDC2080_REG_TEMPERATURE_MAX   0x05

temperature max register

Definition at line 59 of file driver_hdc2080.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "Texas Instruments"

manufacturer name

Definition at line 43 of file driver_hdc2080.c.

◆ MAX_CURRENT

#define MAX_CURRENT   90.0f

chip max current

Definition at line 46 of file driver_hdc2080.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   3.6f

chip max supply voltage

Definition at line 45 of file driver_hdc2080.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   1.62f

chip min supply voltage

Definition at line 44 of file driver_hdc2080.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   125.0f

chip max operating temperature

Definition at line 48 of file driver_hdc2080.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -40.0f

chip min operating temperature

Definition at line 47 of file driver_hdc2080.c.