1 /* $NetBSD: sht3xreg.h,v 1.4 2024/02/02 22:39:10 andvar Exp $ */ 2 3 /* 4 * Copyright (c) 2021 Brad Spencer <brad@anduin.eldar.org> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 #ifndef _DEV_I2C_SHT3XREG_H_ 20 #define _DEV_I2C_SHT3XREG_H_ 21 22 #define SHT3X_TYPICAL_ADDR_1 0x44 23 #define SHT3X_TYPICAL_ADDR_2 0x45 24 25 26 /* Measurement repeatability and clock steatching 27 * for single shot measurement command 28 */ 29 #define SHT3X_MEASURE_REPEATABILITY_CS_HIGH 0x2C06 30 #define SHT3X_MEASURE_REPEATABILITY_CS_MEDIUM 0x2C0D 31 #define SHT3X_MEASURE_REPEATABILITY_CS_LOW 0x2C10 32 #define SHT3X_MEASURE_REPEATABILITY_NOCS_HIGH 0x2400 33 #define SHT3X_MEASURE_REPEATABILITY_NOCS_MEDIUM 0x240B 34 #define SHT3X_MEASURE_REPEATABILITY_NOCS_LOW 0x2416 35 36 /* Periodic measurements ... .5 mps, 1 mps, 2 mps, 4 mps 37 * and 10 mps at various repeatability. One sets up the 38 * desired mps and repeatability and then calls fetch data 39 * to get the data back at the specified period rate 40 */ 41 #define SHT3X_HALF_MPS_HIGH 0x2032 42 #define SHT3X_HALF_MPS_MEDIUM 0x2024 43 #define SHT3X_HALF_MPS_LOW 0x202F 44 #define SHT3X_ONE_MPS_HIGH 0x2130 45 #define SHT3X_ONE_MPS_MEDIUM 0x2126 46 #define SHT3X_ONE_MPS_LOW 0x212D 47 #define SHT3X_TWO_MPS_HIGH 0x2236 48 #define SHT3X_TWO_MPS_MEDIUM 0x2220 49 #define SHT3X_TWO_MPS_LOW 0x222B 50 #define SHT3X_FOUR_MPS_HIGH 0x2334 51 #define SHT3X_FOUR_MPS_MEDIUM 0x2322 52 #define SHT3X_FOUR_MPS_LOW 0x2329 53 #define SHT3X_TEN_MPS_HIGH 0x2737 54 #define SHT3X_TEN_MPS_MEDIUM 0x2721 55 #define SHT3X_TEN_MPS_LOW 0x272A 56 #define SHT3X_PERIODIC_FETCH_DATA 0xE000 57 58 /* ART, accelerated response time. A method of getting periodic 59 * measurements at 4Hz 60 */ 61 #define SHT3X_ART_ENABLE 0x2B32 62 63 /* Break command or stop periodic measurement */ 64 #define SHT3X_BREAK 0x3093 65 66 /* The heater */ 67 #define SHT3X_HEATER_ENABLE 0x306D 68 #define SHT3X_HEATER_DISABLE 0x3066 69 70 /* status register */ 71 #define SHT3X_GET_STATUS_REGISTER 0xF32D 72 #define SHT3X_CLEAR_STATUS_REGISTER 0x3041 73 /* the bits */ 74 #define SHT3X_ALERT_PENDING 0x8000 75 #define SHT3X_HEATER_STATUS 0x2000 76 #define SHT3X_RH_TRACKING_ALERT 0x0800 77 #define SHT3X_TEMP_TRACKING_ALERT 0x0400 78 #define SHT3X_RESET_DETECTED 0x0010 79 #define SHT3X_LAST_COMMAND_STATUS 0x0002 80 #define SHT3X_WRITE_DATA_CHECKSUM 0x0001 81 82 /* Alert mode */ 83 /* This is not supported by the sht3xtemp driver as 84 the information in the datasheet was not enough to 85 get it working. A read of the registers appears to 86 function just fine, but writes do not do anything, and 87 the chip does not indicate any errors occurred. 88 */ 89 #define SHT3X_READ_HIGH_ALERT_SET 0xE11F 90 #define SHT3X_READ_HIGH_ALERT_CLEAR 0xE114 91 #define SHT3X_READ_LOW_ALERT_SET 0xE102 92 #define SHT3X_READ_LOW_ALERT_CLEAR 0xE109 93 #define SHT3X_WRITE_HIGH_ALERT_SET 0x611D 94 #define SHT3X_WRITE_HIGH_ALERT_CLEAR 0x6116 95 #define SHT3X_WRITE_LOW_ALERT_SET 0x6100 96 #define SHT3X_WRITE_LOW_ALERT_CLEAR 0x610B 97 98 /* Other commands */ 99 #define SHT3X_SOFT_RESET 0x30A2 100 /* this is not documented in the datasheet, but is present in a 101 * lot of example code 102 */ 103 #define SHT3X_READ_SERIAL_NUMBER 0x3780 104 /* this is also not defined in the datasheet, but is present in some 105 * example code. There are, however, no examples of its use. 106 */ 107 #define SHT3X_NO_SLEEP 0x303E 108 109 #endif 110