![]() |
LibDriver SHT2X
|
driver sht2x source file More...
#include "driver_sht2x.h"Go to the source code of this file.
Macros | |
| #define | CHIP_NAME "Sensirion SHT2X" |
| chip information definition | |
| #define | MANUFACTURER_NAME "Sensirion" |
| #define | SUPPLY_VOLTAGE_MIN 2.1f |
| #define | SUPPLY_VOLTAGE_MAX 3.6f |
| #define | MAX_CURRENT 0.33f |
| #define | TEMPERATURE_MIN -50.0f |
| #define | TEMPERATURE_MAX 125.0f |
| #define | DRIVER_VERSION 1000 |
| #define | SHT2X_COMMAND_TRIGGER_T_MEASUREMENT_HOLD_MASTER 0xE3 |
| chip command definition | |
| #define | SHT2X_COMMAND_TRIGGER_RH_MEASUREMENT_HOLD_MASTER 0xE5 |
| #define | SHT2X_COMMAND_TRIGGER_T_MEASUREMENT_NO_HOLD_MASTER 0xF3 |
| #define | SHT2X_COMMAND_TRIGGER_RH_MEASUREMENT_NO_HOLD_MASTER 0xF5 |
| #define | SHT2X_COMMAND_WRITE_REG 0xE6 |
| #define | SHT2X_COMMAND_READ_REG 0xE7 |
| #define | SHT2X_COMMAND_SOFT_RESET 0xFE |
| #define | SHT2X_COMMAND_GET_SN1 0xFA0FU |
| #define | SHT2X_COMMAND_GET_SN2 0xFCC9U |
| #define | SHT2X_ADDRESS 0x80 |
| chip address definition | |
Functions | |
| uint8_t | sht2x_init (sht2x_handle_t *handle) |
| initialize the chip | |
| uint8_t | sht2x_deinit (sht2x_handle_t *handle) |
| close the chip | |
| uint8_t | sht2x_soft_reset (sht2x_handle_t *handle) |
| soft reset the chip | |
| uint8_t | sht2x_set_resolution (sht2x_handle_t *handle, sht2x_resolution_t resolution) |
| set resolution | |
| uint8_t | sht2x_get_resolution (sht2x_handle_t *handle, sht2x_resolution_t *resolution) |
| get resolution | |
| uint8_t | sht2x_set_heater (sht2x_handle_t *handle, sht2x_bool_t enable) |
| enable or disable heater | |
| uint8_t | sht2x_get_heater (sht2x_handle_t *handle, sht2x_bool_t *enable) |
| get heater status | |
| uint8_t | sht2x_set_disable_otp_reload (sht2x_handle_t *handle, sht2x_bool_t enable) |
| enable or disable disable otp reload | |
| uint8_t | sht2x_get_disable_otp_reload (sht2x_handle_t *handle, sht2x_bool_t *enable) |
| get disable otp reload status | |
| uint8_t | sht2x_get_status (sht2x_handle_t *handle, sht2x_status_t *status) |
| get status | |
| uint8_t | sht2x_set_mode (sht2x_handle_t *handle, sht2x_mode_t mode) |
| set chip mode | |
| uint8_t | sht2x_get_mode (sht2x_handle_t *handle, sht2x_mode_t *mode) |
| get chip mode | |
| uint8_t | sht2x_read (sht2x_handle_t *handle, uint16_t *temperature_raw, float *temperature_s, uint16_t *humidity_raw, float *humidity_s) |
| read data | |
| uint8_t | sht2x_get_serial_number (sht2x_handle_t *handle, uint8_t sn[8]) |
| get serial number | |
| uint8_t | sht2x_set_reg (sht2x_handle_t *handle, uint8_t reg, uint8_t *data, uint16_t len) |
| set the chip register | |
| uint8_t | sht2x_get_reg (sht2x_handle_t *handle, uint8_t reg, uint8_t *data, uint16_t len) |
| get the chip register | |
| uint8_t | sht2x_get_reg16 (sht2x_handle_t *handle, uint16_t reg, uint8_t *data, uint16_t len) |
| get the chip register16 | |
| uint8_t | sht2x_set_cmd (sht2x_handle_t *handle, uint8_t *data, uint16_t len) |
| set command | |
| uint8_t | sht2x_get_cmd (sht2x_handle_t *handle, uint8_t *data, uint16_t len) |
| get command | |
| uint8_t | sht2x_info (sht2x_info_t *info) |
| get chip's information | |
driver sht2x 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.
| Date | Version | Author | Description |
|---|---|---|---|
| 2025/04/30 | 1.0 | Shifeng Li | first upload |
Definition in file driver_sht2x.c.
| #define CHIP_NAME "Sensirion SHT2X" |
| #define DRIVER_VERSION 1000 |
driver version
Definition at line 49 of file driver_sht2x.c.
| #define MANUFACTURER_NAME "Sensirion" |
manufacturer name
Definition at line 43 of file driver_sht2x.c.
| #define MAX_CURRENT 0.33f |
chip max current
Definition at line 46 of file driver_sht2x.c.
| #define SHT2X_ADDRESS 0x80 |
| #define SHT2X_COMMAND_GET_SN1 0xFA0FU |
read from memory location 1 command
Definition at line 61 of file driver_sht2x.c.
| #define SHT2X_COMMAND_GET_SN2 0xFCC9U |
read from memory location 2 command
Definition at line 62 of file driver_sht2x.c.
| #define SHT2X_COMMAND_READ_REG 0xE7 |
read user register command
Definition at line 59 of file driver_sht2x.c.
| #define SHT2X_COMMAND_SOFT_RESET 0xFE |
soft reset command
Definition at line 60 of file driver_sht2x.c.
| #define SHT2X_COMMAND_TRIGGER_RH_MEASUREMENT_HOLD_MASTER 0xE5 |
trigger rh measurement hold master command
Definition at line 55 of file driver_sht2x.c.
| #define SHT2X_COMMAND_TRIGGER_RH_MEASUREMENT_NO_HOLD_MASTER 0xF5 |
trigger rh measurement no hold master command
Definition at line 57 of file driver_sht2x.c.
| #define SHT2X_COMMAND_TRIGGER_T_MEASUREMENT_HOLD_MASTER 0xE3 |
chip command definition
trigger t measurement hold master command
Definition at line 54 of file driver_sht2x.c.
| #define SHT2X_COMMAND_TRIGGER_T_MEASUREMENT_NO_HOLD_MASTER 0xF3 |
trigger t measurement no hold master command
Definition at line 56 of file driver_sht2x.c.
| #define SHT2X_COMMAND_WRITE_REG 0xE6 |
write user register command
Definition at line 58 of file driver_sht2x.c.
| #define SUPPLY_VOLTAGE_MAX 3.6f |
chip max supply voltage
Definition at line 45 of file driver_sht2x.c.
| #define SUPPLY_VOLTAGE_MIN 2.1f |
chip min supply voltage
Definition at line 44 of file driver_sht2x.c.
| #define TEMPERATURE_MAX 125.0f |
chip max operating temperature
Definition at line 48 of file driver_sht2x.c.
| #define TEMPERATURE_MIN -50.0f |
chip min operating temperature
Definition at line 47 of file driver_sht2x.c.