si70xxvar.h revision 1.2 1 1.2 christos /* $NetBSD: si70xxvar.h,v 1.2 2017/12/29 02:20:47 christos Exp $ */
2 1.2 christos
3 1.1 christos /*
4 1.1 christos * Copyright (c) 2017 Brad Spencer <brad (at) anduin.eldar.org>
5 1.1 christos *
6 1.1 christos * Permission to use, copy, modify, and distribute this software for any
7 1.1 christos * purpose with or without fee is hereby granted, provided that the above
8 1.1 christos * copyright notice and this permission notice appear in all copies.
9 1.1 christos *
10 1.1 christos * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 1.1 christos * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 1.1 christos * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 1.1 christos * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 1.1 christos * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 1.1 christos * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 1.1 christos * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 1.1 christos */
18 1.1 christos
19 1.1 christos #ifndef _DEV_I2C_SI70XXVAR_H_
20 1.1 christos #define _DEV_I2C_SI70XXVAR_H_
21 1.1 christos
22 1.1 christos #define SI70XX_NUM_SENSORS 2
23 1.1 christos #define SI70XX_HUMIDITY_SENSOR 0
24 1.1 christos #define SI70XX_TEMP_SENSOR 1
25 1.1 christos
26 1.1 christos #define SI70XX_RES_NAME 12
27 1.1 christos
28 1.1 christos struct si70xx_sc {
29 1.1 christos int sc_si70xxdebug;
30 1.1 christos device_t sc_dev;
31 1.1 christos i2c_tag_t sc_tag;
32 1.1 christos i2c_addr_t sc_addr;
33 1.1 christos kmutex_t sc_mutex;
34 1.1 christos int sc_numsensors;
35 1.1 christos struct sysmon_envsys *sc_sme;
36 1.1 christos envsys_data_t sc_sensors[SI70XX_NUM_SENSORS];
37 1.1 christos struct sysctllog *sc_si70xxlog;
38 1.1 christos char sc_resolution[SI70XX_RES_NAME];
39 1.1 christos int sc_resnumber;
40 1.1 christos bool sc_ignorecrc;
41 1.1 christos bool sc_vddok;
42 1.1 christos bool sc_heateron;
43 1.1 christos int sc_heaterval;
44 1.1 christos #ifdef HAVE_I2C_EXECV
45 1.1 christos uint32_t sc_clockstretch;
46 1.1 christos #endif
47 1.1 christos int sc_readattempts;
48 1.1 christos };
49 1.1 christos
50 1.1 christos struct si70xx_sensor {
51 1.1 christos const char *desc;
52 1.1 christos enum envsys_units type;
53 1.1 christos };
54 1.1 christos
55 1.1 christos struct si70xx_resolution {
56 1.1 christos const char *text;
57 1.1 christos int num;
58 1.1 christos };
59 1.1 christos
60 1.1 christos #endif
61