LibDriver STTS22H
Loading...
Searching...
No Matches
driver_stts22h.c File Reference

driver stts22h source file More...

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

Go to the source code of this file.

Macros

#define CHIP_NAME   "STMicroelectronic STTS22H"
 chip information definition
#define MANUFACTURER_NAME   "STMicroelectronic"
#define SUPPLY_VOLTAGE_MIN   1.5f
#define SUPPLY_VOLTAGE_MAX   3.6f
#define MAX_CURRENT   0.18f
#define TEMPERATURE_MIN   -40.0f
#define TEMPERATURE_MAX   125.0f
#define DRIVER_VERSION   1000
#define STTS22H_REG_WHOAMI   0x01
 chip register definition
#define STTS22H_REG_TEMP_H_LIMIT   0x02
#define STTS22H_REG_TEMP_L_LIMIT   0x03
#define STTS22H_REG_CTRL   0x04
#define STTS22H_REG_STATUS   0x05
#define STTS22H_REG_TEMP_L_OUT   0x06
#define STTS22H_REG_TEMP_H_OUT   0x07

Functions

uint8_t stts22h_set_addr_pin (stts22h_handle_t *handle, stts22h_address_t addr_pin)
 set the iic address pin
uint8_t stts22h_get_addr_pin (stts22h_handle_t *handle, stts22h_address_t *addr_pin)
 get the iic address pin
uint8_t stts22h_set_temperature_high_limit (stts22h_handle_t *handle, uint8_t raw)
 set temperature high limit
uint8_t stts22h_get_temperature_high_limit (stts22h_handle_t *handle, uint8_t *raw)
 get temperature high limit
uint8_t stts22h_set_temperature_low_limit (stts22h_handle_t *handle, uint8_t raw)
 set temperature low limit
uint8_t stts22h_get_temperature_low_limit (stts22h_handle_t *handle, uint8_t *raw)
 get temperature low limit
uint8_t stts22h_set_output_data_rate (stts22h_handle_t *handle, stts22h_output_data_rate_t rate)
 set output data rate
uint8_t stts22h_get_output_data_rate (stts22h_handle_t *handle, stts22h_output_data_rate_t *rate)
 get output data rate
uint8_t stts22h_set_block_data_update (stts22h_handle_t *handle, stts22h_bool_t enable)
 enable or disable block data update
uint8_t stts22h_get_block_data_update (stts22h_handle_t *handle, stts22h_bool_t *enable)
 get block data update status
uint8_t stts22h_set_iic_address_auto_increment (stts22h_handle_t *handle, stts22h_bool_t enable)
 enable or disable iic address auto increment
uint8_t stts22h_get_iic_address_auto_increment (stts22h_handle_t *handle, stts22h_bool_t *enable)
 get iic address auto increment status
uint8_t stts22h_set_disable_smbus_timeout (stts22h_handle_t *handle, stts22h_bool_t enable)
 enable or disable disable smbus timeout
uint8_t stts22h_get_disable_smbus_timeout (stts22h_handle_t *handle, stts22h_bool_t *enable)
 get disable smbus timeout status
uint8_t stts22h_get_status (stts22h_handle_t *handle, uint8_t *status)
 get status
uint8_t stts22h_single_read (stts22h_handle_t *handle, int16_t *raw, float *celsius_deg)
 read data from the chip once
uint8_t stts22h_start_continuous_read (stts22h_handle_t *handle)
 start the chip reading
uint8_t stts22h_stop_continuous_read (stts22h_handle_t *handle)
 stop the chip reading
uint8_t stts22h_continuous_read (stts22h_handle_t *handle, int16_t *raw, float *celsius_deg)
 read data from the chip continuously
uint8_t stts22h_irq_handler (stts22h_handle_t *handle)
 irq handler
uint8_t stts22h_temperature_convert_to_register (stts22h_handle_t *handle, float celsius_deg, uint8_t *reg)
 convert the temperature to the register raw data
uint8_t stts22h_temperature_convert_to_data (stts22h_handle_t *handle, uint8_t reg, float *celsius_deg)
 convert the register raw data to the temperature
uint8_t stts22h_init (stts22h_handle_t *handle)
 initialize the chip
uint8_t stts22h_deinit (stts22h_handle_t *handle)
 close the chip
uint8_t stts22h_set_reg (stts22h_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t stts22h_get_reg (stts22h_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 get the chip register
uint8_t stts22h_info (stts22h_info_t *info)
 get chip's information

Detailed Description

driver stts22h 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
2026-02-02

history

Date Version Author Description
2026/02/02 1.0 Shifeng Li first upload

Definition in file driver_stts22h.c.

Macro Definition Documentation

◆ CHIP_NAME

#define CHIP_NAME   "STMicroelectronic STTS22H"

chip information definition

chip name

Definition at line 42 of file driver_stts22h.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 49 of file driver_stts22h.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "STMicroelectronic"

manufacturer name

Definition at line 43 of file driver_stts22h.c.

◆ MAX_CURRENT

#define MAX_CURRENT   0.18f

chip max current

Definition at line 46 of file driver_stts22h.c.

◆ STTS22H_REG_CTRL

#define STTS22H_REG_CTRL   0x04

control register

Definition at line 57 of file driver_stts22h.c.

◆ STTS22H_REG_STATUS

#define STTS22H_REG_STATUS   0x05

status register

Definition at line 58 of file driver_stts22h.c.

◆ STTS22H_REG_TEMP_H_LIMIT

#define STTS22H_REG_TEMP_H_LIMIT   0x02

temperature high limit register

Definition at line 55 of file driver_stts22h.c.

◆ STTS22H_REG_TEMP_H_OUT

#define STTS22H_REG_TEMP_H_OUT   0x07

temperature msb register

Definition at line 60 of file driver_stts22h.c.

◆ STTS22H_REG_TEMP_L_LIMIT

#define STTS22H_REG_TEMP_L_LIMIT   0x03

temperature low limit register

Definition at line 56 of file driver_stts22h.c.

◆ STTS22H_REG_TEMP_L_OUT

#define STTS22H_REG_TEMP_L_OUT   0x06

temperature lsb register

Definition at line 59 of file driver_stts22h.c.

◆ STTS22H_REG_WHOAMI

#define STTS22H_REG_WHOAMI   0x01

chip register definition

who am i register

Definition at line 54 of file driver_stts22h.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   3.6f

chip max supply voltage

Definition at line 45 of file driver_stts22h.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   1.5f

chip min supply voltage

Definition at line 44 of file driver_stts22h.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   125.0f

chip max operating temperature

Definition at line 48 of file driver_stts22h.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -40.0f

chip min operating temperature

Definition at line 47 of file driver_stts22h.c.