LibDriver SHT31
Loading...
Searching...
No Matches
driver_sht31.h File Reference

driver sht31 header file More...

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

Go to the source code of this file.

Data Structures

struct  sht31_handle_s
 sht31 handle structure definition More...
struct  sht31_info_s
 sht31 information structure definition More...

Macros

#define DRIVER_SHT31_LINK_INIT(HANDLE, STRUCTURE)
 initialize sht31_handle_t structure
#define DRIVER_SHT31_LINK_IIC_INIT(HANDLE, FUC)
 link iic_init function
#define DRIVER_SHT31_LINK_IIC_DEINIT(HANDLE, FUC)
 link iic_deinit function
#define DRIVER_SHT31_LINK_IIC_READ_ADDRESS16(HANDLE, FUC)
 link iic_read_address16 function
#define DRIVER_SHT31_LINK_IIC_WRITE_ADDRESS16(HANDLE, FUC)
 link iic_write_address16 function
#define DRIVER_SHT31_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_SHT31_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function
#define DRIVER_SHT31_LINK_RECEIVE_CALLBACK(HANDLE, FUC)
 link receive_callback function

Typedefs

typedef struct sht31_handle_s sht31_handle_t
 sht31 handle structure definition
typedef struct sht31_info_s sht31_info_t
 sht31 information structure definition

Enumerations

enum  sht31_address_t { SHT31_ADDRESS_0 = (0x44 << 1) , SHT31_ADDRESS_1 = (0x45 << 1) }
 sht31 address enumeration definition More...
enum  sht31_bool_t { SHT31_BOOL_FALSE = 0x00 , SHT31_BOOL_TRUE = 0x01 }
 sht31 bool enumeration definition More...
enum  sht31_rate_t {
  SHT31_RATE_0P5HZ = 0x20 , SHT31_RATE_1HZ = 0x21 , SHT31_RATE_2HZ = 0x22 , SHT31_RATE_4HZ = 0x23 ,
  SHT31_RATE_10HZ = 0x27
}
 sht31 rate enumeration definition More...
enum  sht31_repeatability_t { SHT31_REPEATABILITY_HIGH = 0x00 , SHT31_REPEATABILITY_MEDIUM = 0x01 , SHT31_REPEATABILITY_LOW = 0x02 }
 sht31 repeatability enumeration definition More...
enum  sht31_status_t {
  SHT31_STATUS_ALERT_PENDING_STATUS = (1 << 15) , SHT31_STATUS_HEATER_ON = (1 << 13) , SHT31_STATUS_HUMIDITY_ALERT = (1 << 11) , SHT31_STATUS_TEMPERATURE_ALERT = (1 << 10) ,
  SHT31_STATUS_SYSTEM_RESET = (1 << 4) , SHT31_STATUS_COMMAND_STATUS = (1 << 1) , SHT31_STATUS_CHECKSUM_STATUS = (1 << 0)
}
 sht31 status enumeration definition More...

Functions

uint8_t sht31_info (sht31_info_t *info)
 get chip's information
uint8_t sht31_set_addr_pin (sht31_handle_t *handle, sht31_address_t addr_pin)
 set the iic address pin
uint8_t sht31_get_addr_pin (sht31_handle_t *handle, sht31_address_t *addr_pin)
 get the iic address pin
uint8_t sht31_irq_handler (sht31_handle_t *handle)
 irq handler
uint8_t sht31_init (sht31_handle_t *handle)
 initialize the chip
uint8_t sht31_deinit (sht31_handle_t *handle)
 close the chip
uint8_t sht31_single_read (sht31_handle_t *handle, sht31_bool_t clock_stretching_enable, uint16_t *temperature_raw, float *temperature_s, uint16_t *humidity_raw, float *humidity_s)
 read data once
uint8_t sht31_start_continuous_read (sht31_handle_t *handle, sht31_rate_t rate)
 start reading
uint8_t sht31_stop_continuous_read (sht31_handle_t *handle)
 stop reading
uint8_t sht31_continuous_read (sht31_handle_t *handle, uint16_t *temperature_raw, float *temperature_s, uint16_t *humidity_raw, float *humidity_s)
 read data continuously
uint8_t sht31_get_status (sht31_handle_t *handle, uint16_t *status)
 get the current status
uint8_t sht31_clear_status (sht31_handle_t *handle)
 clear the current status
uint8_t sht31_set_repeatability (sht31_handle_t *handle, sht31_repeatability_t repeatability)
 set the measurement repeatability
uint8_t sht31_get_repeatability (sht31_handle_t *handle, sht31_repeatability_t *repeatability)
 get the measurement repeatability
uint8_t sht31_set_art (sht31_handle_t *handle)
 set the chip art
uint8_t sht31_soft_reset (sht31_handle_t *handle)
 soft reset the chip
uint8_t sht31_set_heater (sht31_handle_t *handle, sht31_bool_t enable)
 enable or disable the chip heater
uint8_t sht31_get_serial_number (sht31_handle_t *handle, uint8_t sn[4])
 get serial number
uint8_t sht31_set_high_alert_limit (sht31_handle_t *handle, uint16_t set, uint16_t clear)
 set high alert limit
uint8_t sht31_get_high_alert_limit (sht31_handle_t *handle, uint16_t *set, uint16_t *clear)
 get high alert limit
uint8_t sht31_set_low_alert_limit (sht31_handle_t *handle, uint16_t set, uint16_t clear)
 set low alert limit
uint8_t sht31_get_low_alert_limit (sht31_handle_t *handle, uint16_t *set, uint16_t *clear)
 get low alert limit
uint8_t sht31_alert_limit_convert_to_register (sht31_handle_t *handle, float temperature, float humidity, uint16_t *reg)
 alert limit convert to register raw data
uint8_t sht31_set_reg (sht31_handle_t *handle, uint16_t command)
 set the chip register
uint8_t sht31_get_reg (sht31_handle_t *handle, uint16_t command, uint8_t *buf, uint16_t len)
 get the chip register

Detailed Description

driver sht31 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
2.0.0
Author
Shifeng Li
Date
2021-03-05

history

Date Version Author Description
2021/03/05 2.0 Shifeng Li format the code
2020/11/03 1.0 Shifeng Li first upload

Definition in file driver_sht31.h.