1 1.1 brad /* $NetBSD: sht4xvar.h,v 1.1 2021/10/03 17:27:02 brad Exp $ */ 2 1.1 brad 3 1.1 brad /* 4 1.1 brad * Copyright (c) 2021 Brad Spencer <brad (at) anduin.eldar.org> 5 1.1 brad * 6 1.1 brad * Permission to use, copy, modify, and distribute this software for any 7 1.1 brad * purpose with or without fee is hereby granted, provided that the above 8 1.1 brad * copyright notice and this permission notice appear in all copies. 9 1.1 brad * 10 1.1 brad * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 1.1 brad * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 1.1 brad * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 1.1 brad * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 1.1 brad * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 1.1 brad * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 1.1 brad * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 1.1 brad */ 18 1.1 brad 19 1.1 brad #ifndef _DEV_I2C_SHT4XVAR_H_ 20 1.1 brad #define _DEV_I2C_SHT4XVAR_H_ 21 1.1 brad 22 1.1 brad #define SHT4X_NUM_SENSORS 2 23 1.1 brad #define SHT4X_HUMIDITY_SENSOR 0 24 1.1 brad #define SHT4X_TEMP_SENSOR 1 25 1.1 brad 26 1.1 brad #define SHT4X_RES_NAME 7 27 1.1 brad #define SHT4X_PULSE_NAME 6 28 1.1 brad 29 1.1 brad struct sht4x_sc { 30 1.1 brad int sc_sht4xdebug; 31 1.1 brad device_t sc_dev; 32 1.1 brad i2c_tag_t sc_tag; 33 1.1 brad i2c_addr_t sc_addr; 34 1.1 brad kmutex_t sc_mutex; 35 1.1 brad int sc_numsensors; 36 1.1 brad struct sysmon_envsys *sc_sme; 37 1.1 brad struct sysctllog *sc_sht4xlog; 38 1.1 brad envsys_data_t sc_sensors[SHT4X_NUM_SENSORS]; 39 1.1 brad bool sc_ignorecrc; 40 1.1 brad char sc_resolution[SHT4X_RES_NAME]; 41 1.1 brad int sc_readattempts; 42 1.1 brad bool sc_heateron; 43 1.1 brad int sc_heaterval; 44 1.1 brad char sc_heaterpulse[SHT4X_PULSE_NAME]; 45 1.1 brad }; 46 1.1 brad 47 1.1 brad struct sht4x_sensor { 48 1.1 brad const char *desc; 49 1.1 brad enum envsys_units type; 50 1.1 brad }; 51 1.1 brad 52 1.1 brad struct sht4x_timing { 53 1.1 brad uint8_t cmd; 54 1.1 brad int typicaldelay; 55 1.1 brad }; 56 1.1 brad 57 1.1 brad struct sht4x_resolution { 58 1.1 brad const char *text; 59 1.1 brad uint8_t cmd; 60 1.1 brad }; 61 1.1 brad 62 1.1 brad struct sht4x_heaterpulse { 63 1.1 brad const char *length; 64 1.1 brad }; 65 1.1 brad 66 1.1 brad struct sht4x_heateron_command { 67 1.1 brad int heatervalue; 68 1.1 brad const char *pulselength; 69 1.1 brad uint8_t cmd; 70 1.1 brad }; 71 1.1 brad 72 1.1 brad #endif 73