1 /* $NetBSD: am2315var.h,v 1.2 2017/12/29 02:20:47 christos Exp $ */ 2 3 /* 4 * Copyright (c) 2017 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_AM2315VAR_H_ 20 #define _DEV_I2C_AM2315VAR_H_ 21 22 #include <sys/time.h> 23 24 #define AM2315_NUM_SENSORS 2 25 #define AM2315_HUMIDITY_SENSOR 0 26 #define AM2315_TEMP_SENSOR 1 27 28 struct am2315_sc { 29 int sc_am2315debug; 30 device_t sc_dev; 31 i2c_tag_t sc_tag; 32 i2c_addr_t sc_addr; 33 kmutex_t sc_mutex; 34 kmutex_t sc_waitmutex; 35 kcondvar_t sc_condwait; 36 int sc_numsensors; 37 struct sysmon_envsys *sc_sme; 38 envsys_data_t sc_sensors[AM2315_NUM_SENSORS]; 39 struct sysctllog *sc_am2315log; 40 int sc_readcount; 41 int sc_readticks; 42 }; 43 44 struct am2315_sensor { 45 const char *desc; 46 enum envsys_units type; 47 }; 48 49 #endif 50