Home | History | Annotate | Line # | Download | only in i2c
am2315var.h revision 1.1
      1  1.1  christos /*
      2  1.1  christos  * Copyright (c) 2017 Brad Spencer <brad (at) anduin.eldar.org>
      3  1.1  christos  *
      4  1.1  christos  * Permission to use, copy, modify, and distribute this software for any
      5  1.1  christos  * purpose with or without fee is hereby granted, provided that the above
      6  1.1  christos  * copyright notice and this permission notice appear in all copies.
      7  1.1  christos  *
      8  1.1  christos  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
      9  1.1  christos  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     10  1.1  christos  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     11  1.1  christos  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     12  1.1  christos  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     13  1.1  christos  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     14  1.1  christos  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     15  1.1  christos  */
     16  1.1  christos 
     17  1.1  christos #ifndef _DEV_I2C_AM2315VAR_H_
     18  1.1  christos #define _DEV_I2C_AM2315VAR_H_
     19  1.1  christos 
     20  1.1  christos #include <sys/time.h>
     21  1.1  christos 
     22  1.1  christos #define AM2315_NUM_SENSORS	2
     23  1.1  christos #define AM2315_HUMIDITY_SENSOR 0
     24  1.1  christos #define AM2315_TEMP_SENSOR 1
     25  1.1  christos 
     26  1.1  christos struct am2315_sc {
     27  1.1  christos 	int 		sc_am2315debug;
     28  1.1  christos 	device_t 	sc_dev;
     29  1.1  christos 	i2c_tag_t 	sc_tag;
     30  1.1  christos 	i2c_addr_t 	sc_addr;
     31  1.1  christos 	kmutex_t 	sc_mutex;
     32  1.1  christos 	kmutex_t 	sc_waitmutex;
     33  1.1  christos 	kcondvar_t 	sc_condwait;
     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[AM2315_NUM_SENSORS];
     37  1.1  christos 	struct sysctllog *sc_am2315log;
     38  1.1  christos 	int 		sc_readcount;
     39  1.1  christos 	int 		sc_readticks;
     40  1.1  christos };
     41  1.1  christos 
     42  1.1  christos struct am2315_sensor {
     43  1.1  christos 	const char     *desc;
     44  1.1  christos 	enum envsys_units type;
     45  1.1  christos };
     46  1.1  christos 
     47  1.1  christos #endif
     48