LibDriver HTU21D
Loading...
Searching...
No Matches
driver_htu21d.h File Reference

driver htu21d header file More...

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

Go to the source code of this file.

Data Structures

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

Macros

#define DRIVER_HTU21D_LINK_INIT(HANDLE, STRUCTURE)
 initialize htu21d_handle_t structure
#define DRIVER_HTU21D_LINK_IIC_INIT(HANDLE, FUC)
 link iic_init function
#define DRIVER_HTU21D_LINK_IIC_DEINIT(HANDLE, FUC)
 link iic_deinit function
#define DRIVER_HTU21D_LINK_IIC_WRITE_CMD(HANDLE, FUC)
 link iic_write_cmd function
#define DRIVER_HTU21D_LINK_IIC_READ_CMD(HANDLE, FUC)
 link iic_read_cmd function
#define DRIVER_HTU21D_LINK_IIC_WRITE(HANDLE, FUC)
 link iic_write function
#define DRIVER_HTU21D_LINK_IIC_READ(HANDLE, FUC)
 link iic_read function
#define DRIVER_HTU21D_LINK_IIC_READ_WITH_SCL(HANDLE, FUC)
 link iic_read_with_scl function
#define DRIVER_HTU21D_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_HTU21D_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function

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
uint8_t htu21d_set_reg (htu21d_handle_t *handle, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t htu21d_get_reg (htu21d_handle_t *handle, uint8_t *buf, uint16_t len)
 get the chip register

Detailed Description

driver htu21d 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
2022-10-31

history

Date Version Author Description
2022/10/31 1.0 Shifeng Li first upload

Definition in file driver_htu21d.h.