hytp14var.h revision 1.2.4.2 1 /* $NetBSD: hytp14var.h,v 1.2.4.2 2014/08/20 00:03:37 tls Exp $ */
2
3 /*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Frank Kardel.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 /*
33 * IST-AG P14 calibrated Hygro-/Temperature sensor module
34 * Devices: HYT-271, HYT-221 and HYT-939
35 *
36 * see:
37 * http://www.ist-ag.com/eh/ist-ag/resource.nsf/imgref/Download_AHHYTM_E2.1.pdf/
38 * $FILE/AHHYTM_E2.1.pdf
39 */
40 #ifndef _DEV_I2C_HYTP14VAR_H_
41 #define _DEV_I2C_HYTP14VAR_H_
42
43 #define HYTP14_DEFAULT_ADDR 0x28
44
45 #define HYTP14_NUM_SENSORS 2
46
47 struct hytp14_sc {
48 device_t sc_dev;
49 i2c_tag_t sc_tag;
50 i2c_addr_t sc_addr;
51
52 int sc_refresh; /* last refresh from hardclock_ticks */
53 int sc_valid; /* ENVSYS validity state for this sensor */
54 uint8_t sc_data[4]; /* last data read */
55
56 int sc_numsensors;
57
58 struct sysmon_envsys *sc_sme;
59 envsys_data_t sc_sensors[HYTP14_NUM_SENSORS];
60 };
61
62 struct hytp14_sensor {
63 const char *desc;
64 enum envsys_units type;
65 void (*refresh)(struct hytp14_sc *, envsys_data_t *);
66 };
67
68 #endif
69 /*
70 * $Log: hytp14var.h,v $
71 * Revision 1.2.4.2 2014/08/20 00:03:37 tls
72 * Rebase to HEAD as of a few days ago.
73 *
74 * Revision 1.2 2014/08/10 16:44:35 tls
75 * Merge tls-earlyentropy branch into HEAD.
76 *
77 * Revision 1.1.4.2 2014/08/10 06:54:51 tls
78 * Rebase.
79 *
80 * Revision 1.1 2014/05/18 11:46:23 kardel
81 * add HYT-221/271/939 humidity/temperature I2C sensor
82 * extend envsys(4) framework by %rH (relative humidity)
83 *
84 */
85