LibDriver SHT2X
Loading...
Searching...
No Matches
driver_sht2x.h File Reference

driver sht2x header file More...

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

Go to the source code of this file.

Data Structures

struct  sht2x_handle_s
 sht2x handle structure definition More...
struct  sht2x_info_s
 sht2x information structure definition More...

Macros

#define DRIVER_SHT2X_LINK_INIT(HANDLE, STRUCTURE)
 initialize sht2x_handle_t structure
#define DRIVER_SHT2X_LINK_IIC_INIT(HANDLE, FUC)
 link iic_init function
#define DRIVER_SHT2X_LINK_IIC_DEINIT(HANDLE, FUC)
 link iic_deinit function
#define DRIVER_SHT2X_LINK_IIC_WRITE_COMMAND(HANDLE, FUC)
 link iic_write_cmd function
#define DRIVER_SHT2X_LINK_IIC_WRITE(HANDLE, FUC)
 link iic_write function
#define DRIVER_SHT2X_LINK_IIC_READ_COMMAND(HANDLE, FUC)
 link iic_read_cmd function
#define DRIVER_SHT2X_LINK_IIC_READ(HANDLE, FUC)
 link iic_read function
#define DRIVER_SHT2X_LINK_IIC_READ_WITH_WAIT(HANDLE, FUC)
 link iic_read_with_wait function
#define DRIVER_SHT2X_LINK_IIC_READ_ADDRESS16(HANDLE, FUC)
 link iic_read_address16 function
#define DRIVER_SHT2X_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_SHT2X_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function

Typedefs

typedef struct sht2x_handle_s sht2x_handle_t
 sht2x handle structure definition
typedef struct sht2x_info_s sht2x_info_t
 sht2x information structure definition

Enumerations

enum  sht2x_bool_t { SHT2X_BOOL_FALSE = 0x00 , SHT2X_BOOL_TRUE = 0x01 }
 sht2x bool enumeration definition More...
enum  sht2x_status_t { SHT35_STATUS_VDD_OVER_2P25V = 0 , SHT35_STATUS_VDD_LESS_2P25V = 1 }
 sht2x status enumeration definition More...
enum  sht2x_mode_t { SHT2X_MODE_HOLD_MASTER = 0x00 , SHT2X_MODE_NO_HOLD_MASTER = 0x01 }
 sht2x mode enumeration definition More...
enum  sht2x_resolution_t { SHT2X_RESOLUTION_RH_12BIT_T_14BIT = 0x00 , SHT2X_RESOLUTION_RH_8BIT_T_12BIT = 0x01 , SHT2X_RESOLUTION_RH_10BIT_T_13BIT = 0x02 , SHT2X_RESOLUTION_RH_11BIT_T_11BIT = 0x03 }
 sht2x resolution enumeration definition More...

Functions

uint8_t sht2x_info (sht2x_info_t *info)
 get chip's information
uint8_t sht2x_init (sht2x_handle_t *handle)
 initialize the chip
uint8_t sht2x_deinit (sht2x_handle_t *handle)
 close the chip
uint8_t sht2x_read (sht2x_handle_t *handle, uint16_t *temperature_raw, float *temperature_s, uint16_t *humidity_raw, float *humidity_s)
 read data
uint8_t sht2x_set_mode (sht2x_handle_t *handle, sht2x_mode_t mode)
 set chip mode
uint8_t sht2x_get_mode (sht2x_handle_t *handle, sht2x_mode_t *mode)
 get chip mode
uint8_t sht2x_soft_reset (sht2x_handle_t *handle)
 soft reset the chip
uint8_t sht2x_set_resolution (sht2x_handle_t *handle, sht2x_resolution_t resolution)
 set resolution
uint8_t sht2x_get_resolution (sht2x_handle_t *handle, sht2x_resolution_t *resolution)
 get resolution
uint8_t sht2x_set_heater (sht2x_handle_t *handle, sht2x_bool_t enable)
 enable or disable heater
uint8_t sht2x_get_heater (sht2x_handle_t *handle, sht2x_bool_t *enable)
 get heater status
uint8_t sht2x_set_disable_otp_reload (sht2x_handle_t *handle, sht2x_bool_t enable)
 enable or disable disable otp reload
uint8_t sht2x_get_disable_otp_reload (sht2x_handle_t *handle, sht2x_bool_t *enable)
 get disable otp reload status
uint8_t sht2x_get_status (sht2x_handle_t *handle, sht2x_status_t *status)
 get status
uint8_t sht2x_get_serial_number (sht2x_handle_t *handle, uint8_t sn[8])
 get serial number
uint8_t sht2x_set_reg (sht2x_handle_t *handle, uint8_t reg, uint8_t *data, uint16_t len)
 set the chip register
uint8_t sht2x_get_reg (sht2x_handle_t *handle, uint8_t reg, uint8_t *data, uint16_t len)
 get the chip register
uint8_t sht2x_get_reg16 (sht2x_handle_t *handle, uint16_t reg, uint8_t *data, uint16_t len)
 get the chip register16
uint8_t sht2x_set_cmd (sht2x_handle_t *handle, uint8_t *data, uint16_t len)
 set command
uint8_t sht2x_get_cmd (sht2x_handle_t *handle, uint8_t *data, uint16_t len)
 get command

Detailed Description

driver sht2x 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
2025-04-30

history

Date Version Author Description
2025/04/30 1.0 Shifeng Li first upload

Definition in file driver_sht2x.h.