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

driver htu31d header file More...

#include <stdio.h>
#include <stdint.h>
#include <string.h>
Include dependency graph for driver_htu31d.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  htu31d_handle_s
 htu31d handle structure definition More...
struct  htu31d_info_s
 htu31d information structure definition More...

Macros

#define DRIVER_HTU31D_LINK_INIT(HANDLE, STRUCTURE)
 initialize htu31d_handle_t structure
#define DRIVER_HTU31D_LINK_IIC_INIT(HANDLE, FUC)
 link iic_init function
#define DRIVER_HTU31D_LINK_IIC_DEINIT(HANDLE, FUC)
 link iic_deinit function
#define DRIVER_HTU31D_LINK_IIC_WRITE(HANDLE, FUC)
 link iic_write function
#define DRIVER_HTU31D_LINK_IIC_READ(HANDLE, FUC)
 link iic_read function
#define DRIVER_HTU31D_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_HTU31D_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function

Typedefs

typedef struct htu31d_handle_s htu31d_handle_t
 htu31d handle structure definition
typedef struct htu31d_info_s htu31d_info_t
 htu31d information structure definition

Enumerations

enum  htu31d_addr_pin_t { HTU31D_ADDR_PIN_LOW = (0x40 << 1) , HTU31D_ADDR_PIN_HIGH = (0x41 << 1) }
 htu31d addr pin enumeration definition More...
enum  htu31d_humidity_osr_t { HTU31D_HUMIDITY_OSR_VERY_HIGH = 3 , HTU31D_HUMIDITY_OSR_HIGH = 2 , HTU31D_HUMIDITY_OSR_MIDDLE = 1 , HTU31D_HUMIDITY_OSR_LOW = 0 }
 htu31d humidity osr enumeration definition More...
enum  htu31d_temperature_osr_t { HTU31D_TEMPERATURE_OSR_VERY_HIGH = 3 , HTU31D_TEMPERATURE_OSR_HIGH = 2 , HTU31D_TEMPERATURE_OSR_MIDDLE = 1 , HTU31D_TEMPERATURE_OSR_LOW = 0 }
 htu31d temperature osr enumeration definition More...
enum  htu31d_diagnostic_t {
  HTU31D_DIAGNOSTIC_NVM_ERROR = (1 << 7) , HTU31D_DIAGNOSTIC_HUMIDITY_UNDER_OVERRUN = (1 << 6) , HTU31D_DIAGNOSTIC_HUMIDITY_HIGH_ERROR = (1 << 5) , HTU31D_DIAGNOSTIC_HUMIDITY_LOW_ERROR = (1 << 4) ,
  HTU31D_DIAGNOSTIC_TEMPERATURE_UNDER_OVERRUN = (1 << 3) , HTU31D_DIAGNOSTIC_TEMPERATURE_HIGH_ERROR = (1 << 2) , HTU31D_DIAGNOSTIC_TEMPERATURE_LOW_ERROR = (1 << 1) , HTU31D_DIAGNOSTIC_HEATER_ON = (1 << 0)
}
 htu31d diagnostic enumeration definition More...

Functions

uint8_t htu31d_info (htu31d_info_t *info)
 get chip's information
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_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_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_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_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

Detailed Description

driver htu31d header 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.h.