LibDriver STS21
Loading...
Searching...
No Matches
driver_sts21.h File Reference

driver sts21 header file More...

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

Go to the source code of this file.

Data Structures

struct  sts21_handle_s
 sts21 handle structure definition More...
struct  sts21_info_s
 sts21 information structure definition More...

Macros

#define DRIVER_STS21_LINK_INIT(HANDLE, STRUCTURE)
 initialize sts21_handle_t structure
#define DRIVER_STS21_LINK_IIC_INIT(HANDLE, FUC)
 link iic_init function
#define DRIVER_STS21_LINK_IIC_DEINIT(HANDLE, FUC)
 link iic_deinit function
#define DRIVER_STS21_LINK_IIC_WRITE_COMMAND(HANDLE, FUC)
 link iic_write_cmd function
#define DRIVER_STS21_LINK_IIC_WRITE(HANDLE, FUC)
 link iic_write function
#define DRIVER_STS21_LINK_IIC_READ_COMMAND(HANDLE, FUC)
 link iic_read_cmd function
#define DRIVER_STS21_LINK_IIC_READ(HANDLE, FUC)
 link iic_read function
#define DRIVER_STS21_LINK_IIC_READ_WITH_WAIT(HANDLE, FUC)
 link iic_read_with_wait function
#define DRIVER_STS21_LINK_IIC_READ_ADDRESS16(HANDLE, FUC)
 link iic_read_address16 function
#define DRIVER_STS21_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_STS21_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function

Typedefs

typedef struct sts21_handle_s sts21_handle_t
 sts21 handle structure definition
typedef struct sts21_info_s sts21_info_t
 sts21 information structure definition

Enumerations

enum  sts21_bool_t { STS21_BOOL_FALSE = 0x00 , STS21_BOOL_TRUE = 0x01 }
 sts21 bool enumeration definition More...
enum  sts21_status_t { SHT35_STATUS_VDD_OVER_2P25V = 0 , SHT35_STATUS_VDD_LESS_2P25V = 1 }
 sts21 status enumeration definition More...
enum  sts21_mode_t { STS21_MODE_HOLD_MASTER = 0x00 , STS21_MODE_NO_HOLD_MASTER = 0x01 }
 sts21 mode enumeration definition More...
enum  sts21_resolution_t { STS21_RESOLUTION_T_14BIT = 0x00 , STS21_RESOLUTION_T_12BIT = 0x01 , STS21_RESOLUTION_T_13BIT = 0x02 , STS21_RESOLUTION_T_11BIT = 0x03 }
 sts21 resolution enumeration definition More...

Functions

uint8_t sts21_info (sts21_info_t *info)
 get chip's information
uint8_t sts21_init (sts21_handle_t *handle)
 initialize the chip
uint8_t sts21_deinit (sts21_handle_t *handle)
 close the chip
uint8_t sts21_read (sts21_handle_t *handle, uint16_t *temperature_raw, float *temperature_s)
 read data
uint8_t sts21_set_mode (sts21_handle_t *handle, sts21_mode_t mode)
 set chip mode
uint8_t sts21_get_mode (sts21_handle_t *handle, sts21_mode_t *mode)
 get chip mode
uint8_t sts21_soft_reset (sts21_handle_t *handle)
 soft reset the chip
uint8_t sts21_set_resolution (sts21_handle_t *handle, sts21_resolution_t resolution)
 set resolution
uint8_t sts21_get_resolution (sts21_handle_t *handle, sts21_resolution_t *resolution)
 get resolution
uint8_t sts21_set_heater (sts21_handle_t *handle, sts21_bool_t enable)
 enable or disable heater
uint8_t sts21_get_heater (sts21_handle_t *handle, sts21_bool_t *enable)
 get heater status
uint8_t sts21_set_disable_otp_reload (sts21_handle_t *handle, sts21_bool_t enable)
 enable or disable disable otp reload
uint8_t sts21_get_disable_otp_reload (sts21_handle_t *handle, sts21_bool_t *enable)
 get disable otp reload status
uint8_t sts21_get_status (sts21_handle_t *handle, sts21_status_t *status)
 get status
uint8_t sts21_get_serial_number (sts21_handle_t *handle, uint8_t sn[8])
 get serial number
uint8_t sts21_set_reg (sts21_handle_t *handle, uint8_t reg, uint8_t *data, uint16_t len)
 set the chip register
uint8_t sts21_get_reg (sts21_handle_t *handle, uint8_t reg, uint8_t *data, uint16_t len)
 get the chip register
uint8_t sts21_get_reg16 (sts21_handle_t *handle, uint16_t reg, uint8_t *data, uint16_t len)
 get the chip register16
uint8_t sts21_set_cmd (sts21_handle_t *handle, uint8_t *data, uint16_t len)
 set command
uint8_t sts21_get_cmd (sts21_handle_t *handle, uint8_t *data, uint16_t len)
 get command

Detailed Description

driver sts21 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-07-30

history

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

Definition in file driver_sts21.h.