LibDriver SHT30
Loading...
Searching...
No Matches
driver_sht30.h File Reference

driver sht30 header file More...

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

Go to the source code of this file.

Data Structures

struct  sht30_handle_s
 sht30 handle structure definition More...
struct  sht30_info_s
 sht30 information structure definition More...

Macros

#define DRIVER_SHT30_LINK_INIT(HANDLE, STRUCTURE)
 initialize sht30_handle_t structure
#define DRIVER_SHT30_LINK_IIC_INIT(HANDLE, FUC)
 link iic_init function
#define DRIVER_SHT30_LINK_IIC_DEINIT(HANDLE, FUC)
 link iic_deinit function
#define DRIVER_SHT30_LINK_IIC_READ_ADDRESS16(HANDLE, FUC)
 link iic_read_address16 function
#define DRIVER_SHT30_LINK_IIC_WRITE_ADDRESS16(HANDLE, FUC)
 link iic_write_address16 function
#define DRIVER_SHT30_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_SHT30_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function
#define DRIVER_SHT30_LINK_RECEIVE_CALLBACK(HANDLE, FUC)
 link receive_callback function

Typedefs

typedef struct sht30_handle_s sht30_handle_t
 sht30 handle structure definition
typedef struct sht30_info_s sht30_info_t
 sht30 information structure definition

Enumerations

enum  sht30_address_t { SHT30_ADDRESS_0 = (0x44 << 1) , SHT30_ADDRESS_1 = (0x45 << 1) }
 sht30 address enumeration definition More...
enum  sht30_bool_t { SHT30_BOOL_FALSE = 0x00 , SHT30_BOOL_TRUE = 0x01 }
 sht30 bool enumeration definition More...
enum  sht30_rate_t {
  SHT30_RATE_0P5HZ = 0x20 , SHT30_RATE_1HZ = 0x21 , SHT30_RATE_2HZ = 0x22 , SHT30_RATE_4HZ = 0x23 ,
  SHT30_RATE_10HZ = 0x27
}
 sht30 rate enumeration definition More...
enum  sht30_repeatability_t { SHT30_REPEATABILITY_HIGH = 0x00 , SHT30_REPEATABILITY_MEDIUM = 0x01 , SHT30_REPEATABILITY_LOW = 0x02 }
 sht30 repeatability enumeration definition More...
enum  sht30_status_t {
  SHT30_STATUS_ALERT_PENDING_STATUS = (1 << 15) , SHT30_STATUS_HEATER_ON = (1 << 13) , SHT30_STATUS_HUMIDITY_ALERT = (1 << 11) , SHT30_STATUS_TEMPERATURE_ALERT = (1 << 10) ,
  SHT30_STATUS_SYSTEM_RESET = (1 << 4) , SHT30_STATUS_COMMAND_STATUS = (1 << 1) , SHT30_STATUS_CHECKSUM_STATUS = (1 << 0)
}
 sht30 status enumeration definition More...

Functions

uint8_t sht30_info (sht30_info_t *info)
 get chip's information
uint8_t sht30_set_addr_pin (sht30_handle_t *handle, sht30_address_t addr_pin)
 set the iic address pin
uint8_t sht30_get_addr_pin (sht30_handle_t *handle, sht30_address_t *addr_pin)
 get the iic address pin
uint8_t sht30_irq_handler (sht30_handle_t *handle)
 irq handler
uint8_t sht30_init (sht30_handle_t *handle)
 initialize the chip
uint8_t sht30_deinit (sht30_handle_t *handle)
 close the chip
uint8_t sht30_single_read (sht30_handle_t *handle, sht30_bool_t clock_stretching_enable, uint16_t *temperature_raw, float *temperature_s, uint16_t *humidity_raw, float *humidity_s)
 read data once
uint8_t sht30_start_continuous_read (sht30_handle_t *handle, sht30_rate_t rate)
 start reading
uint8_t sht30_stop_continuous_read (sht30_handle_t *handle)
 stop reading
uint8_t sht30_continuous_read (sht30_handle_t *handle, uint16_t *temperature_raw, float *temperature_s, uint16_t *humidity_raw, float *humidity_s)
 read data continuously
uint8_t sht30_get_status (sht30_handle_t *handle, uint16_t *status)
 get the current status
uint8_t sht30_clear_status (sht30_handle_t *handle)
 clear the current status
uint8_t sht30_set_repeatability (sht30_handle_t *handle, sht30_repeatability_t repeatability)
 set the measurement repeatability
uint8_t sht30_get_repeatability (sht30_handle_t *handle, sht30_repeatability_t *repeatability)
 get the measurement repeatability
uint8_t sht30_set_art (sht30_handle_t *handle)
 set the chip art
uint8_t sht30_soft_reset (sht30_handle_t *handle)
 soft reset the chip
uint8_t sht30_set_heater (sht30_handle_t *handle, sht30_bool_t enable)
 enable or disable the chip heater
uint8_t sht30_get_serial_number (sht30_handle_t *handle, uint8_t sn[4])
 get serial number
uint8_t sht30_set_high_alert_limit (sht30_handle_t *handle, uint16_t set, uint16_t clear)
 set high alert limit
uint8_t sht30_get_high_alert_limit (sht30_handle_t *handle, uint16_t *set, uint16_t *clear)
 get high alert limit
uint8_t sht30_set_low_alert_limit (sht30_handle_t *handle, uint16_t set, uint16_t clear)
 set low alert limit
uint8_t sht30_get_low_alert_limit (sht30_handle_t *handle, uint16_t *set, uint16_t *clear)
 get low alert limit
uint8_t sht30_alert_limit_convert_to_register (sht30_handle_t *handle, float temperature, float humidity, uint16_t *reg)
 alert limit convert to register raw data
uint8_t sht30_set_reg (sht30_handle_t *handle, uint16_t command)
 set the chip register
uint8_t sht30_get_reg (sht30_handle_t *handle, uint16_t command, uint8_t *buf, uint16_t len)
 get the chip register

Detailed Description

driver sht30 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_sht30.h.