LibDriver SHTC3
Loading...
Searching...
No Matches
driver_shtc3.c File Reference

driver shtc3 source file More...

#include "driver_shtc3.h"
Include dependency graph for driver_shtc3.c:

Go to the source code of this file.

Macros

#define CHIP_NAME   "Sensirion SHTC3"
 chip information definition
#define MANUFACTURER_NAME   "Sensirion"
#define SUPPLY_VOLTAGE_MIN   1.62f
#define SUPPLY_VOLTAGE_MAX   3.6f
#define MAX_CURRENT   0.9f
#define TEMPERATURE_MIN   -40.0f
#define TEMPERATURE_MAX   125.0f
#define DRIVER_VERSION   1000
#define SHTC3_ADDRESS   (0x70 << 1)
 chip address definition
#define SHTC3_COMMAND_READ_ID   0xEFC8U
 chip command definition
#define SHTC3_COMMAND_SOFT_RESET   0x805DU
#define SHTC3_COMMAND_SLEEP   0xB098U
#define SHTC3_COMMAND_WAKEUP   0x3517U
#define SHTC3_COMMAND_MEAS_T_POLLING   0x7866U
#define SHTC3_COMMAND_MEAS_T_CLOCKSTR   0x7CA2U
#define SHTC3_COMMAND_MEAS_RH_POLLING   0x58E0U
#define SHTC3_COMMAND_MEAS_RH_CLOCKSTR   0x5C24U
#define SHTC3_COMMAND_LP_MEAS_T_POLLING   0x609CU
#define SHTC3_COMMAND_LP_MEAS_T_CLOCKSTR   0x6458U
#define SHTC3_COMMAND_LP_MEAS_RH_POLLING   0x401AU
#define SHTC3_COMMAND_LP_MEAS_RH_CLOCKSTR   0x44DEU

Functions

uint8_t shtc3_init (shtc3_handle_t *handle)
 initialize the chip
uint8_t shtc3_deinit (shtc3_handle_t *handle)
 close the chip
uint8_t shtc3_read (shtc3_handle_t *handle, shtc3_bool_t clock_stretching_enable, uint16_t *temperature_raw, float *temperature_s, uint16_t *humidity_raw, float *humidity_s)
 normal read
uint8_t shtc3_read_low_power (shtc3_handle_t *handle, shtc3_bool_t clock_stretching_enable, uint16_t *temperature_raw, float *temperature_s, uint16_t *humidity_raw, float *humidity_s)
 read in low power mode
uint8_t shtc3_soft_reset (shtc3_handle_t *handle)
 soft reset the chip
uint8_t shtc3_sleep (shtc3_handle_t *handle)
 sleep
uint8_t shtc3_wakeup (shtc3_handle_t *handle)
 wakeup
uint8_t shtc3_set_reg (shtc3_handle_t *handle, uint16_t command)
 set the chip register
uint8_t shtc3_get_reg (shtc3_handle_t *handle, uint16_t command, uint8_t *buf, uint16_t len)
 get the chip register
uint8_t shtc3_info (shtc3_info_t *info)
 get chip's information

Detailed Description

driver shtc3 source 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-11-03

history

Date Version Author Description
2025/11/03 1.0 Shifeng Li first upload

Definition in file driver_shtc3.c.

Macro Definition Documentation

◆ CHIP_NAME

#define CHIP_NAME   "Sensirion SHTC3"

chip information definition

chip name

Definition at line 42 of file driver_shtc3.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 49 of file driver_shtc3.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "Sensirion"

manufacturer name

Definition at line 43 of file driver_shtc3.c.

◆ MAX_CURRENT

#define MAX_CURRENT   0.9f

chip max current

Definition at line 46 of file driver_shtc3.c.

◆ SHTC3_ADDRESS

#define SHTC3_ADDRESS   (0x70 << 1)

chip address definition

iic device address

Definition at line 54 of file driver_shtc3.c.

◆ SHTC3_COMMAND_LP_MEAS_RH_CLOCKSTR

#define SHTC3_COMMAND_LP_MEAS_RH_CLOCKSTR   0x44DEU

read rh first, clock stretching enabled command

Definition at line 70 of file driver_shtc3.c.

◆ SHTC3_COMMAND_LP_MEAS_RH_POLLING

#define SHTC3_COMMAND_LP_MEAS_RH_POLLING   0x401AU

read rh first, clock stretching disabled command

Definition at line 69 of file driver_shtc3.c.

◆ SHTC3_COMMAND_LP_MEAS_T_CLOCKSTR

#define SHTC3_COMMAND_LP_MEAS_T_CLOCKSTR   0x6458U

read t first, clock stretching enabled command

Definition at line 68 of file driver_shtc3.c.

◆ SHTC3_COMMAND_LP_MEAS_T_POLLING

#define SHTC3_COMMAND_LP_MEAS_T_POLLING   0x609CU

read t first, clock stretching disabled command

Definition at line 67 of file driver_shtc3.c.

◆ SHTC3_COMMAND_MEAS_RH_CLOCKSTR

#define SHTC3_COMMAND_MEAS_RH_CLOCKSTR   0x5C24U

read rh first, clock stretching enabled command

Definition at line 66 of file driver_shtc3.c.

◆ SHTC3_COMMAND_MEAS_RH_POLLING

#define SHTC3_COMMAND_MEAS_RH_POLLING   0x58E0U

read rh first, clock stretching disabled command

Definition at line 65 of file driver_shtc3.c.

◆ SHTC3_COMMAND_MEAS_T_CLOCKSTR

#define SHTC3_COMMAND_MEAS_T_CLOCKSTR   0x7CA2U

read t first, clock stretching enabled command

Definition at line 64 of file driver_shtc3.c.

◆ SHTC3_COMMAND_MEAS_T_POLLING

#define SHTC3_COMMAND_MEAS_T_POLLING   0x7866U

read t first, clock stretching disabled command

Definition at line 63 of file driver_shtc3.c.

◆ SHTC3_COMMAND_READ_ID

#define SHTC3_COMMAND_READ_ID   0xEFC8U

chip command definition

read id register command

Definition at line 59 of file driver_shtc3.c.

◆ SHTC3_COMMAND_SLEEP

#define SHTC3_COMMAND_SLEEP   0xB098U

sleep command

Definition at line 61 of file driver_shtc3.c.

◆ SHTC3_COMMAND_SOFT_RESET

#define SHTC3_COMMAND_SOFT_RESET   0x805DU

soft reset command

Definition at line 60 of file driver_shtc3.c.

◆ SHTC3_COMMAND_WAKEUP

#define SHTC3_COMMAND_WAKEUP   0x3517U

wakeup command

Definition at line 62 of file driver_shtc3.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   3.6f

chip max supply voltage

Definition at line 45 of file driver_shtc3.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   1.62f

chip min supply voltage

Definition at line 44 of file driver_shtc3.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   125.0f

chip max operating temperature

Definition at line 48 of file driver_shtc3.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -40.0f

chip min operating temperature

Definition at line 47 of file driver_shtc3.c.